CTownHandler.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. class CTownHandler
  24. {
  25. CDefHandler * smallIcons;
  26. public:
  27. CTownHandler();
  28. ~CTownHandler();
  29. std::vector<CTown> towns;
  30. std::vector<std::string> tcommands;
  31. void loadNames();
  32. SDL_Surface * getPic(int ID, bool fort=true, bool builded=false); //ID=-1 - blank; -2 - border; -3 - random
  33. static int getTypeByDefName(std::string name);
  34. std::vector<CGTownInstance *> townInstances;
  35. };
  36. class CTownInstance
  37. {
  38. public:
  39. int3 pos; //position
  40. CTown * town;
  41. std::string name; // name of town
  42. CCreatureSet garrison;
  43. int builded; //how many buildings has been built this turn
  44. int destroyed; //how many buildings has been destroyed this turn
  45. //TODO:
  46. std::vector<CBuilding *> /*allBuildings,*/ possibleBuildings, builtBuildings;
  47. std::vector<int> creatureIncome; //vector by level
  48. std::vector<int> creaturesLeft; //that can be recruited
  49. CHeroInstance * garrisonHero;
  50. std::vector<CSpell *> possibleSpells, obligatorySpells, availableSpells;
  51. int getSightDistance() const; //returns sight distance
  52. CTownInstance();
  53. };
  54. #endif //CTOWNHANDLER_H