Only using headers?

Pages: 12
Constants as globals aren't so bad. Personally I would still try to assign them to an appropriate owner class if there was one, but that's purely an organizational preference. That is, constants that have to do with physics would go in the class that manages the physics. Constants that have to do with the size of the map would go in the class that manages the map, etc.


An NPC list would likely be owned by either your map/world class, or whatever owns your map/world class. I typically do the latter.

Something like....
1
2
3
4
5
6
class Game
{
private:
  Map worldMap;  // the world map
  std::vector<NPC> npcList;  // the npcs
};


You can then pass a Map pointer to each NPC that tells them what map they're interacting with (likely the pointer will just point to worldMap)

1
2
for(...)
  npcList[i].SetMap( &worldMap );
Hmm... Some of that doesn't make any sense to me, but it has given me a few ideas, and more of an understanding of Class Vectors. Thanks!
Topic archived. No new replies allowed.
Pages: 12