2
0

CDefObjInfoHandler.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 CLodHandler;
  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<int, ConstTransitivePtr<CGDefInfo> > castles;
  49. void load();
  50. ~CDefObjInfoHandler();
  51. template <typename Handler> void serialize(Handler &h, const int version)
  52. {
  53. h & gobjs;
  54. h & castles;
  55. }
  56. };