# HG changeset patch # User Joe Doyle (Ginto8) # Date 1354574311 18000 # Node ID 5f08609613feeb6de6693638f2bfd380f8b0fb22 # Parent 1633a651083475269dcaee65648467ae38ef3452 Made user data path default to '.'. diff -r 1633a6510834 -r 5f08609613fe hedgewars/ArgParsers.inc --- a/hedgewars/ArgParsers.inc Mon Dec 03 23:54:12 2012 +0400 +++ b/hedgewars/ArgParsers.inc Mon Dec 03 17:38:31 2012 -0500 @@ -68,7 +68,7 @@ begin WriteLn(stdout, 'Usage:'); WriteLn(stdout, ''); - WriteLn(stdout, ' hwengine [options]'); + WriteLn(stdout, ' hwengine [path to user hedgewars folder] [options]'); WriteLn(stdout, ''); WriteLn(stdout, 'where [options] are any of the following:'); WriteLn(stdout, ' --locale [path to language file]'); @@ -206,14 +206,10 @@ end; end; -procedure playReplayFileWithParameters(); -var paramIndex, tmpInt: LongInt; +procedure playReplayFileWithParameters(paramIndex: LongInt); +var tmpInt: LongInt; wrongParameter: boolean; begin - UserPathPrefix:= ParamStr(1); - PathPrefix:= ParamStr(2); - recordFileName:= ParamStr(3); - paramIndex:= 4; wrongParameter:= false; while (paramIndex <= ParamCount) do begin diff -r 1633a6510834 -r 5f08609613fe hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Mon Dec 03 23:54:12 2012 +0400 +++ b/hedgewars/hwengine.pas Mon Dec 03 17:38:31 2012 -0500 @@ -541,23 +541,44 @@ {$INCLUDE "ArgParsers.inc"} procedure GetParams; -var tmpInt: LongInt; +var startIndex,tmpInt: LongInt; + debug: string; begin - if (ParamCount < 3) then + if (ParamCount < 2) then begin DisplayUsage(); GameType:= gmtSyntax; end else - if (ParamCount = 3) and (ParamStr(3) = 'landpreview') then + begin + if (ParamCount >= 2) then + begin + UserPathPrefix := ParamStr(1); + PathPrefix := ParamStr(2) + end; + if (ParamCount >= 3) then + recordFilename := ParamStr(3); + if (ParamCount = 2) or + ((ParamCount >= 3) and (Copy(recordFileName,1,2) = '--')) then + begin + recordFileName := PathPrefix; + PathPrefix := UserPathPrefix; + UserPathPrefix := '.'; + startIndex := 3; + end + else + startIndex := 4; + if (ParamCount = startIndex) and + (ParamStr(startIndex) = 'landpreview') then begin ipcPort:= StrToInt(ParamStr(2)); GameType:= gmtLandPreview; end else begin - if (ParamCount = 3) and (ParamStr(3) = '--stats-only') then - playReplayFileWithParameters() + if (ParamCount = startIndex) and + (ParamStr(startIndex) = '--stats-only') then + playReplayFileWithParameters(startIndex) else if ParamCount = cDefaultParamNum then internalStartGameWithParameters() @@ -566,8 +587,12 @@ internalStartVideoRecordingWithParameters() {$ENDIF} else - playReplayFileWithParameters(); + playReplayFileWithParameters(startIndex); end + end; + WriteLn(stdout,recordFilename); + WriteLn(stdout,PathPrefix); + WriteLn(stdout,UserPathPrefix); end; ///////////////////////////////////////////////////////////////////////////////