Original Post
This is a long shot, but I'm out of ideas and I can't figure out how to solve this problem. I'm having problems drawing sprites... or rather, with the position of sprites. I've got a list of sprite pointers which I'm sorting based on distance to the camera. The problem is that the sprite's positions are sometimes jumping all over the screen. Without getting into too many specifics, let me just say it's almost impossible to debug. The only real solid thing I've found is that if I disable my sprite sort function, the problem disappears. This completely baffles me, because my sort function doesn't do anything except reorder the list of sprites... the only thing that's supposed to change is the order the engine draws the sprites in. List definition:
std::list<Sprite*> spriteList;
Usage:
spriteList.sort( spriteSort );
Sort Function:
bool spriteSort(const Sprite* a, const Sprite* b) {
return b->distToCamera < a->distToCamera;
}
Has anyone heard of the STL list sort function ever modifying the class data inadvertantly, or am I just grasping for straws?