MapRendererContextState.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * MapRendererContext.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../lib/GameConstants.h"
  12. #include "../lib/mapping/MapTilesStorage.h"
  13. #include "../lib/int3.h"
  14. #include <boost/container/small_vector.hpp>
  15. VCMI_LIB_NAMESPACE_BEGIN
  16. struct ObjectPosInfo;
  17. class CGObjectInstance;
  18. VCMI_LIB_NAMESPACE_END
  19. class IMapRendererContext;
  20. // from VwSymbol.def
  21. enum class EWorldViewIcon
  22. {
  23. TOWN = 0,
  24. HERO = 1,
  25. ARTIFACT = 2,
  26. TELEPORT = 3,
  27. GATE = 4,
  28. MINE_WOOD = 5,
  29. MINE_MERCURY = 6,
  30. MINE_STONE = 7,
  31. MINE_SULFUR = 8,
  32. MINE_CRYSTAL = 9,
  33. MINE_GEM = 10,
  34. MINE_GOLD = 11,
  35. RES_WOOD = 12,
  36. RES_MERCURY = 13,
  37. RES_STONE = 14,
  38. RES_SULFUR = 15,
  39. RES_CRYSTAL = 16,
  40. RES_GEM = 17,
  41. RES_GOLD = 18,
  42. ICONS_PER_PLAYER = 19,
  43. ICONS_TOTAL = 19 * 9 // 8 players + neutral set at the end
  44. };
  45. struct MapRendererContextState
  46. {
  47. public:
  48. MapRendererContextState();
  49. using MapObject = ObjectInstanceID;
  50. using MapObjectsList = std::vector<MapObject>;
  51. using ObjectTilesList = boost::container::small_vector<int3, 16>;
  52. MapTilesStorage<MapObjectsList> objects;
  53. std::map<ObjectInstanceID, ObjectTilesList> usedTiles;
  54. void addObject(const CGObjectInstance * object);
  55. void addMovingObject(const CGObjectInstance * object, const int3 & tileFrom, const int3 & tileDest);
  56. void removeObject(const CGObjectInstance * object);
  57. };