MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / parseOption

Function parseOption

TheForceEngine/main.cpp:1018–1085  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1016}
1017
1018void parseOption(const char* name, const std::vector<const char*>& values, bool longName)
1019{
1020 if (!longName) // short names use the same style as the originals.
1021 {
1022 if (name[0] == 'g') // Directly load a game, skipping the titlescreen.
1023 {
1024 // -gDARK
1025 const char* gameToLoad = &name[1];
1026 TFE_System::logWrite(LOG_MSG, "CommandLine", "Game to load: %s", gameToLoad);
1027 if (!strcasecmp(gameToLoad, "dark"))
1028 {
1029 s_startupGame = Game_Dark_Forces;
1030 }
1031 }
1032 else if (name[0] == 'r')
1033 {
1034 // -r<replay_path>
1035 TFE_Input::loadReplayFromPath(&name[1]);
1036 }
1037 else if (strcasecmp(name, "nosound") == 0)
1038 {
1039 // -noaudio
1040 s_nullAudioDevice = true;
1041 }
1042 else if (strcasecmp(name, "fullscreen") == 0)
1043 {
1044 TFE_Settings::getTempSettings()->forceFullscreen = true;
1045 }
1046 else if (strcasecmp(name, "skip_load_delay") == 0)
1047 {
1048 TFE_Settings::getTempSettings()->skipLoadDelay = true;
1049 }
1050 }
1051 else // long names use the more traditional style of arguments which allow for multiple values.
1052 {
1053 if (strcasecmp(name, "game") == 0 && values.size() >= 1) // Directly load a game, skipping the titlescreen.
1054 {
1055 // --game DARK
1056 const char* gameToLoad = values[0];
1057 TFE_System::logWrite(LOG_MSG, "CommandLine", "Game to load: %s", gameToLoad);
1058 if (!strcasecmp(gameToLoad, "dark"))
1059 {
1060 s_startupGame = Game_Dark_Forces;
1061 }
1062 }
1063 else if (strcasecmp(name, "nosound") == 0)
1064 {
1065 // --noaudio
1066 s_nullAudioDevice = true;
1067 }
1068 else if (strcasecmp(name, "fullscreen") == 0)
1069 {
1070 TFE_Settings::getTempSettings()->forceFullscreen = true;
1071 }
1072 else if (strcasecmp(name, "skip_load_delay") == 0)
1073 {
1074 TFE_Settings::getTempSettings()->skipLoadDelay = true;
1075 }

Callers 1

parseCommandLineFunction · 0.85

Calls 4

logWriteFunction · 0.85
loadReplayFromPathFunction · 0.85
getTempSettingsFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected