CTownHandler.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef CTOWNHANDLER_H
  2. #define CTOWNHANDLER_H
  3. #include "../global.h"
  4. #include <set>
  5. class CBuilding;
  6. class CSpell;
  7. class CHero;
  8. class CGTownInstance;
  9. class DLL_EXPORT CTown
  10. {
  11. public:
  12. std::string name; //name of type
  13. std::vector<std::string> names; //names of the town instances
  14. std::vector<int> basicCreatures; //level (from 0) -> ID
  15. std::vector<int> upgradedCreatures; //level (from 0) -> ID
  16. std::map<int,int> hordeLvl; //[0] - first horde building creature level; [1] - second horde building (-1 if not present)
  17. ui32 mageLevel; //max available mage guild level
  18. int bonus; //pic number
  19. ui16 primaryRes, warMachine;
  20. ui8 typeID;
  21. };
  22. struct DLL_EXPORT Structure
  23. {
  24. int ID;
  25. int3 pos;
  26. std::string defName, borderName, areaName, name;
  27. int townID, group;
  28. bool operator<(const Structure & p2) const
  29. {
  30. if(pos.z != p2.pos.z)
  31. return (pos.z) < (p2.pos.z);
  32. else
  33. return (ID) < (p2.ID);
  34. }
  35. };
  36. class DLL_EXPORT CTownHandler
  37. {
  38. public:
  39. std::vector<CTown> towns;
  40. std::vector<std::string> tcommands, hcommands;
  41. std::map<int,std::map<int, Structure*> > structures; // <town ID, <structure ID, structure>>
  42. std::map<int, std::map<int,std::set<int> > > requirements; //requirements[town_id][structure_id] -> set of required buildings
  43. CTownHandler();
  44. ~CTownHandler();
  45. void loadNames();
  46. };
  47. #endif //CTOWNHANDLER_H