0

Hi all

I'm having a List of Entity's here which I would like to traverse. I want to call the function DisplayEntity for every node. Here's the catch: I have expanded the Entity class (same name different namespace) to have SDL data and methods. So basicly what I'm trying to do is:

1. If the element in list is of type ark::Entity >> do nothing.
2. If the element in list is of type sdl_ark::Entity >> call the function displayEntity.

using namespace sdl_ark;

void Game::displayEntitys(){
	
	std::list<ark::Entity*>::iterator it;
	
	
	for (it = fEntityList.begin(); it != fEntityList.end(); it++){
		sdl_ark::Entity sdlEntity;
		(*it) = dynamic_cast<ark::Entity*> (&sdlEntity);
		(*it)->displayEntity(fScreen);
	}
}

This is the error I get.

77: error: 'class ark::Entity' has no member named 'displayEntity'


If you need anymore info, please do tell me. Thanks for taking a look.

Edited by PieterA: n/a

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by PieterA
0

Easy fix, is the have a default do-nothing displayEntity for ark::Entity. Alternative is to rethink your design. It looks like your design went bad somewhere, if your left to do the above hack.

0

The easy fix isn't possible because of the fact that I can't have any SDL in my ark::Entity. I have to keep the logic and graphical implementation seperated.

I just want one list with Entity's I can traverse. Both logical and graphical functions have to be called on every Entity. I don't really see another way to do it. Any suggestions?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.