hedgewars/hwengine.pas
changeset 8207 5f08609613fe
parent 8150 6b30a4cd7c7c
child 8209 780e156f19ea
child 8214 8edc37cdcfbf
equal deleted inserted replaced
8206:1633a6510834 8207:5f08609613fe
   539 
   539 
   540 ///////////////////////////////////////////////////////////////////////////////
   540 ///////////////////////////////////////////////////////////////////////////////
   541 {$INCLUDE "ArgParsers.inc"}
   541 {$INCLUDE "ArgParsers.inc"}
   542 
   542 
   543 procedure GetParams;
   543 procedure GetParams;
   544 var tmpInt: LongInt;
   544 var startIndex,tmpInt: LongInt;
   545 begin
   545     debug: string;
   546     if (ParamCount < 3) then
   546 begin
       
   547     if (ParamCount < 2) then
   547         begin
   548         begin
   548         DisplayUsage();
   549         DisplayUsage();
   549         GameType:= gmtSyntax;
   550         GameType:= gmtSyntax;
   550         end
   551         end
   551     else
   552     else
   552         if (ParamCount = 3) and (ParamStr(3) = 'landpreview') then
   553         begin
       
   554         if (ParamCount >= 2) then
       
   555             begin
       
   556             UserPathPrefix := ParamStr(1);
       
   557             PathPrefix     := ParamStr(2)
       
   558             end;
       
   559         if (ParamCount >= 3) then
       
   560             recordFilename := ParamStr(3);
       
   561         if (ParamCount = 2) or
       
   562            ((ParamCount >= 3) and (Copy(recordFileName,1,2) = '--')) then
       
   563             begin
       
   564             recordFileName := PathPrefix;
       
   565             PathPrefix     := UserPathPrefix;
       
   566             UserPathPrefix := '.';
       
   567             startIndex := 3;
       
   568             end
       
   569         else
       
   570             startIndex := 4;
       
   571         if (ParamCount = startIndex) and 
       
   572            (ParamStr(startIndex) = 'landpreview') then
   553             begin
   573             begin
   554             ipcPort:= StrToInt(ParamStr(2));
   574             ipcPort:= StrToInt(ParamStr(2));
   555             GameType:= gmtLandPreview;
   575             GameType:= gmtLandPreview;
   556             end
   576             end
   557         else
   577         else
   558             begin
   578             begin
   559             if (ParamCount = 3) and (ParamStr(3) = '--stats-only') then
   579             if (ParamCount = startIndex) and 
   560                 playReplayFileWithParameters()
   580                (ParamStr(startIndex) = '--stats-only') then
       
   581                 playReplayFileWithParameters(startIndex)
   561             else
   582             else
   562                 if ParamCount = cDefaultParamNum then
   583                 if ParamCount = cDefaultParamNum then
   563                     internalStartGameWithParameters()
   584                     internalStartGameWithParameters()
   564 {$IFDEF USE_VIDEO_RECORDING}
   585 {$IFDEF USE_VIDEO_RECORDING}
   565                 else if ParamCount = cVideorecParamNum then
   586                 else if ParamCount = cVideorecParamNum then
   566                     internalStartVideoRecordingWithParameters()
   587                     internalStartVideoRecordingWithParameters()
   567 {$ENDIF}
   588 {$ENDIF}
   568                 else
   589                 else
   569                     playReplayFileWithParameters();
   590                     playReplayFileWithParameters(startIndex);
   570             end
   591             end
       
   592         end;
       
   593     WriteLn(stdout,recordFilename);
       
   594     WriteLn(stdout,PathPrefix);
       
   595     WriteLn(stdout,UserPathPrefix);
   571 end;
   596 end;
   572 
   597 
   573 ///////////////////////////////////////////////////////////////////////////////
   598 ///////////////////////////////////////////////////////////////////////////////
   574 /////////////////////////////////// m a i n ///////////////////////////////////
   599 /////////////////////////////////// m a i n ///////////////////////////////////
   575 ///////////////////////////////////////////////////////////////////////////////
   600 ///////////////////////////////////////////////////////////////////////////////