hedgewars/hwengine.pas
changeset 8308 cdf83bdf7b27
parent 8307 8d7c52b24e28
child 8310 a98c349bc06b
equal deleted inserted replaced
8307:8d7c52b24e28 8308:cdf83bdf7b27
   541     freeEverything(false);
   541     freeEverything(false);
   542 end;
   542 end;
   543 
   543 
   544 {$IFNDEF HWLIBRARY}
   544 {$IFNDEF HWLIBRARY}
   545 
   545 
   546 ///////////////////////////////////////////////////////////////////////////////
       
   547 {$INCLUDE "ArgParsers.inc"}
   546 {$INCLUDE "ArgParsers.inc"}
   548 
       
   549 procedure GetParams;
       
   550 var startIndex,tmpInt: LongInt;
       
   551     debug: string;
       
   552 begin
       
   553     (*
       
   554     tmpInt:=0;
       
   555     while (tmpInt <= ParamCount) do
       
   556         begin
       
   557         WriteLn(stdout,inttostr(tmpInt) + ': ' + ParamStr(tmpInt));
       
   558         inc(tmpInt);
       
   559         end;
       
   560     *)
       
   561 
       
   562     if (ParamCount = 3) and (ParamStr(3) = 'landpreview') then
       
   563     begin
       
   564         PathPrefix := ParamStr(1);
       
   565         ipcPort    := StrToInt(ParamStr(2));
       
   566         GameType   := gmtLandPreview;
       
   567         exit;
       
   568     end;
       
   569 
       
   570     //TODO: prepend something so that we can use a cDefaultParamNum of parameters
       
   571     if ParamCount = cDefaultParamNum then
       
   572     begin
       
   573         internalStartGameWithParameters();
       
   574         exit;
       
   575     end
       
   576 {$IFDEF USE_VIDEO_RECORDING}
       
   577     else if ParamCount = cVideorecParamNum then
       
   578     begin
       
   579         internalStartVideoRecordingWithParameters();
       
   580         exit;
       
   581     end
       
   582 {$ENDIF};
       
   583 
       
   584     UserPathPrefix := '.';
       
   585     PathPrefix     := cDefaultPathPrefix;
       
   586     recordFileName := '';
       
   587     startIndex     := 1;
       
   588     playReplayFileWithParameters(startIndex);
       
   589 
       
   590     if (recordFileName = '') then
       
   591         begin
       
   592         DisplayUsage();
       
   593         GameType:= gmtSyntax;
       
   594         end;
       
   595     (*
       
   596     WriteLn(stdout,'PathPrefix:     ' + PathPrefix);
       
   597     WriteLn(stdout,'UserPathPrefix: ' + UserPathPrefix);
       
   598     WriteLn(stdout,'recordFilename: ' + recordFilename);
       
   599     *)
       
   600 end;
       
   601 
   547 
   602 ///////////////////////////////////////////////////////////////////////////////
   548 ///////////////////////////////////////////////////////////////////////////////
   603 /////////////////////////////////// m a i n ///////////////////////////////////
   549 /////////////////////////////////// m a i n ///////////////////////////////////
   604 ///////////////////////////////////////////////////////////////////////////////
   550 ///////////////////////////////////////////////////////////////////////////////
   605 begin
   551 begin
   606     preInitEverything();
   552     preInitEverything();
   607     GetParams();
   553     GetParams();
   608 
   554 
   609     if GameType = gmtLandPreview then
   555     if GameType = gmtLandPreview then
   610         GenLandPreview()
   556         GenLandPreview()
   611     else if GameType = gmtSyntax then
   557     else if GameType <> gmtSyntax then
   612         //Exit cleanly
   558         Game();
   613     else Game();
       
   614 
   559 
   615     // return 1 when engine is not called correctly
   560     // return 1 when engine is not called correctly
   616     halt(LongInt(GameType = gmtSyntax));
   561     halt(LongInt(GameType = gmtSyntax));
   617 {$ENDIF}
   562 {$ENDIF}
   618 end.
   563 end.