hedgewars/hwengine.pas
changeset 8174 df02c2ad4a2c
parent 8170 b0abfa1a4d4a
child 8209 780e156f19ea
equal deleted inserted replaced
8172:aaa64f03ac62 8174:df02c2ad4a2c
   543 procedure GetParams;
   543 procedure GetParams;
   544 var startIndex: LongInt;
   544 var startIndex: LongInt;
   545     tmpInt: LongInt;
   545     tmpInt: LongInt;
   546 begin
   546 begin
   547     if (ParamCount < 2) then
   547     if (ParamCount < 2) then
       
   548         begin
   548         DisplayUsage();
   549         DisplayUsage();
   549         GameType:= gmtSyntax
   550         GameType:= gmtSyntax
       
   551         end
   550     else
   552     else
   551         if (ParamCount >= 2) then
   553         if (ParamCount >= 2) then
   552             begin
   554             begin
   553             UserPathPrefix:= ParamStr(1);
   555             UserPathPrefix:= ParamStr(1);
   554             PathPrefix:= ParamStr(2)
   556             PathPrefix:= ParamStr(2)
   555             end;
   557             end;
       
   558 
   556         if (ParamCount >= 3) then
   559         if (ParamCount >= 3) then
   557             recordFileName:= ParamStr(3);
   560             recordFileName:= ParamStr(3);
       
   561 
   558         if (ParamCount = 2) or
   562         if (ParamCount = 2) or
   559            ((ParamCount >= 3) and (Copy(recordFileName,1,2) = '--')) then
   563            ((ParamCount >= 3) and (Copy(recordFileName,1,2) = '--')) then
   560             begin
   564             begin
   561             recordFileName := PathPrefix;
   565             recordFileName := PathPrefix;
   562             PathPrefix := UserPathPrefix;
   566             PathPrefix := UserPathPrefix;
   563             startIndex := 3;
   567             startIndex := 3;
   564             WriteLn(stdout,'defaulting UserPathPrefix')
   568             WriteLn(stdout,'defaulting UserPathPrefix')
   565             end
   569             end
   566         else
   570         else
   567             startIndex := 4;
   571             startIndex := 4;
       
   572 
   568         if (ParamCount = startIndex) and 
   573         if (ParamCount = startIndex) and 
   569            (ParamStr(startIndex) = 'landpreview') then
   574            (ParamStr(startIndex) = 'landpreview') then
   570             begin
   575             begin
   571             ipcPort:= StrToInt(ParamStr(2));
   576             ipcPort:= StrToInt(ParamStr(2));
   572             GameType:= gmtLandPreview;
   577             GameType:= gmtLandPreview;
   573             end
   578             end
       
   579         else if (ParamCount = startIndex) and 
       
   580                 (ParamStr(startIndex) = '--stats-only') then
       
   581             playReplayFileWithParameters(startIndex)
       
   582         else if ParamCount = cDefaultParamNum then
       
   583             internalStartGameWithParameters()
       
   584 {$IFDEF USE_VIDEO_RECORDING}
       
   585         else if ParamCount = cVideorecParamNum then
       
   586             internalStartVideoRecordingWithParameters()
       
   587 {$ENDIF}
   574         else
   588         else
   575             begin
   589             playReplayFileWithParameters(startIndex)
   576             if (ParamCount = startIndex) and 
       
   577                (ParamStr(startIndex) = '--stats-only') then
       
   578                 playReplayFileWithParameters(startIndex)
       
   579             else
       
   580                 if ParamCount = cDefaultParamNum then
       
   581                     internalStartGameWithParameters()
       
   582 {$IFDEF USE_VIDEO_RECORDING}
       
   583                 else if ParamCount = cVideorecParamNum then
       
   584                     internalStartVideoRecordingWithParameters()
       
   585 {$ENDIF}
       
   586                 else
       
   587                     playReplayFileWithParameters(startIndex);
       
   588             end
       
   589 end;
   590 end;
   590 
   591 
   591 ///////////////////////////////////////////////////////////////////////////////
   592 ///////////////////////////////////////////////////////////////////////////////
   592 /////////////////////////////////// m a i n ///////////////////////////////////
   593 /////////////////////////////////// m a i n ///////////////////////////////////
   593 ///////////////////////////////////////////////////////////////////////////////
   594 ///////////////////////////////////////////////////////////////////////////////