CTownHandler.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 CTownInstance;
  13. class CGTownInstance;
  14. class CHeroInstance;
  15. class CTown
  16. {
  17. public:
  18. std::string name; //name of type
  19. std::vector<std::string> names; //names of the town instances
  20. int bonus; //pic number
  21. int typeID;
  22. };
  23. struct Structure
  24. {
  25. int ID;
  26. int3 pos;
  27. std::string defName, borderName, areaName, name;
  28. int townID, group;
  29. };
  30. class CTownHandler
  31. {
  32. CDefHandler * smallIcons;
  33. public:
  34. CTownHandler();
  35. ~CTownHandler();
  36. std::vector<CTown> towns;
  37. std::vector<std::string> tcommands;
  38. void loadNames();
  39. SDL_Surface * getPic(int ID, bool fort=true, bool builded=false); //ID=-1 - blank; -2 - border; -3 - random
  40. static int getTypeByDefName(std::string name);
  41. std::map<int,std::map<int, Structure*> > structures; // <town ID, <structure ID, structure>>
  42. std::vector<CGTownInstance *> townInstances;
  43. };
  44. class CTownInstance
  45. {
  46. public:
  47. int3 pos; //position
  48. CTown * town;
  49. std::string name; // name of town
  50. CCreatureSet garrison;
  51. int builded; //how many buildings has been built this turn
  52. int destroyed; //how many buildings has been destroyed this turn
  53. //TODO:
  54. std::vector<CBuilding *> /*allBuildings,*/ possibleBuildings, builtBuildings;
  55. std::vector<int> creatureIncome; //vector by level
  56. std::vector<int> creaturesLeft; //that can be recruited
  57. CHeroInstance * garrisonHero;
  58. std::vector<CSpell *> possibleSpells, obligatorySpells, availableSpells;
  59. int getSightDistance() const; //returns sight distance
  60. CTownInstance();
  61. };
  62. #endif //CTOWNHANDLER_H