It seems somewhat strange to have a manual implementation of a linked list in a C++ program, let alone with polymorphic nodes. Does it make that much sense that your game objects cannot exist without a list?
I suppose you might rather have something like:
Code:
class Character
{
public:
virtual ~Character() {}
void move();
void place();
int getx() const;
int gety() const;
virtual bool is_valid() const { return true; } //immortal by default
private:
int x, y;
};
class Mortal: class Character
{
public:
virtual bool is_valid() const { return logic_to_determine_if_this_is_alive(); }
};
//and somewhere
std::list<boost::shared_ptr<Character> > characters;
//or
std::list<Character*> characters;
Another thing is that if you are going to do lots of operations on mortals that other characters don't have, why not place them in a separate list?