From 452ef71274cc4e8ce761136e1b21fec858a6a4fc Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Fri, 20 Aug 2021 20:38:24 -0400 Subject: [PATCH] * BugFix: Correct $i and %i interchangeably being used in parseArgs.tscript. --- .../core/utility/scripts/parseArgs.tscript | 194 +++++++++--------- 1 file changed, 97 insertions(+), 97 deletions(-) diff --git a/Templates/BaseGame/game/core/utility/scripts/parseArgs.tscript b/Templates/BaseGame/game/core/utility/scripts/parseArgs.tscript index d5a098c90..fcff3efb9 100644 --- a/Templates/BaseGame/game/core/utility/scripts/parseArgs.tscript +++ b/Templates/BaseGame/game/core/utility/scripts/parseArgs.tscript @@ -43,11 +43,11 @@ function popFront(%list, %delim) function parseArgs() { - for ($i = 1; $i < $Game::argc ; $i++) + for (%i = 1; %i < $Game::argc ; %i++) { - $arg = $Game::argv[$i]; - $nextArg = $Game::argv[$i+1]; - $hasNextArg = $Game::argc - $i > 1; + $arg = $Game::argv[%i]; + $nextArg = $Game::argv[%i+1]; + $hasNextArg = $Game::argc - %i > 1; $logModeSpecified = false; // Check for dedicated run @@ -55,7 +55,7 @@ function parseArgs() { $userDirs = $defaultGame; $dirCount = 1; - $isDedicated = true; + %isDedicated = true; }*/ switch$ ($arg) @@ -64,39 +64,39 @@ function parseArgs() case "-dedicated": $userDirs = $defaultGame; $dirCount = 1; - $isDedicated = true; + %isDedicated = true; $Server::Dedicated = true; enableWinConsole(true); - $argUsed[$i]++; - + $argUsed[%i]++; + //-------------------- case "-mission": - $argUsed[$i]++; - if ($hasNextArg) + $argUsed[%i]++; + if ($hasNextArg) { $missionArg = $nextArg; - $argUsed[$i+1]++; - $i++; + $argUsed[%i+1]++; + %i++; } else error("Error: Missing Command Line argument. Usage: -mission "); //-------------------- case "-connect": - $argUsed[$i]++; - if ($hasNextArg) + $argUsed[%i]++; + if ($hasNextArg) { $JoinGameAddress = $nextArg; - $argUsed[$i+1]++; - $i++; + $argUsed[%i+1]++; + %i++; } else error("Error: Missing Command Line argument. Usage: -connect "); - + //-------------------- case "-log": - $argUsed[$i]++; + $argUsed[%i]++; if ($hasNextArg) { // Turn on console logging @@ -107,22 +107,22 @@ function parseArgs() } setLogMode($nextArg); $logModeSpecified = true; - $argUsed[$i+1]++; - $i++; + $argUsed[%i+1]++; + %i++; } else error("Error: Missing Command Line argument. Usage: -log "); //-------------------- case "-dir": - $argUsed[$i]++; + $argUsed[%i]++; if ($hasNextArg) { // Append the mod to the end of the current list $userDirs = strreplace($userDirs, $nextArg, ""); $userDirs = pushFront($userDirs, $nextArg, ";"); - $argUsed[$i+1]++; - $i++; + $argUsed[%i+1]++; + %i++; $dirCount++; } else @@ -130,15 +130,15 @@ function parseArgs() //-------------------- // changed the default behavior of this command line arg. It now - // defaults to ONLY loading the game, not tools + // defaults to ONLY loading the game, not tools // default auto-run already loads in tools --SRZ 11/29/07 case "-game": - $argUsed[$i]++; + $argUsed[%i]++; if ($hasNextArg) { // Set the selected dir --NOTE: we no longer allow tools with this argument - /* - if( $isDedicated ) + /* + if( %isDedicated ) { $userDirs = $nextArg; $dirCount = 1; @@ -151,8 +151,8 @@ function parseArgs() */ $userDirs = $nextArg; $dirCount = 1; - $argUsed[$i+1]++; - $i++; + $argUsed[%i+1]++; + %i++; error($userDirs); } else @@ -161,121 +161,121 @@ function parseArgs() //-------------------- case "-console": enableWinConsole(true); - $argUsed[$i]++; + $argUsed[%i]++; //-------------------- case "-jSave": - $argUsed[$i]++; + $argUsed[%i]++; if ($hasNextArg) { echo("Saving event log to journal: " @ $nextArg); saveJournal($nextArg); - $argUsed[$i+1]++; - $i++; + $argUsed[%i+1]++; + %i++; } else error("Error: Missing Command Line argument. Usage: -jSave "); //-------------------- case "-jPlay": - $argUsed[$i]++; + $argUsed[%i]++; if ($hasNextArg) { playJournal($nextArg); - $argUsed[$i+1]++; - $i++; + $argUsed[%i+1]++; + %i++; } else error("Error: Missing Command Line argument. Usage: -jPlay "); - + //-------------------- case "-jPlayToVideo": - $argUsed[$i]++; + $argUsed[%i]++; if ($hasNextArg) { $VideoCapture::journalName = $nextArg; $VideoCapture::captureFromJournal = true; - $argUsed[$i+1]++; - $i++; + $argUsed[%i+1]++; + %i++; } else error("Error: Missing Command Line argument. Usage: -jPlayToVideo "); - + //-------------------- case "-vidCapFile": - $argUsed[$i]++; + $argUsed[%i]++; if ($hasNextArg) { $VideoCapture::fileName = $nextArg; - $argUsed[$i+1]++; - $i++; + $argUsed[%i+1]++; + %i++; } else error("Error: Missing Command Line argument. Usage: -vidCapFile "); - + //-------------------- case "-vidCapFPS": - $argUsed[$i]++; + $argUsed[%i]++; if ($hasNextArg) { $VideoCapture::fps = $nextArg; - $argUsed[$i+1]++; - $i++; + $argUsed[%i+1]++; + %i++; } else error("Error: Missing Command Line argument. Usage: -vidCapFPS "); - + //-------------------- case "-vidCapEncoder": - $argUsed[$i]++; + $argUsed[%i]++; if ($hasNextArg) { $VideoCapture::encoder = $nextArg; - $argUsed[$i+1]++; - $i++; + $argUsed[%i+1]++; + %i++; } else error("Error: Missing Command Line argument. Usage: -vidCapEncoder "); - + //-------------------- case "-vidCapWidth": - $argUsed[$i]++; + $argUsed[%i]++; if ($hasNextArg) { $videoCapture::width = $nextArg; - $argUsed[$i+1]++; - $i++; + $argUsed[%i+1]++; + %i++; } else error("Error: Missing Command Line argument. Usage: -vidCapWidth "); - + //-------------------- case "-vidCapHeight": - $argUsed[$i]++; + $argUsed[%i]++; if ($hasNextArg) { $videoCapture::height = $nextArg; - $argUsed[$i+1]++; - $i++; + $argUsed[%i+1]++; + %i++; } else error("Error: Missing Command Line argument. Usage: -vidCapHeight "); //-------------------- case "-level": - $argUsed[$i]++; + $argUsed[%i]++; if ($hasNextArg) { %hasExt = strpos($nextArg, ".mis"); if(%hasExt == -1) { $levelToLoad = $nextArg @ " "; - - for(%j = $i + 2; %j < $Game::argc; %j++) + + for(%j = %i + 2; %j < $Game::argc; %j++) { $arg = $Game::argv[%j]; %hasExt = strpos($arg, ".mis"); - + if(%hasExt == -1) { $levelToLoad = $levelToLoad @ $arg @ " "; @@ -285,14 +285,14 @@ function parseArgs() break; } } - } + } else { $levelToLoad = $nextArg; } - - $argUsed[$i+1]++; - $i++; + + $argUsed[%i+1]++; + %i++; } else error("Error: Missing Command Line argument. Usage: -level "); @@ -300,93 +300,93 @@ function parseArgs() //------------------- case "-worldeditor": $startWorldEditor = true; - $argUsed[$i]++; + $argUsed[%i]++; //------------------- case "-guieditor": $startGUIEditor = true; - $argUsed[$i]++; + $argUsed[%i]++; //------------------- case "-help": $displayHelp = true; - $argUsed[$i]++; + $argUsed[%i]++; //------------------- case "-compileAll": $compileAll = true; - $argUsed[$i]++; - + $argUsed[%i]++; + //------------------- case "-compileTools": $compileTools = true; - $argUsed[$i]++; + $argUsed[%i]++; //------------------- case "-genScript": $genScript = true; - $argUsed[$i]++; - + $argUsed[%i]++; + case "-fullscreen": $cliFullscreen = true; - $argUsed[$i]++; + $argUsed[%i]++; case "-windowed": $cliFullscreen = false; - $argUsed[$i]++; + $argUsed[%i]++; case "-openGL": $pref::Video::displayDevice = "OpenGL"; - $argUsed[$i]++; + $argUsed[%i]++; case "-directX": $pref::Video::displayDevice = "D3D"; - $argUsed[$i]++; + $argUsed[%i]++; case "-autoVideo": $pref::Video::displayDevice = ""; - $argUsed[$i]++; + $argUsed[%i]++; case "-prefs": - $argUsed[$i]++; + $argUsed[%i]++; if ($hasNextArg) { exec($nextArg, true, true); - $argUsed[$i+1]++; - $i++; + $argUsed[%i+1]++; + %i++; } else error("Error: Missing Command Line argument. Usage: -prefs "); - + //------------------- default: - $argUsed[$i]++; + $argUsed[%i]++; if($userDirs $= "") $userDirs = $arg; } } - + //----------------------------------------------- // Play journal to video file? if ($VideoCapture::captureFromJournal && $VideoCapture::journalName !$= "") - { + { if ($VideoCapture::fileName $= "") - $VideoCapture::fileName = $VideoCapture::journalName; - + $VideoCapture::fileName = $VideoCapture::journalName; + if ($VideoCapture::encoder $= "") $VideoCapture::encoder = "THEORA"; - + if ($VideoCapture::fps $= "") $VideoCapture::fps = 30; - + if ($videoCapture::width $= "") $videoCapture::width = 0; - + if ($videoCapture::height $= "") $videoCapture::height = 0; - - playJournalToVideo( $VideoCapture::journalName, $VideoCapture::fileName, - $VideoCapture::encoder, $VideoCapture::fps, + + playJournalToVideo( $VideoCapture::journalName, $VideoCapture::fileName, + $VideoCapture::encoder, $VideoCapture::fps, $videoCapture::width SPC $videoCapture::height ); } -} \ No newline at end of file +}