CTownHandler.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef CTOWNHANDLER_H
  2. #define CTOWNHANDLER_H
  3. #include "CDefHandler.h"
  4. #include "CCreatureHandler.h"
  5. #include "SDL.h"
  6. #include "../int3.h"
  7. #include <string>
  8. #include <vector>
  9. class CBuilding;
  10. class CSpell;
  11. class CHero;
  12. class CGTownInstance;
  13. class CTown
  14. {
  15. public:
  16. std::string name; //name of type
  17. std::vector<std::string> names; //names of the town instances
  18. int bonus; //pic number
  19. int typeID;
  20. };
  21. struct Structure
  22. {
  23. int ID;
  24. int3 pos;
  25. std::string defName, borderName, areaName, name;
  26. int townID, group;
  27. bool operator<(const Structure & p2) const
  28. {
  29. if(pos.z != p2.pos.z)
  30. return (pos.z) < (p2.pos.z);
  31. else
  32. return (ID) < (p2.ID);
  33. }
  34. };
  35. class CTownHandler
  36. {
  37. CDefHandler * smallIcons;
  38. public:
  39. CTownHandler();
  40. ~CTownHandler();
  41. std::vector<CTown> towns;
  42. std::vector<std::string> tcommands;
  43. void loadNames();
  44. SDL_Surface * getPic(int ID, bool fort=true, bool builded=false); //ID=-1 - blank; -2 - border; -3 - random
  45. static int getTypeByDefName(std::string name);
  46. std::map<int,std::map<int, Structure*> > structures; // <town ID, <structure ID, structure>>
  47. std::vector<CGTownInstance *> townInstances;
  48. };
  49. #endif //CTOWNHANDLER_H