CTownHandler.h 1.5 KB

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