mirror of https://github.com/OpenRCT2/OpenRCT2.git
fix command line hosting of scenario files
This commit is contained in:
parent
4c60c124c9
commit
a99a2f0cf4
|
@ -208,7 +208,7 @@ exitcode_t HandleCommandHost(CommandLineArgEnumerator * enumerator)
|
|||
const char * parkUri;
|
||||
if (!enumerator->TryPopString(&parkUri))
|
||||
{
|
||||
Console::Error::WriteLine("Expected path or URL to a saved park.");
|
||||
Console::Error::WriteLine("Expected path or URL to a scenario or saved park.");
|
||||
return EXITCODE_FAIL;
|
||||
}
|
||||
|
||||
|
|
|
@ -277,8 +277,9 @@ void openrct2_launch()
|
|||
break;
|
||||
case STARTUP_ACTION_OPEN:
|
||||
assert(gOpenRCT2StartupActionPath != NULL);
|
||||
if (rct2_open_file(gOpenRCT2StartupActionPath) == 0)
|
||||
if (!rct2_open_file(gOpenRCT2StartupActionPath)) {
|
||||
break;
|
||||
}
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_PLAYING;
|
||||
|
||||
|
|
16
src/rct2.c
16
src/rct2.c
|
@ -345,30 +345,32 @@ static void rct2_draw_fps()
|
|||
gfx_set_dirty_blocks(x - 16, y - 4, gLastDrawStringX + 16, 16);
|
||||
}
|
||||
|
||||
int rct2_open_file(const char *path)
|
||||
bool rct2_open_file(const char *path)
|
||||
{
|
||||
char *extension = strrchr(path, '.');
|
||||
if (extension == NULL)
|
||||
return 0;
|
||||
if (extension == NULL) {
|
||||
return false;
|
||||
}
|
||||
extension++;
|
||||
|
||||
if (_stricmp(extension, "sv6") == 0) {
|
||||
strcpy((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2, path);
|
||||
game_load_save(path);
|
||||
return 1;
|
||||
return true;
|
||||
} else if (_stricmp(extension, "sc6") == 0) {
|
||||
// TODO scenario install
|
||||
rct_scenario_basic scenarioBasic;
|
||||
strcpy(scenarioBasic.path, path);
|
||||
scenario_load_and_play_from_path(scenarioBasic.path);
|
||||
return true;
|
||||
} else if (_stricmp(extension, "td6") == 0 || _stricmp(extension, "td4") == 0) {
|
||||
return 1;
|
||||
return true;
|
||||
} else if (!_stricmp(extension, "td6") || !_stricmp(extension, "td4")) {
|
||||
// TODO track design install
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -275,6 +275,6 @@ int check_files_integrity();
|
|||
const char *get_file_path(int pathId);
|
||||
void rct2_quit();
|
||||
|
||||
int rct2_open_file(const char *path);
|
||||
bool rct2_open_file(const char *path);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue