CDefObjInfoHandler.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #include "GameConstants.h"
  3. #include "../lib/ConstTransitivePtr.h"
  4. /*
  5. * CDefObjInfoHandler.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. class CDefEssential;
  14. class DLL_LINKAGE CGDefInfo
  15. {
  16. public:
  17. std::string name;
  18. ui8 visitMap[6];
  19. ui8 blockMap[6];
  20. ui8 coverageMap[6], shadowCoverage[6]; //to determine which tiles are covered by picture of this object
  21. ui8 visitDir; //directions from which object can be entered, format same as for moveDir in CGHeroInstance(but 0 - 7)
  22. si32 id, subid; //of object described by this defInfo
  23. si32 terrainAllowed, //on which terrain it is possible to place object
  24. terrainMenu; //in which menus in map editor object will be showed
  25. si32 width, height; //tiles
  26. si32 type; //(0- ground, 1- towns, 2-creatures, 3- heroes, 4-artifacts, 5- resources)
  27. si32 printPriority;
  28. bool isVisitable() const;
  29. bool operator<(const CGDefInfo& por) const
  30. {
  31. if(id!=por.id)
  32. return id<por.id;
  33. else
  34. return subid<por.subid;
  35. }
  36. template <typename Handler> void serialize(Handler &h, const int version)
  37. {
  38. h & name & visitMap & blockMap & visitDir & id & subid &terrainAllowed
  39. & terrainMenu & width & height & type & printPriority & coverageMap & shadowCoverage;
  40. }
  41. CGDefInfo();
  42. void fetchInfoFromMSK();
  43. };
  44. class DLL_LINKAGE CDefObjInfoHandler
  45. {
  46. public:
  47. bmap<int, bmap<int, ConstTransitivePtr<CGDefInfo> > > gobjs;
  48. bmap<TFaction, ConstTransitivePtr<CGDefInfo> > capitols;
  49. bmap<TFaction, ConstTransitivePtr<CGDefInfo> > villages;
  50. void load();
  51. ~CDefObjInfoHandler();
  52. template <typename Handler> void serialize(Handler &h, const int version)
  53. {
  54. h & gobjs & capitols & villages;
  55. }
  56. };