CDefObjInfoHandler.h 1.7 KB

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