RoadPlacer.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * RoadPlacer.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. const float VISITABLE_PENALTY = 1.33f;
  14. class RoadPlacer: public Modificator
  15. {
  16. public:
  17. MODIFICATOR(RoadPlacer);
  18. void process() override;
  19. void postProcess();
  20. void init() override;
  21. char dump(const int3 &) override;
  22. void addRoadNode(const int3 & node);
  23. void connectRoads(); //fills "roads" according to "roadNodes"
  24. // TODO: Use setters?
  25. rmg::Area & areaForRoads();
  26. rmg::Area & areaIsolated();
  27. rmg::Area & areaVisitable();
  28. const rmg::Area & getRoads() const;
  29. protected:
  30. bool createRoad(const int3 & dst);
  31. rmg::Path createRoadDesperate(rmg::Path & path, const int3 & destination);
  32. void drawRoads(bool secondary = false); //actually updates tiles
  33. protected:
  34. rmg::Tileset roadNodes; //tiles to be connected with roads
  35. rmg::Area roads; //all tiles with roads
  36. rmg::Area areaRoads;
  37. rmg::Area isolated;
  38. rmg::Area visitableTiles; // Tiles occupied by removable or passable objects
  39. bool noRoadNodes = false;
  40. };
  41. VCMI_LIB_NAMESPACE_END