Skip to content

Commit

Permalink
fix: huge elevators not working for vehicles
Browse files Browse the repository at this point in the history
used floodfill to optain arbitrary size of elevator tiles.
  • Loading branch information
scarf005 committed Dec 14, 2023
1 parent d56f47b commit 7d8368f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/iexamine_elevator.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#include "detached_ptr.h"
#include <optional>

#include "cata_algo.h"
#include "game.h"
#include "iexamine.h"
#include "mapdata.h"
#include "flood_fill.h"
#include "output.h"
#include "omdata.h"
#include "overmapbuffer.h"
Expand Down Expand Up @@ -38,13 +39,10 @@ auto here( const Character &you ) -> elevator::tiles
const auto &here = get_map();
const auto &points = closest_points_first( you.pos(), SEEX - 1 );

elevator::tiles tiles;
std::copy_if( points.begin(), points.end(), std::back_inserter( tiles ),
[&here]( const tripoint & pos ) {
return here.has_flag( TFLAG_ELEVATOR, pos );
} );
const auto is_elevator = [&here]( const tripoint & pos ) -> bool { return here.has_flag( TFLAG_ELEVATOR, pos ); };

return tiles;
std::unordered_set<tripoint> visited;
return ff::point_flood_fill_4_connected( you.pos(), visited, is_elevator );
}

auto dest( const elevator::tiles &elevator_here,
Expand Down

0 comments on commit 7d8368f

Please sign in to comment.