541 {$INCLUDE "ArgParsers.inc"} |
541 {$INCLUDE "ArgParsers.inc"} |
542 |
542 |
543 procedure GetParams; |
543 procedure GetParams; |
544 var tmpInt: LongInt; |
544 var tmpInt: LongInt; |
545 begin |
545 begin |
546 if (ParamCount < 3) then |
546 if (ParamCount < 2) then |
547 begin |
547 GameType:= gmtSyntax |
548 DisplayUsage(); |
|
549 GameType:= gmtSyntax; |
|
550 end |
|
551 else |
548 else |
552 if (ParamCount = 3) and (ParamStr(3) = 'landpreview') then |
549 if (ParamCount >= 2) then |
|
550 begin |
|
551 UserPathPrefix:= ParamStr(1); |
|
552 PathPrefix:= ParamStr(2) |
|
553 end; |
|
554 if (ParamCount >= 3) then |
|
555 recordFileName:= ParamStr(3); |
|
556 if (ParamCount = 2) or |
|
557 ((ParamCount >= 3) and (Copy(recordFileName,1,2) = '--')) then |
|
558 begin |
|
559 recordFileName := PathPrefix; |
|
560 PathPrefix := UserPathPrefix; |
|
561 startIndex := 3; |
|
562 WriteLn(stdout,'defaulting UserPathPrefix') |
|
563 end |
|
564 else |
|
565 startIndex := 4; |
|
566 if (ParamCount = startIndex) and |
|
567 (ParamStr(startIndex) = 'landpreview') then |
553 begin |
568 begin |
554 ipcPort:= StrToInt(ParamStr(2)); |
569 ipcPort:= StrToInt(ParamStr(2)); |
555 GameType:= gmtLandPreview; |
570 GameType:= gmtLandPreview; |
556 end |
571 end |
557 else |
572 else |
558 begin |
573 begin |
559 if (ParamCount = 3) and (ParamStr(3) = '--stats-only') then |
574 if (ParamCount = startIndex) and |
560 playReplayFileWithParameters() |
575 (ParamStr(startIndex) = '--stats-only') then |
|
576 playReplayFileWithParameters(startIndex) |
561 else |
577 else |
562 if ParamCount = cDefaultParamNum then |
578 if ParamCount = cDefaultParamNum then |
563 internalStartGameWithParameters() |
579 internalStartGameWithParameters() |
564 {$IFDEF USE_VIDEO_RECORDING} |
580 {$IFDEF USE_VIDEO_RECORDING} |
565 else if ParamCount = cVideorecParamNum then |
581 else if ParamCount = cVideorecParamNum then |
566 internalStartVideoRecordingWithParameters() |
582 internalStartVideoRecordingWithParameters() |
567 {$ENDIF} |
583 {$ENDIF} |
568 else |
584 else |
569 playReplayFileWithParameters(); |
585 playReplayFileWithParameters(startIndex); |
570 end |
586 end |
571 end; |
587 end; |
572 |
588 |
573 /////////////////////////////////////////////////////////////////////////////// |
589 /////////////////////////////////////////////////////////////////////////////// |
574 /////////////////////////////////// m a i n /////////////////////////////////// |
590 /////////////////////////////////// m a i n /////////////////////////////////// |