/** * Launches the game, after command line arguments have been parsed and processed. */ void openrct2_launch() { if (openrct2_initialise()) { RCT2_GLOBAL(RCT2_ADDRESS_RUN_INTRO_TICK_PART, uint8) = 0; if((gOpenRCT2StartupAction == STARTUP_ACTION_TITLE) && gConfigGeneral.play_intro) gOpenRCT2StartupAction = STARTUP_ACTION_INTRO; switch (gOpenRCT2StartupAction) { case STARTUP_ACTION_INTRO: RCT2_GLOBAL(RCT2_ADDRESS_RUN_INTRO_TICK_PART, uint8) = 1; break; case STARTUP_ACTION_TITLE: RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TITLE_DEMO; break; case STARTUP_ACTION_OPEN: assert(gOpenRCT2StartupActionPath != NULL); if (rct2_open_file(gOpenRCT2StartupActionPath) == 0) break; RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_PLAYING; #ifndef DISABLE_NETWORK if (gNetworkStart == NETWORK_MODE_SERVER) { network_begin_server(gNetworkStartPort); } #endif // DISABLE_NETWORK break; case STARTUP_ACTION_EDIT: if (strlen(gOpenRCT2StartupActionPath) == 0) { editor_load(); } else { editor_load_landscape(gOpenRCT2StartupActionPath); } break; } #ifndef DISABLE_NETWORK if (gNetworkStart == NETWORK_MODE_CLIENT) { network_begin_client(gNetworkStartHost, gNetworkStartPort); } #endif // DISABLE_NETWORK openrct2_loop(); } openrct2_dispose(); // HACK Some threads are still running which causes the game to not terminate. Investigation required! exit(gExitCode); }
/** * Launches the game, after command line arguments have been parsed and processed. */ void openrct2_launch() { if (openrct2_initialise()) { gIntroState = INTRO_STATE_NONE; if ((gOpenRCT2StartupAction == STARTUP_ACTION_TITLE) && gConfigGeneral.play_intro) { gOpenRCT2StartupAction = STARTUP_ACTION_INTRO; } switch (gOpenRCT2StartupAction) { case STARTUP_ACTION_INTRO: gIntroState = INTRO_STATE_PUBLISHER_BEGIN; title_load(); break; case STARTUP_ACTION_TITLE: title_load(); break; case STARTUP_ACTION_OPEN: { bool parkLoaded = false; // A path that includes "://" is illegal with all common filesystems, so it is almost certainly a URL // This way all cURL supported protocols, like http, ftp, scp and smb are automatically handled if (strstr(gOpenRCT2StartupActionPath, "://") != nullptr) { #ifndef DISABLE_HTTP // Download park and open it using its temporary filename char tmpPath[MAX_PATH]; if (!http_download_park(gOpenRCT2StartupActionPath, tmpPath)) { title_load(); break; } parkLoaded = OpenRCT2::OpenParkAutoDetectFormat(tmpPath); #endif } else { parkLoaded = rct2_open_file(gOpenRCT2StartupActionPath); } if (!parkLoaded) { Console::Error::WriteLine("Failed to load '%s'", gOpenRCT2StartupActionPath); title_load(); break; } gScreenFlags = SCREEN_FLAGS_PLAYING; #ifndef DISABLE_NETWORK if (gNetworkStart == NETWORK_MODE_SERVER) { if (gNetworkStartPort == 0) { gNetworkStartPort = gConfigNetwork.default_port; } if (String::IsNullOrEmpty(gCustomPassword)) { network_set_password(gConfigNetwork.default_password); } else { network_set_password(gCustomPassword); } network_begin_server(gNetworkStartPort); } #endif // DISABLE_NETWORK break; } case STARTUP_ACTION_EDIT: if (String::SizeOf(gOpenRCT2StartupActionPath) == 0) { editor_load(); } else if (!editor_load_landscape(gOpenRCT2StartupActionPath)) { title_load(); } break; } #ifndef DISABLE_NETWORK if (gNetworkStart == NETWORK_MODE_CLIENT) { if (gNetworkStartPort == 0) { gNetworkStartPort = gConfigNetwork.default_port; } network_begin_client(gNetworkStartHost, gNetworkStartPort); } #endif // DISABLE_NETWORK OpenRCT2::RunGameLoop(); } openrct2_dispose(); // HACK Some threads are still running which causes the game to not terminate. Investigation required! exit(gExitCode); }