CBuildingHandler.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #pragma once
  2. #include "../lib/ConstTransitivePtr.h"
  3. #include "ResourceSet.h"
  4. /*
  5. * CBuildingHandler.h, part of VCMI engine
  6. *
  7. * Authors: listed in file AUTHORS in main folder
  8. *
  9. * License: GNU General Public License v2.0 or later
  10. * Full text of license available in license.txt file, in main folder
  11. *
  12. */
  13. //enum EbuildingType {NEUTRAL=-1, CASTLE, RAMPART, TOWER, INFERNO, NECROPOLIS, DUNGEON, STRONGHOLD, FORTRESS, CONFLUX};
  14. class DLL_LINKAGE CBuilding //a typical building encountered in every castle ;]
  15. {
  16. public:
  17. si32 tid, bid; //town ID and structure ID
  18. TResources resources;
  19. std::string name;
  20. std::string description;
  21. const std::string &Name() const;
  22. const std::string &Description() const;
  23. template <typename Handler> void serialize(Handler &h, const int version)
  24. {
  25. h & tid & bid & resources & name & description;
  26. }
  27. CBuilding(int TID = -1, int BID = -1);
  28. };
  29. class DLL_LINKAGE CBuildingHandler
  30. {
  31. public:
  32. std::vector< bmap<int, ConstTransitivePtr<CBuilding> > > buildings; ///< vector by castle ID, second the building ID (in ERM-U format)
  33. bmap<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
  34. void loadBuildings(); //main loader
  35. ~CBuildingHandler(); //d-tor
  36. static int campToERMU(int camp, int townType, std::set<si32> builtBuildings);
  37. template <typename Handler> void serialize(Handler &h, const int version)
  38. {
  39. h & buildings & hall;
  40. }
  41. };