CDefObjInfoHandler.h 1.3 KB

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