WaterProxy.h 1.4 KB

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