hedgewars/ArgParsers.inc
changeset 8327 a6f3452f5f94
parent 8325 ecd51650d5d8
child 8329 f14d16c5277a
child 8330 aaefa587e277
equal deleted inserted replaced
8326:023a71940f26 8327:a6f3452f5f94
   265     WriteLn(stdout, 'Attempted to automatically convert to the new syntax:');
   265     WriteLn(stdout, 'Attempted to automatically convert to the new syntax:');
   266     WriteLn(stdout, newSyntax);
   266     WriteLn(stdout, newSyntax);
   267     WriteLn(stdout, '');
   267     WriteLn(stdout, '');
   268 end;
   268 end;
   269 
   269 
   270 procedure playReplayFileWithParameters;
   270 procedure parseCommandLine{$IFDEF HWLIBRARY}(argc: LongInt; argv: PPChar){$ENDIF};
   271 var paramIndex: LongInt;
   271 var paramIndex: LongInt;
       
   272     paramTotal: LongInt;
   272     wrongParameter: boolean;
   273     wrongParameter: boolean;
   273 begin
   274 begin
   274     paramIndex:= 1;
   275     paramIndex:= 1;
       
   276     paramTotal:={$IFDEF HWLIBRARY}argc{$ELSE}ParamCount{$ENDIF};
   275     wrongParameter:= false;
   277     wrongParameter:= false;
   276     while (paramIndex <= ParamCount) do
   278     while (paramIndex <= paramTotal) do
   277         begin
   279         begin
   278         if parseParameter( ParamStr(paramIndex), ParamStr(paramIndex+1), paramIndex) then
   280         {$IFDEF HWLIBRARY}
   279             wrongParameter:= true;
   281         wrongParameter:= parseParameter( argv[paramIndex], argv[paramIndex+1], paramIndex);
       
   282         {$ELSE}
       
   283         wrongParameter:= parseParameter( ParamStr(paramIndex), ParamStr(paramIndex+1), paramIndex);
       
   284         {$ENDIF}
   280         inc(paramIndex);
   285         inc(paramIndex);
   281         end;
   286         end;
   282     if wrongParameter = true then
   287     if wrongParameter = true then
   283         GameType:= gmtSyntax;
   288         GameType:= gmtSyntax;
   284 end;
   289 end;
   285 
   290 
       
   291 {$IFNDEF HWLIBRARY}
   286 procedure GetParams;
   292 procedure GetParams;
   287 //var tmpInt: LongInt;
   293 //var tmpInt: LongInt;
   288 begin
   294 begin
   289     (*
   295     (*
   290     tmpInt:=0;
   296     tmpInt:=0;
   298     isInternal:= (ParamStr(1) = '--internal');
   304     isInternal:= (ParamStr(1) = '--internal');
   299 
   305 
   300     UserPathPrefix := '.';
   306     UserPathPrefix := '.';
   301     PathPrefix     := cDefaultPathPrefix;
   307     PathPrefix     := cDefaultPathPrefix;
   302     recordFileName := '';
   308     recordFileName := '';
   303     playReplayFileWithParameters();
   309     parseCommandLine();
   304 
   310 
   305     if (isInternal) and (ParamCount<=1) then
   311     if (isInternal) and (ParamCount<=1) then
   306         begin
   312         begin
   307         WriteLn(stderr, '--internal should not be manually used');
   313         WriteLn(stderr, '--internal should not be manually used');
   308         GameType := gmtSyntax;
   314         GameType := gmtSyntax;
   322     (*
   328     (*
   323     WriteLn(stdout,'PathPrefix:     ' + PathPrefix);
   329     WriteLn(stdout,'PathPrefix:     ' + PathPrefix);
   324     WriteLn(stdout,'UserPathPrefix: ' + UserPathPrefix);
   330     WriteLn(stdout,'UserPathPrefix: ' + UserPathPrefix);
   325     *)
   331     *)
   326 end;
   332 end;
       
   333 {$ENDIF}
       
   334