MCPcopy Create free account
hub / github.com/CleverRaven/Cataclysm-DDA / debug

Function debug

src/debug_menu.cpp:2345–3044  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2343}
2344
2345void debug()
2346{
2347 bool debug_menu_has_hotkey = hotkey_for_action( ACTION_DEBUG,
2348 /*maximum_modifier_count=*/ -1, false ).has_value();
2349 cata::optional<debug_menu_index> action = debug_menu_uilist( debug_menu_has_hotkey );
2350
2351 // For the "cheaty" options, disable achievements when used
2352 achievements_tracker &achievements = get_achievements();
2353 static const std::unordered_set<debug_menu_index> non_cheaty_options = {
2354 debug_menu_index::SAVE_SCREENSHOT,
2355 debug_menu_index::GAME_REPORT,
2356 debug_menu_index::ENABLE_ACHIEVEMENTS,
2357 debug_menu_index::BENCHMARK,
2358 debug_menu_index::SHOW_MSG,
2359 };
2360 const bool should_disable_achievements = action && !is_debug_character() &&
2361 !non_cheaty_options.count( *action );
2362 if( should_disable_achievements && achievements.is_enabled() ) {
2363 static const std::string query(
2364 translate_marker(
2365 "Using this will disable achievements. Proceed?"
2366 "\nThey can be reenabled in the 'game' section of the menu." ) );
2367 if( query_yn( _( query ) ) ) {
2368 achievements.set_enabled( false );
2369 } else {
2370 action = cata::nullopt;
2371 }
2372 }
2373
2374 if( !action ) {
2375 return;
2376 }
2377
2378 get_event_bus().send<event_type::uses_debug_menu>( *action );
2379
2380 avatar &player_character = get_avatar();
2381 map &here = get_map();
2382 switch( *action ) {
2383 case debug_menu_index::WISH:
2384 debug_menu::wishitem( &player_character );
2385 break;
2386
2387 case debug_menu_index::SHORT_TELEPORT:
2388 debug_menu::teleport_short();
2389 break;
2390
2391 case debug_menu_index::LONG_TELEPORT:
2392 debug_menu::teleport_long();
2393 break;
2394
2395 case debug_menu_index::REVEAL_MAP: {
2396 auto &cur_om = g->get_cur_om();
2397 for( int i = 0; i < OMAPX; i++ ) {
2398 for( int j = 0; j < OMAPY; j++ ) {
2399 for( int k = -OVERMAP_DEPTH; k <= OVERMAP_HEIGHT; k++ ) {
2400 cur_om.seen( { i, j, k } ) = true;
2401 }
2402 }

Callers 3

debug_error_promptFunction · 0.85
setupDebugFunction · 0.85
do_regular_actionMethod · 0.85

Calls 15

hotkey_for_actionFunction · 0.85
debug_menu_uilistFunction · 0.85
is_debug_characterFunction · 0.85
teleport_shortFunction · 0.85
teleport_longFunction · 0.85
debug_menu_game_stateFunction · 0.85
debug_menu_spawn_vehicleFunction · 0.85
all_martialart_typesFunction · 0.85
character_edit_menuFunction · 0.85
control_npc_menuFunction · 0.85
spawn_artifactFunction · 0.85
get_wind_arrowFunction · 0.85

Tested by

no test coverage detected