WaterProxy.h 1.4 KB

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