MCPcopy Create free account
hub / github.com/crawl/crawl / startup_step

Function startup_step

crawl-ref/source/startup.cc:1013–1120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1011#endif
1012
1013bool startup_step()
1014{
1015 _initialize();
1016
1017 newgame_def choice = Options.game;
1018
1019 // Setup base game type *before* reading startup prefs -- the prefs file
1020 // may be in a game-specific subdirectory.
1021 crawl_state.type = choice.type;
1022
1023 newgame_def defaults = read_startup_prefs();
1024 if (crawl_state.default_startup_name.size() == 0 && Options.remember_name)
1025 crawl_state.default_startup_name = defaults.name;
1026
1027 // Set the crawl_state gametype to the requested game type. This must
1028 // be done before looking for the savegame or the startup prefs file.
1029 if (crawl_state.type == GAME_TYPE_UNSPECIFIED
1030 && defaults.type != GAME_TYPE_UNSPECIFIED)
1031 {
1032 crawl_state.type = defaults.type;
1033 }
1034
1035 // Name from environment overwrites the one from command line.
1036 if (!SysEnv.crawl_name.empty())
1037 choice.name = SysEnv.crawl_name;
1038
1039#ifdef __ANDROID__
1040 // Request the Android virtual keyboard. Waiting for the SDLActivity to be
1041 // resized avoids some display bugs.
1042 jni_keyboard_control(1);
1043 sleep(1);
1044#endif
1045
1046#ifndef DGAMELAUNCH
1047
1048 if (recent_error_messages() && !Options.suppress_startup_errors)
1049 replay_messages_during_startup();
1050
1051 // startup
1052
1053 // These conditions are ignored for tutorial or sprint, which always trigger
1054 // the relevant submenu. Arena never triggers a menu.
1055 const bool can_bypass_menu =
1056 _exit_type_allows_menu_bypass(crawl_state.last_game_exit.exit_reason)
1057 && crawl_state.last_type != GAME_TYPE_ARENA
1058 && Options.name_bypasses_menu
1059 && is_good_name(choice.name, false);
1060
1061 if (crawl_state.last_type == GAME_TYPE_TUTORIAL
1062 || crawl_state.last_type == GAME_TYPE_SPRINT)
1063 {
1064 // this counts as showing the startup menu
1065 crawl_state.bypassed_startup_menu = false;
1066 choice.type = crawl_state.last_type;
1067 crawl_state.type = crawl_state.last_type;
1068 crawl_state.last_type = GAME_TYPE_UNSPECIFIED;
1069 choice.name = defaults.name;
1070 if (choice.type == GAME_TYPE_TUTORIAL)

Callers 1

_launch_gameFunction · 0.85

Calls 15

_initializeFunction · 0.85
read_startup_prefsFunction · 0.85
jni_keyboard_controlFunction · 0.85
recent_error_messagesFunction · 0.85
is_good_nameFunction · 0.85
_show_startup_menuFunction · 0.85
run_arenaFunction · 0.85
get_save_filenameFunction · 0.85
save_existsFunction · 0.85

Tested by

no test coverage detected