CDefObjInfoHandler.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef COBJINFOECTHANDLER_H
  2. #define COBJINFOECTHANDLER_H
  3. #include <vector>
  4. #include <map>
  5. #include "../global.h"
  6. class CDefHandler;
  7. class CLodHandler;
  8. class DLL_EXPORT CGDefInfo
  9. {
  10. public:
  11. std::string name;
  12. unsigned char visitMap[6];
  13. unsigned char blockMap[6];
  14. unsigned char visitDir; //directions from which object can be entered, format same as for moveDir in CGHeroInstance(but 0 - 7)
  15. int id, subid; //of object described by this defInfo
  16. int terrainAllowed, //on which terrain it is possible to place object
  17. terrainMenu; //in which menus in map editor object will be showed
  18. int width, height; //tiles
  19. int type; //(0- ground, 1- towns, 2-creatures, 3- heroes, 4-artifacts, 5- resources)
  20. CDefHandler * handler;
  21. int printPriority;
  22. bool isVisitable();
  23. bool operator<(const CGDefInfo& por)
  24. {
  25. if(id!=por.id)
  26. return id<por.id;
  27. else
  28. return subid<por.subid;
  29. }
  30. template <typename Handler> void serialize(Handler &h, const int version)
  31. {
  32. h & name & visitMap & blockMap & visitDir & id & subid &terrainAllowed & terrainMenu & width & height & type & printPriority;
  33. }
  34. CGDefInfo();
  35. };
  36. class DLL_EXPORT CDefObjInfoHandler
  37. {
  38. public:
  39. std::map<int,std::map<int,CGDefInfo*> > gobjs;
  40. std::map<int,CGDefInfo*> castles;
  41. //std::vector<DefObjInfo> objs;
  42. void load();
  43. };
  44. #endif //COBJINFOECTHANDLER_H