Skip to content

Commit

Permalink
Display path for tiles overmap too, not just ascii
Browse files Browse the repository at this point in the history
  • Loading branch information
RenechCDDA committed Jun 16, 2024
1 parent 06b458d commit 2e80177
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -1154,6 +1154,9 @@ class game
// show NPC pathfinding on overmap ui
bool debug_pathfinding = false; // NOLINT(cata-serialize)

//Ugly kludge to pass info to tile overmaps
npc *follower_path_to_show = nullptr;

Check failure on line 1158 in src/game.h

View workflow job for this annotation

GitHub Actions / build (src)

Function 'serialize' appears to be a serialization function for class 'game' but does not mention field 'follower_path_to_show'. [cata-serialize,-warnings-as-errors]

/* tile overlays */
// Toggle all other overlays off and flip the given overlay on/off.
void display_toggle_overlay( action_id );
Expand Down
2 changes: 2 additions & 0 deletions src/npctalk_funcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,9 @@ void talk_function::goto_location( npc &p )
add_msg( m_info, _( "That is not a valid destination for %s." ), p.disp_name() );
return;
}
g->follower_path_to_show = &p; // Necessary for overmap display in tiles version...
ui::omap::display_npc_path( p.global_omt_location(), p.omt_path );
g->follower_path_to_show = nullptr;
if( !query_yn( _( "Is this path and destination acceptable?" ) ) ) {
p.goal = npc::no_goal_point;
p.omt_path.clear();
Expand Down
9 changes: 9 additions & 0 deletions src/sdltiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,15 @@ void cata_tiles::draw_om( const point &dest, const tripoint_abs_omt &center_abs_
}
}

if( g->follower_path_to_show ) {
for( const tripoint_abs_omt &pos : g->follower_path_to_show->omt_path ) {
if( pos.z() == center_abs_omt.z() ) {
draw_from_id_string( "highlight", global_omt_to_draw_position( pos ), 0, 0, lit_level::LIT,
false );
}
}
}

// only draw in full tiles so it doesn't get cut off
const std::optional<std::pair<tripoint_abs_omt, std::string>> mission_arrow =
get_mission_arrow( full_om_tile_area, center_abs_omt );
Expand Down

0 comments on commit 2e80177

Please sign in to comment.