Skip to content

Commit

Permalink
Refactor: Renamed Arg* functions according to conventions
Browse files Browse the repository at this point in the history
As C wrappers of de::CommandLine, the functions are now prefixed
"CommandLine_".
  • Loading branch information
skyjake committed May 23, 2012
1 parent b762913 commit a5875c3
Show file tree
Hide file tree
Showing 46 changed files with 280 additions and 283 deletions.
26 changes: 13 additions & 13 deletions doomsday/engine/portable/src/audiodriver.c
Expand Up @@ -256,27 +256,27 @@ static boolean initDriver(audiodriver_e id)
static audiodriver_e chooseAudioDriver(void)
{
// No audio output?
if(isDedicated || ArgExists("-dummy"))
if(isDedicated || CommandLine_Exists("-dummy"))
return AUDIOD_DUMMY;

if(ArgExists("-fmod"))
if(CommandLine_Exists("-fmod"))
return AUDIOD_FMOD;

if(ArgExists("-oal"))
if(CommandLine_Exists("-oal"))
return AUDIOD_OPENAL;

#ifdef WIN32
// DirectSound with 3D sound support, EAX effects?
if(ArgExists("-dsound"))
if(CommandLine_Exists("-dsound"))
return AUDIOD_DSOUND;

// Windows Multimedia?
if(ArgExists("-winmm"))
if(CommandLine_Exists("-winmm"))
return AUDIOD_WINMM;
#endif

#ifndef DENG_DISABLE_SDLMIXER
if(ArgExists("-sdlmixer"))
if(CommandLine_Exists("-sdlmixer"))
return AUDIOD_SDL_MIXER;
#endif

Expand Down Expand Up @@ -310,9 +310,9 @@ static void selectInterfaces(audiodriver_e defaultDriverId)
if(defaultDriver->cd.gen.Init) iCD = &defaultDriver->cd;

// Check for SFX override.
if((p = ArgCheckWith("-isfx", 1)) > 0)
if((p = CommandLine_CheckWith("-isfx", 1)) > 0)
{
drvId = initDriverIfNeeded(Argv(p + 1));
drvId = initDriverIfNeeded(CommandLine_At(p + 1));
if(!drivers[drvId].sfx.gen.Init)
{
Con_Error("Audio driver '%s' does not provide an SFX interface.\n",
Expand All @@ -322,9 +322,9 @@ static void selectInterfaces(audiodriver_e defaultDriverId)
}

// Check for Music override.
if((p = ArgCheckWith("-imusic", 1)) > 0)
if((p = CommandLine_CheckWith("-imusic", 1)) > 0)
{
drvId = initDriverIfNeeded(Argv(p + 1));
drvId = initDriverIfNeeded(CommandLine_At(p + 1));
if(!drivers[drvId].music.gen.Init)
{
Con_Error("Audio driver '%s' does not provide a Music interface.\n",
Expand All @@ -334,9 +334,9 @@ static void selectInterfaces(audiodriver_e defaultDriverId)
}

// Check for Music override.
if((p = ArgCheckWith("-icd", 1)) > 0)
if((p = CommandLine_CheckWith("-icd", 1)) > 0)
{
drvId = initDriverIfNeeded(Argv(p + 1));
drvId = initDriverIfNeeded(CommandLine_At(p + 1));
if(!drivers[drvId].cd.gen.Init)
{
Con_Error("Audio driver '%s' does not provide a CD interface.\n",
Expand Down Expand Up @@ -369,7 +369,7 @@ boolean AudioDriver_Init(void)
audiodriver_e defaultDriverId;
boolean ok = false;

if(ArgExists("-nosound")) return false;
if(CommandLine_Exists("-nosound")) return false;

defaultDriverId = chooseAudioDriver();
ok = initDriver(defaultDriverId);
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/portable/src/canvaswindow.cpp
Expand Up @@ -186,7 +186,7 @@ void CanvasWindow::setDefaultGLFormat() // static
fmt.setStencilBufferSize(8);
fmt.setDoubleBuffer(true);

if(ArgExists("-novsync") || !Con_GetByte("vid-vsync"))
if(CommandLine_Exists("-novsync") || !Con_GetByte("vid-vsync"))
{
fmt.setSwapInterval(0); // vsync off
}
Expand All @@ -195,7 +195,7 @@ void CanvasWindow::setDefaultGLFormat() // static
fmt.setSwapInterval(1);
}

if(ArgExists("-nofsaa") || !Con_GetByte("vid-fsaa"))
if(CommandLine_Exists("-nofsaa") || !Con_GetByte("vid-fsaa"))
{
fmt.setSampleBuffers(false);
}
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/portable/src/cl_main.c
Expand Up @@ -75,9 +75,9 @@ void Cl_InitID(void)
FILE* file;
size_t result;

if((i = ArgCheckWith("-id", 1)) != 0)
if((i = CommandLine_CheckWith("-id", 1)) != 0)
{
clientID = strtoul(Argv(i + 1), 0, 0);
clientID = strtoul(CommandLine_At(i + 1), 0, 0);
Con_Message("Cl_InitID: Using custom id 0x%08x.\n", clientID);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/dd_input.c
Expand Up @@ -826,7 +826,7 @@ void DD_InitInput(void)
{
int i;

inputDisabledFully = ArgExists("-noinput");
inputDisabledFully = CommandLine_Exists("-noinput");

for(i = 0; i < 256; ++i)
{
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/dd_loop.c
Expand Up @@ -111,7 +111,7 @@ int DD_GameLoopExitCode(void)

int DD_GameLoop(void)
{
noninteractive = ArgExists("-noinput");
noninteractive = CommandLine_Exists("-noinput");

// Start the deng2 event loop.
return LegacyCore_RunEventLoop(de2LegacyCore);
Expand Down
70 changes: 35 additions & 35 deletions doomsday/engine/portable/src/dd_main.c
Expand Up @@ -986,9 +986,9 @@ static int DD_ActivateGameWorker(void* paramaters)
*/
{ const ddstring_t* configFileName = 0;
ddstring_t tmp;
if(ArgCheckWith("-config", 1))
if(CommandLine_CheckWith("-config", 1))
{
Str_Init(&tmp); Str_Set(&tmp, ArgNext());
Str_Init(&tmp); Str_Set(&tmp, CommandLine_Next());
F_FixSlashes(&tmp, &tmp);
configFileName = &tmp;
}
Expand Down Expand Up @@ -1349,9 +1349,9 @@ static Game* findFirstPlayableGame(void)
*/
Game* DD_AutoselectGame(void)
{
if(ArgCheckWith("-game", 1))
if(CommandLine_CheckWith("-game", 1))
{
const char* identityKey = ArgNext();
const char* identityKey = CommandLine_Next();
Game* game = findGameForIdentityKey(identityKey);

if(game && allGameStartupResourcesFound(game))
Expand All @@ -1377,7 +1377,7 @@ int DD_EarlyInit(void)
Sys_MarkAsMainThread();

// Determine the requested degree of verbosity.
verbose = ArgExists("-verbose");
verbose = CommandLine_Exists("-verbose");

// The memory zone must be online before the console module.
Z_Init();
Expand Down Expand Up @@ -1557,14 +1557,14 @@ boolean DD_Init(void)
{ resourcenamespaceid_t rnId = F_DefaultResourceNamespaceForClass(RC_PACKAGE);
int p;

for(p = 0; p < Argc(); ++p)
for(p = 0; p < CommandLine_Count(); ++p)
{
if(!ArgRecognize("-iwad", Argv(p)))
if(!CommandLine_IsMatchingAlias("-iwad", CommandLine_At(p)))
continue;

while(++p != Argc() && !ArgIsOption(p))
while(++p != CommandLine_Count() && !CommandLine_IsOption(p))
{
const char* filePath = Argv(p);
const char* filePath = CommandLine_At(p);
directory_t* dir;
Uri* searchPath;

Expand Down Expand Up @@ -1598,7 +1598,7 @@ boolean DD_Init(void)
*/

// Attempt automatic game selection.
if(!ArgExists("-noautoselect"))
if(!CommandLine_Exists("-noautoselect"))
{
Game* game = DD_AutoselectGame();

Expand All @@ -1609,13 +1609,13 @@ boolean DD_Init(void)

// Add all resources specified using -file options on the command line
// to the list for this session.
for(p = 0; p < Argc(); ++p)
for(p = 0; p < CommandLine_Count(); ++p)
{
if(!ArgRecognize("-file", Argv(p))) continue;
if(!CommandLine_IsMatchingAlias("-file", CommandLine_At(p))) continue;

while(++p != Argc() && !ArgIsOption(p))
while(++p != CommandLine_Count() && !CommandLine_IsOption(p))
{
addToPathList(&gameResourceFileList, &numGameResourceFileList, Argv(p));
addToPathList(&gameResourceFileList, &numGameResourceFileList, CommandLine_At(p));
}

p--;/* For ArgIsOption(p) necessary, for p==Argc() harmless */
Expand All @@ -1635,17 +1635,17 @@ boolean DD_Init(void)
F_ResetAllResourceNamespaces();

// One-time execution of various command line features available during startup.
if(ArgCheckWith("-dumplump", 1))
if(CommandLine_CheckWith("-dumplump", 1))
{
const char* name = ArgNext();
const char* name = CommandLine_Next();
lumpnum_t absoluteLumpNum = F_CheckLumpNumForName(name);
if(absoluteLumpNum >= 0)
{
F_DumpLump(absoluteLumpNum, NULL);
}
}

if(ArgCheck("-dumpwaddir"))
if(CommandLine_Check("-dumpwaddir"))
{
F_PrintLumpDirectory();
}
Expand All @@ -1656,14 +1656,14 @@ boolean DD_Init(void)
Con_ParseCommands("autoexec.cfg");

// Read additional config files that should be processed post engine init.
if(ArgCheckWith("-parse", 1))
if(CommandLine_CheckWith("-parse", 1))
{
uint startTime;
Con_Message("Parsing additional (pre-init) config files:\n");
startTime = Sys_GetRealTime();
for(;;)
{
const char* arg = ArgNext();
const char* arg = CommandLine_Next();
if(!arg || arg[0] == '-') break;

Con_Message(" Processing \"%s\"...\n", F_PrettyPath(arg));
Expand All @@ -1674,14 +1674,14 @@ boolean DD_Init(void)

// A console command on the command line?
{ int p;
for(p = 1; p < Argc() - 1; p++)
for(p = 1; p < CommandLine_Count() - 1; p++)
{
if(stricmp(Argv(p), "-command") && stricmp(Argv(p), "-cmd"))
if(stricmp(CommandLine_At(p), "-command") && stricmp(CommandLine_At(p), "-cmd"))
continue;

for(++p; p < Argc(); p++)
for(++p; p < CommandLine_Count(); p++)
{
const char* arg = Argv(p);
const char* arg = CommandLine_At(p);

if(arg[0] == '-')
{
Expand All @@ -1699,16 +1699,16 @@ boolean DD_Init(void)
if(DD_GameLoaded())
{
// Client connection command.
if(ArgCheckWith("-connect", 1))
Con_Executef(CMDS_CMDLINE, false, "connect %s", ArgNext());
if(CommandLine_CheckWith("-connect", 1))
Con_Executef(CMDS_CMDLINE, false, "connect %s", CommandLine_Next());

// Incoming TCP port.
if(ArgCheckWith("-port", 1))
Con_Executef(CMDS_CMDLINE, false, "net-ip-port %s", ArgNext());
if(CommandLine_CheckWith("-port", 1))
Con_Executef(CMDS_CMDLINE, false, "net-ip-port %s", CommandLine_Next());

// Server start command.
// (shortcut for -command "net init tcpip; net server start").
if(ArgExists("-server"))
if(CommandLine_Exists("-server"))
{
if(!N_InitService(true))
Con_Message("Can't start server: network init failed.\n");
Expand Down Expand Up @@ -1742,7 +1742,7 @@ boolean DD_Init(void)

// We'll open the console and print a list of the known games too.
Con_Execute(CMDS_DDAY, "conopen", true, false);
if(!ArgExists("-noautoselect"))
if(!CommandLine_Exists("-noautoselect"))
Con_Message("Automatic game selection failed.\n");
Con_Execute(CMDS_DDAY, "listgames", false, false);
}
Expand Down Expand Up @@ -1778,7 +1778,7 @@ static int DD_StartupWorker(void* parm)
Con_SetProgress(20);

// Was the change to userdir OK?
if(ArgCheckWith("-userdir", 1) && !app.usingUserDir)
if(CommandLine_CheckWith("-userdir", 1) && !app.usingUserDir)
Con_Message("--(!)-- User directory not found (check -userdir).\n");

bamsInit(); // Binary angle calculations.
Expand All @@ -1792,14 +1792,14 @@ static int DD_StartupWorker(void* parm)
Sys_HideMouse();

// Read config files that should be read BEFORE engine init.
if(ArgCheckWith("-cparse", 1))
if(CommandLine_CheckWith("-cparse", 1))
{
uint startTime;
Con_Message("Parsing additional (pre-init) config files:\n");
startTime = Sys_GetRealTime();
for(;;)
{
const char* arg = ArgNext();
const char* arg = CommandLine_Next();
if(!arg || arg[0] == '-')
break;
Con_Message(" Processing \"%s\"...\n", F_PrettyPath(arg));
Expand Down Expand Up @@ -1896,12 +1896,12 @@ void DD_CheckTimeDemo(void)
if(!checked)
{
checked = true;
if(ArgCheckWith("-timedemo", 1) || // Timedemo mode.
ArgCheckWith("-playdemo", 1)) // Play-once mode.
if(CommandLine_CheckWith("-timedemo", 1) || // Timedemo mode.
CommandLine_CheckWith("-playdemo", 1)) // Play-once mode.
{
char buf[200];

sprintf(buf, "playdemo %s", ArgNext());
sprintf(buf, "playdemo %s", CommandLine_Next());
Con_Execute(CMDS_CMDLINE, buf, false, false);
}
}
Expand Down

0 comments on commit a5875c3

Please sign in to comment.