@@ -173,11 +173,14 @@ static bool get_pathability_groups(color_ostream &out, unordered_set<uint16_t> *
173
173
static bool get_entry_tiles (unordered_set<df::coord> * entry_tiles, const unordered_set<uint16_t > & depot_pathability_groups) {
174
174
auto & edge = plotinfo->map_edge ;
175
175
size_t num_edge_tiles = edge.surface_x .size ();
176
+ uint32_t max_x, max_y, max_z;
177
+ Maps::getTileSize (max_x, max_y, max_z);
176
178
bool found = false ;
177
179
for (size_t idx = 0 ; idx < num_edge_tiles; ++idx) {
178
180
df::coord pos (edge.surface_x [idx], edge.surface_y [idx], edge.surface_z [idx]);
179
181
auto wgroup = Maps::getWalkableGroup (pos);
180
- if (depot_pathability_groups.contains (wgroup)) {
182
+ if (depot_pathability_groups.contains (wgroup) &&
183
+ (pos.x == 0 || pos.y == 0 || pos.x == (int16_t )max_x || pos.y == (int16_t )max_y)) {
181
184
found = true ;
182
185
if (!entry_tiles)
183
186
break ;
@@ -372,22 +375,14 @@ static bool wagon_flood(color_ostream &out, unordered_set<df::coord> * wagon_pat
372
375
ctx.seen .emplace (depot_pos);
373
376
ctx.search_edge .emplace (depot_pos);
374
377
375
- auto & edge = plotinfo->map_edge ;
376
- size_t num_edge_tiles = edge.surface_x .size ();
377
- int max_edge_x = edge.surface_x [num_edge_tiles - 1 ];
378
- int max_edge_y = edge.surface_y [num_edge_tiles - 1 ];
379
-
380
378
while (!ctx.search_edge .empty ()) {
381
379
df::coord pos = ctx.search_edge .top ();
382
380
ctx.search_edge .pop ();
383
381
384
382
TRACE (log ,out).print (" checking tile: (%d, %d, %d); pathability group: %d\n " , pos.x , pos.y , pos.z ,
385
383
Maps::getWalkableGroup (pos));
386
384
387
- // Ensure our wagon flood end points lands on an edge tile.
388
- // When there is no path to the depot search_edge will not
389
- // contain any edge tiles.
390
- if ((pos.x == 0 || pos.y == 0 || pos.x == max_edge_x || pos.y == max_edge_y) && entry_tiles.contains (pos)) {
385
+ if (entry_tiles.contains (pos)) {
391
386
found = true ;
392
387
if (!wagon_path)
393
388
break ;
0 commit comments