Skip to content

Commit

Permalink
Debug reveal overmap: Select vision level
Browse files Browse the repository at this point in the history
Ease debugging by allowing revealing overmaps at any vision level.
  • Loading branch information
ehughsbaird committed Jul 27, 2024
1 parent 60c7f59 commit 2df7c36
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
13 changes: 12 additions & 1 deletion src/debug_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3668,11 +3668,22 @@ void debug()
break;

case debug_menu_index::REVEAL_MAP: {
uilist vis_sel;
vis_sel.text = _( "Reveal at which vision level?" );
for( int i = static_cast<int>( om_vision_level::unseen );
i < static_cast<int>( om_vision_level::last ); ++i ) {
vis_sel.addentry( i, true, std::nullopt, io::enum_to_string( static_cast<om_vision_level>( i ) ) );
}
vis_sel.query();
int vis_ret = vis_sel.ret;
if( vis_ret == UILIST_CANCEL ) {
break;
}
overmap &cur_om = g->get_cur_om();
for( int i = 0; i < OMAPX; i++ ) {
for( int j = 0; j < OMAPY; j++ ) {
for( int k = -OVERMAP_DEPTH; k <= OVERMAP_HEIGHT; k++ ) {
cur_om.set_seen( { i, j, k }, om_vision_level::full );
cur_om.set_seen( { i, j, k }, static_cast<om_vision_level>( vis_ret ), true );
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/overmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3203,13 +3203,13 @@ std::vector<oter_id> overmap::predecessors( const tripoint_om_omt &p )
return it->second;
}

void overmap::set_seen( const tripoint_om_omt &p, om_vision_level val )
void overmap::set_seen( const tripoint_om_omt &p, om_vision_level val, bool force )
{
if( !inbounds( p ) ) {
return;
}

if( seen( p ) >= val ) {
if( !force && seen( p ) >= val ) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/overmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class overmap
std::optional<mapgen_arguments> *mapgen_args( const tripoint_om_omt & );
std::string *join_used_at( const om_pos_dir & );
std::vector<oter_id> predecessors( const tripoint_om_omt & );
void set_seen( const tripoint_om_omt &p, om_vision_level val );
void set_seen( const tripoint_om_omt &p, om_vision_level val, bool force = false );
om_vision_level seen( const tripoint_om_omt &p ) const;
bool seen_more_than( const tripoint_om_omt &p, om_vision_level test ) const;
bool &explored( const tripoint_om_omt &p );
Expand Down

0 comments on commit 2df7c36

Please sign in to comment.