Use ring buffers for tile/landscape candidate queues

This commit is contained in:
Jonathan G Rennison 2023-08-18 18:48:12 +01:00
parent 69683eecb8
commit 7502fbd44b
2 changed files with 4 additions and 4 deletions

View File

@ -35,10 +35,10 @@
#include "town.h"
#include "3rdparty/cpp-btree/btree_set.h"
#include "scope_info.h"
#include "core/ring_buffer.hpp"
#include <array>
#include <list>
#include <set>
#include <deque>
#include "table/strings.h"
#include "table/sprites.h"
@ -1359,7 +1359,7 @@ static bool FlowRiver(TileIndex spring, TileIndex begin, uint min_river_length)
SET_MARK(begin);
/* Breadth first search for the closest tile we can flow down to. */
std::deque<TileIndex> queue;
ring_buffer<TileIndex> queue;
queue.push_back(begin);
bool found = false;

View File

@ -15,8 +15,8 @@
#include "rail_map.h"
#include "tunnelbridge_map.h"
#include "3rdparty/cpp-btree/btree_map.h"
#include "core/ring_buffer.hpp"
#include <array>
#include <deque>
#include <memory>
#if defined(__linux__)
@ -442,7 +442,7 @@ bool EnoughContiguousTilesMatchingCondition(TileIndex tile, uint threshold, Test
static_assert(MAX_MAP_TILES_BITS <= 30);
btree::btree_set<uint32> processed_tiles;
std::deque<uint32> candidates;
ring_buffer<uint32> candidates;
uint matching_count = 0;
auto process_tile = [&](TileIndex t, DiagDirection exclude_onward_dir) {