# HG changeset patch # User Joe Doyle (Ginto8) # Date 1354334650 18000 # Node ID 96635d8151411782301d6ca4afef4d07ba8a21cb # Parent 9527839ad58b673fca4da3ea10ed480ba6d0822b Make user folder default to global folder in hwengine diff -r 9527839ad58b -r 96635d815141 hedgewars/ArgParsers.inc --- a/hedgewars/ArgParsers.inc Fri Nov 30 22:23:26 2012 -0500 +++ b/hedgewars/ArgParsers.inc Fri Nov 30 23:04:10 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]'); @@ -195,13 +195,9 @@ end; end; -procedure playReplayFileWithParameters(); -var paramIndex, tmpInt: LongInt; - wrongParameter: boolean; +procedure playReplayFileWithParameters(paramIndex: LongInt); +var wrongParameter: boolean; begin - UserPathPrefix:= ParamStr(1); - PathPrefix:= ParamStr(2); - recordFileName:= ParamStr(3); paramIndex:= 4; wrongParameter:= false; while (paramIndex <= ParamCount) do diff -r 9527839ad58b -r 96635d815141 hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Fri Nov 30 22:23:26 2012 -0500 +++ b/hedgewars/hwengine.pas Fri Nov 30 23:04:10 2012 -0500 @@ -543,21 +543,37 @@ procedure GetParams; var tmpInt: LongInt; begin - if (ParamCount < 3) then - begin - DisplayUsage(); - GameType:= gmtSyntax; - end + if (ParamCount < 2) then + GameType:= gmtSyntax else - if (ParamCount = 3) and (ParamStr(3) = 'landpreview') then + 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; + startIndex := 3; + WriteLn(stdout,'defaulting UserPathPrefix') + 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,7 +582,7 @@ internalStartVideoRecordingWithParameters() {$ENDIF} else - playReplayFileWithParameters(); + playReplayFileWithParameters(startIndex); end end;