Skip to content

Commit

Permalink
allow bridges in vehicle pathfinding
Browse files Browse the repository at this point in the history
  • Loading branch information
David Brown authored and kevingranade committed Jul 3, 2019
1 parent cbf1fe9 commit ad6b5c4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/overmapbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,14 +737,15 @@ std::vector<tripoint> overmapbuffer::get_npc_path( const tripoint &src, const tr
int res = 0;
const auto oter = get_ter_at( cur.x, cur.y );
int travel_cost = static_cast<int>( oter->get_travel_cost() );
if( ( road_only && oter->get_name() != "road" ) || ( oter->get_name() == "solid rock" ||
oter->get_name() == "open air" ) ) {
if( ( road_only && ( oter->get_name() != "road" && oter->get_name() != "bridge" ) ) ||
( oter->get_name() == "solid rock" ||
oter->get_name() == "open air" ) ) {
return pf::rejected;
} else if( oter->get_name() == "forest" ) {
travel_cost = 10;
} else if( oter->get_name() == "swamp" ) {
travel_cost = 15;
} else if( oter->get_name() == "road" ) {
} else if( oter->get_name() == "road" || oter->get_name() == "bridge" ) {
travel_cost = 1;
} else if( oter->get_name() == "river" ) {
travel_cost = 20;
Expand Down

0 comments on commit ad6b5c4

Please sign in to comment.