WaterProxy.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * WaterProxy.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 "../Zone.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. struct RouteInfo
  14. {
  15. rmg::Area blocked;
  16. int3 visitable;
  17. int3 boarding;
  18. rmg::Area water;
  19. };
  20. class WaterProxy: public Modificator
  21. {
  22. public:
  23. MODIFICATOR(WaterProxy);
  24. //subclass to store disconnected parts of water zone
  25. struct Lake
  26. {
  27. rmg::Area area; //water tiles
  28. std::map<int3, int> distanceMap; //distance map for lake
  29. std::map<int, rmg::Tileset> reverseDistanceMap;
  30. std::map<TRmgTemplateZoneId, rmg::Area> neighbourZones; //zones boardered. Area - part of land
  31. std::set<TRmgTemplateZoneId> keepConnections;
  32. std::set<TRmgTemplateZoneId> keepRoads;
  33. };
  34. bool waterKeepConnection(const rmg::ZoneConnection & connection, bool createRoad);
  35. RouteInfo waterRoute(Zone & dst);
  36. void process() override;
  37. void init() override;
  38. char dump(const int3 &) override;
  39. const std::vector<Lake> & getLakes() const;
  40. protected:
  41. void collectLakes();
  42. bool placeShipyard(Zone & land, const Lake & lake, si32 guard, bool createRoad, RouteInfo & info);
  43. bool placeBoat(Zone & land, const Lake & lake, bool createRoad, RouteInfo & info);
  44. protected:
  45. std::vector<Lake> lakes; //disconnected parts of zone. Used to work with water zones
  46. std::map<int3, int> lakeMap; //map tile on lakeId which is position of lake in lakes array +1
  47. };
  48. VCMI_LIB_NAMESPACE_END