CBuildingHandler.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef __CBUILDINGHANDLER_H__
  2. #define __CBUILDINGHANDLER_H__
  3. #include "../global.h"
  4. #include <map>
  5. #include <vector>
  6. /*
  7. * CBuildingHandler.h, part of VCMI engine
  8. *
  9. * Authors: listed in file AUTHORS in main folder
  10. *
  11. * License: GNU General Public License v2.0 or later
  12. * Full text of license available in license.txt file, in main folder
  13. *
  14. */
  15. //enum EbuildingType {NEUTRAL=-1, CASTLE, RAMPART, TOWER, INFERNO, NECROPOLIS, DUNGEON, STRONGHOLD, FORTRESS, CONFLUX};
  16. class DLL_EXPORT CBuilding //a typical building encountered in every castle ;]
  17. {
  18. public:
  19. si32 tid, bid; //town ID and structure ID
  20. std::vector<si32> resources;
  21. std::string name;
  22. std::string description;
  23. const std::string &Name();
  24. const std::string &Description();
  25. template <typename Handler> void serialize(Handler &h, const int version)
  26. {
  27. h & tid & bid & resources & name & description;
  28. }
  29. CBuilding(int TID = -1, int BID = -1);
  30. };
  31. class DLL_EXPORT CBuildingHandler
  32. {
  33. public:
  34. std::map<int, std::map<int, CBuilding*> > buildings; ///< first int is the castle ID, second the building ID (in ERM-U format)
  35. std::map<int, std::pair<std::string,std::vector< std::vector< std::vector<int> > > > > hall; //map<castle ID, pair<hall bg name, std::vector< std::vector<building id> >[5]> - external vector is the vector of buildings in the row, internal is the list of buildings for the specific slot
  36. void loadBuildings(); //main loader
  37. ~CBuildingHandler(); //d-tor
  38. template <typename Handler> void serialize(Handler &h, const int version)
  39. {
  40. h & buildings & hall;
  41. }
  42. };
  43. #endif // __CBUILDINGHANDLER_H__