hedgewars/hwengine.pas
branchflibqtfrontend
changeset 8214 8edc37cdcfbf
parent 8212 49eb757a1a4d
child 8222 d3dc08500fc0
equal deleted inserted replaced
8212:49eb757a1a4d 8214:8edc37cdcfbf
   542 
   542 
   543 procedure GetParams;
   543 procedure GetParams;
   544 var startIndex,tmpInt: LongInt;
   544 var startIndex,tmpInt: LongInt;
   545     debug: string;
   545     debug: string;
   546 begin
   546 begin
       
   547     (*
       
   548     tmpInt:=0;
       
   549     while (tmpInt <= ParamCount) do
       
   550         begin
       
   551         WriteLn(stdout,inttostr(tmpInt) + ': ' + ParamStr(tmpInt));
       
   552         inc(tmpInt);
       
   553         end;
       
   554     *)
       
   555 
       
   556     if (ParamCount = 3) and (ParamStr(3) = 'landpreview') then
       
   557     begin
       
   558         PathPrefix := ParamStr(1);
       
   559         ipcPort    := StrToInt(ParamStr(2));
       
   560         GameType   := gmtLandPreview;
       
   561         exit;
       
   562     end;
       
   563 
       
   564     //TODO: prepend something so that we can use a cDefaultParamNum of parameters
       
   565     if ParamCount = cDefaultParamNum then
       
   566     begin
       
   567         internalStartGameWithParameters();
       
   568         exit;
       
   569     end
       
   570 {$IFDEF USE_VIDEO_RECORDING}
       
   571     else if ParamCount = cVideorecParamNum then
       
   572     begin
       
   573         internalStartVideoRecordingWithParameters();
       
   574         exit;
       
   575     end
       
   576 {$ENDIF};
       
   577 
   547     if (ParamCount < 2) then
   578     if (ParamCount < 2) then
   548         begin
   579         begin
   549         DisplayUsage();
   580         DisplayUsage();
   550         GameType:= gmtSyntax;
   581         GameType:= gmtSyntax;
   551         end
   582         end
   552     else
   583     else
   553         begin
   584         begin
   554         if (ParamCount >= 2) then
   585         if (ParamCount >= 2) then
   555             begin
   586             begin
   556             UserPathPrefix := ParamStr(1);
   587             UserPathPrefix := ParamStr(1);
   557             PathPrefix     := ParamStr(2)
   588             PathPrefix     := ParamStr(2);
   558             end;
   589             end;
   559         if (ParamCount >= 3) then
   590         if (ParamCount >= 3) then
   560             recordFilename := ParamStr(3);
   591             recordFilename := ParamStr(3);
   561         if (ParamCount = 2) or
   592         if (ParamCount = 2) or
   562            ((ParamCount >= 3) and (Copy(recordFileName,1,2) = '--')) then
   593            ((ParamCount >= 3) and (Copy(recordFileName,1,2) = '--')) then
   563             begin
   594             begin
   564             recordFileName := PathPrefix;
       
   565             PathPrefix     := UserPathPrefix;
       
   566             UserPathPrefix := '.';
   595             UserPathPrefix := '.';
   567             startIndex := 3;
   596             PathPrefix     := ParamStr(1);
       
   597             recordFileName := ParamStr(2);
       
   598             startIndex     := 3;
   568             end
   599             end
   569         else
   600         else
   570             startIndex := 4;
   601             startIndex := 4;
   571         if (ParamCount = startIndex) and 
   602 
   572            (ParamStr(startIndex) = 'landpreview') then
   603         playReplayFileWithParameters(startIndex);
   573             begin
       
   574             ipcPort:= StrToInt(ParamStr(2));
       
   575             GameType:= gmtLandPreview;
       
   576             end
       
   577         else
       
   578             begin
       
   579             if (ParamCount = startIndex) and 
       
   580                (ParamStr(startIndex) = '--stats-only') then
       
   581                 playReplayFileWithParameters(startIndex)
       
   582             else
       
   583                 if ParamCount = cDefaultParamNum then
       
   584                     internalStartGameWithParameters()
       
   585 {$IFDEF USE_VIDEO_RECORDING}
       
   586                 else if ParamCount = cVideorecParamNum then
       
   587                     internalStartVideoRecordingWithParameters()
       
   588 {$ENDIF}
       
   589                 else
       
   590                     playReplayFileWithParameters(startIndex);
       
   591             end
       
   592         end;
   604         end;
       
   605     (*
   593     WriteLn(stdout,recordFilename);
   606     WriteLn(stdout,recordFilename);
   594     WriteLn(stdout,PathPrefix);
   607     WriteLn(stdout,PathPrefix);
   595     WriteLn(stdout,UserPathPrefix);
   608     WriteLn(stdout,UserPathPrefix);
       
   609     *)
   596 end;
   610 end;
   597 
   611 
   598 ///////////////////////////////////////////////////////////////////////////////
   612 ///////////////////////////////////////////////////////////////////////////////
   599 /////////////////////////////////// m a i n ///////////////////////////////////
   613 /////////////////////////////////// m a i n ///////////////////////////////////
   600 ///////////////////////////////////////////////////////////////////////////////
   614 ///////////////////////////////////////////////////////////////////////////////