Codechange: Remove macros and use direct methods instead (#13257)

This commit is contained in:
SamuXarick 2025-01-03 17:13:41 +00:00 committed by GitHub
parent b3660bf24a
commit b91f8c13b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1321,9 +1321,6 @@ static void BuildRiver(TileIndex begin, TileIndex end, TileIndex spring, bool ma
*/ */
static std::tuple<bool, bool> FlowRiver(TileIndex spring, TileIndex begin, uint min_river_length) static std::tuple<bool, bool> FlowRiver(TileIndex spring, TileIndex begin, uint min_river_length)
{ {
# define SET_MARK(x) marks.insert(x)
# define IS_MARKED(x) (marks.find(x) != marks.end())
uint height_begin = TileHeight(begin); uint height_begin = TileHeight(begin);
if (IsWaterTile(begin)) { if (IsWaterTile(begin)) {
@ -1331,7 +1328,7 @@ static std::tuple<bool, bool> FlowRiver(TileIndex spring, TileIndex begin, uint
} }
std::set<TileIndex> marks; std::set<TileIndex> marks;
SET_MARK(begin); marks.insert(begin);
/* Breadth first search for the closest tile we can flow down to. */ /* Breadth first search for the closest tile we can flow down to. */
std::list<TileIndex> queue; std::list<TileIndex> queue;
@ -1352,8 +1349,8 @@ static std::tuple<bool, bool> FlowRiver(TileIndex spring, TileIndex begin, uint
for (DiagDirection d = DIAGDIR_BEGIN; d < DIAGDIR_END; d++) { for (DiagDirection d = DIAGDIR_BEGIN; d < DIAGDIR_END; d++) {
TileIndex t = end + TileOffsByDiagDir(d); TileIndex t = end + TileOffsByDiagDir(d);
if (IsValidTile(t) && !IS_MARKED(t) && FlowsDown(end, t)) { if (IsValidTile(t) && !marks.contains(t) && FlowsDown(end, t)) {
SET_MARK(t); marks.insert(t);
count++; count++;
queue.push_back(t); queue.push_back(t);
} }