From 5fd7344a6d8acfe130669750de8b71ba711f5d9c Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Mon, 5 May 2025 00:56:59 +0100 Subject: [PATCH] Codechange: Use FlatSet when creating rivers. --- src/landscape.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/landscape.cpp b/src/landscape.cpp index 19b3c690b0..5db1c9177a 100644 --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -27,6 +27,7 @@ #include "effectvehicle_func.h" #include "landscape_type.h" #include "animated_tile_func.h" +#include "core/flatset_type.hpp" #include "core/random_func.hpp" #include "object_base.h" #include "company_func.h" @@ -1303,7 +1304,7 @@ static std::tuple FlowRiver(TileIndex spring, TileIndex begin, uint return { DistanceManhattan(spring, begin) > min_river_length, GetTileZ(begin) == 0 }; } - std::set marks; + FlatSet marks; marks.insert(begin); /* Breadth first search for the closest tile we can flow down to. */ @@ -1339,7 +1340,7 @@ static std::tuple FlowRiver(TileIndex spring, TileIndex begin, uint std::tie(found, main_river) = FlowRiver(spring, end, min_river_length); } else if (count > 32) { /* Maybe we can make a lake. Find the Nth of the considered tiles. */ - std::set::const_iterator cit = marks.cbegin(); + auto cit = marks.cbegin(); std::advance(cit, RandomRange(count - 1)); TileIndex lake_centre = *cit;