CBuildingHandler.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. int tid, bid; //town ID and structure ID
  20. std::vector<int> 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. };
  30. class DLL_EXPORT CBuildingHandler
  31. {
  32. public:
  33. std::map<int, std::map<int, CBuilding*> > buildings; ///< first int is the castle ID, second the building ID (in ERM-U format)
  34. 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
  35. void loadBuildings(); //main loader
  36. ~CBuildingHandler();
  37. template <typename Handler> void serialize(Handler &h, const int version)
  38. {
  39. h & buildings & hall;
  40. }
  41. };
  42. #endif // __CBUILDINGHANDLER_H__