Hello peoples. Are any of you fammiliar with the data structures book called "Data Structures for Game Programmers" by Ron Penton? Well, I'm trying to get two aspects that I have learned from that book to work together. First let me show you the code I have so far.
The class from which other classes are based:
class Object
{
public:
virtual void Update() = 0;
virtual void Draw() = 0;
virtual void Delete() = 0;
};
An example of one of the classes based on the one above (not finished though)
class Player : public Object
{
public:
float x,y,xvel,yvel;
float facing;
int frame;
int frame_counter;
Image character_set;
int life;
int score;
int invincible;
int coins_collected;
int enemies_killed;
int looking_up;
int going_pipe;
int going_door;
bool captain;
void Update()
{
}
void Draw()
{
}
void Delete()
{
}
};
Now, my goal is to be able to have a doubly linked list of all the things that I can iterate through and call Update() and such. Well after creating a global list of objects (pointers to them actually):
DLinkedList<Object*> Objects;
I attempted to iterate through them and call the update function:
DListIterator<Object*> itr;
itr = Objects.GetIterator();
for(itr.Start(); itr.Valid(); itr.Forth())
{
itr.Update();
}
But when I compile I get this disgusting message:
Microsoft Visual C++ said:
blaablaa.cpp: In function `void DrawFrame()':
blaablaa.cpp:165: no matching function for call to
`DListIterator<Object*>::Update()'
NMAKE : fatal error U1077: 'C:\DevKitDC\bin\g++.exe' : return code '0x1'
Stop.
Error executing NMAKE.
blaablaa.exe - 1 error(s), 4 warning(s)
I think I did something wrong in the inheritance department... And yes I am using "LinkedList.h". By the way, this is compiled for the DreamCast if that has anything to do with it (it doesn't...).
Any suggestions?