Ignore:
Timestamp:
May 19, 2022, 10:39:34 PM (2 years ago)
Author:
chronos
Message:
  • Modified: Use first capital letter in identifiers.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Tribes.pas

    r438 r447  
    4949    constructor Create(FileName: string);
    5050    destructor Destroy; override;
    51     function GetCityName(i: Integer): string;
    52 {$IFNDEF SCR} procedure SetCityName(i: Integer; NewName: string); {$ENDIF}
     51    function GetCityName(I: Integer): string;
     52{$IFNDEF SCR} procedure SetCityName(I: Integer; NewName: string); {$ENDIF}
    5353{$IFNDEF SCR} function TString(Template: string): string;
    5454    function TPhrase(Item: string): string; {$ENDIF}
     
    7474procedure FindStdModelPicture(Code: Integer; var pix: Integer; var Name: string);
    7575function GetTribeInfo(FileName: string; var Name: string; var Color: TColor): Boolean;
    76 procedure FindPosition(HGr: TGraphicSet; x, y, xmax, ymax: Integer; Mark: TColor;
     76procedure FindPosition(HGr: TGraphicSet; X, Y, xmax, ymax: Integer; Mark: TColor;
    7777  var xp, yp: Integer);
    7878
     
    215215function Get: string;
    216216var
    217   p: Integer;
     217  P: Integer;
    218218begin
    219219  while (Input <> '') and ((Input[1] = ' ') or (Input[1] = #9)) do
    220220    Delete(Input, 1, 1);
    221   p := Pos(',', Input);
    222   if p = 0 then
    223     p := Length(Input) + 1;
    224   Result := Copy(Input, 1, p - 1);
    225   Delete(Input, 1, p);
     221  P := Pos(',', Input);
     222  if P = 0 then
     223    P := Length(Input) + 1;
     224  Result := Copy(Input, 1, P - 1);
     225  Delete(Input, 1, P);
    226226end;
    227227
    228228function GetNum: Integer;
    229229var
    230   i: Integer;
    231 begin
    232   Val(Get, Result, i);
    233   if i <> 0 then
     230  I: Integer;
     231begin
     232  Val(Get, Result, I);
     233  if I <> 0 then
    234234    Result := 0;
    235235end;
     
    237237procedure FindStdModelPicture(Code: Integer; var pix: Integer; var Name: string);
    238238var
    239   i: Integer;
    240 begin
    241   for i := 0 to StdUnitScript.Count - 1 do
     239  I: Integer;
     240begin
     241  for I := 0 to StdUnitScript.Count - 1 do
    242242  begin // look through StdUnits
    243     Input := StdUnitScript[i];
     243    Input := StdUnitScript[I];
    244244    pix := GetNum;
    245245    if Code = GetNum then
     
    340340end;
    341341
    342 procedure FindPosition(HGr: TGraphicSet; x, y, xmax, ymax: Integer; Mark: TColor;
     342procedure FindPosition(HGr: TGraphicSet; X, Y, xmax, ymax: Integer; Mark: TColor;
    343343  var xp, yp: Integer);
    344344begin
    345345  xp := 0;
    346   while (xp < xmax) and (HGr.Data.Canvas.Pixels[x + 1 + xp, y] <> Mark) do
     346  while (xp < xmax) and (HGr.Data.Canvas.Pixels[X + 1 + xp, Y] <> Mark) do
    347347    Inc(xp);
    348348  yp := 0;
    349   while (yp < ymax) and (HGr.Data.Canvas.Pixels[x, y + 1 + yp] <> Mark) do
     349  while (yp < ymax) and (HGr.Data.Canvas.Pixels[X, Y + 1 + yp] <> Mark) do
    350350    Inc(yp);
    351351end;
    352352
    353 function TTribe.GetCityName(i: Integer): string;
     353function TTribe.GetCityName(I: Integer): string;
    354354begin
    355355  Result := '';
    356   if nCityLines > i then
    357   begin
    358     Result := Script[CityLine0 + i];
     356  if nCityLines > I then
     357  begin
     358    Result := Script[CityLine0 + I];
    359359    while (Result <> '') and ((Result[1] = ' ') or (Result[1] = #9)) do
    360360      Delete(Result, 1, 1);
     
    362362{$IFNDEF SCR}
    363363  else
    364     Result := Format(TPhrase('GENCITY'), [i + 1]);
     364    Result := Format(TPhrase('GENCITY'), [I + 1]);
    365365{$ENDIF}
    366366end;
    367367
    368368{$IFNDEF SCR}
    369 procedure TTribe.SetCityName(i: Integer; NewName: string);
    370 begin
    371   while nCityLines <= i do
     369procedure TTribe.SetCityName(I: Integer; NewName: string);
     370begin
     371  while nCityLines <= I do
    372372  begin
    373373    Script.Insert(CityLine0 + nCityLines, Format(TPhrase('GENCITY'),
     
    375375    Inc(nCityLines);
    376376  end;
    377   Script[CityLine0 + i] := NewName;
     377  Script[CityLine0 + I] := NewName;
    378378end;
    379379
    380380function TTribe.TString(Template: string): string;
    381381var
    382   p: Integer;
     382  P: Integer;
    383383  Variant: Char;
    384384  CaseUp: Boolean;
    385385begin
    386386  repeat
    387     p := pos('#', Template);
    388     if (p = 0) or (p = Length(Template)) then
     387    P := Pos('#', Template);
     388    if (P = 0) or (P = Length(Template)) then
    389389      Break;
    390     Variant := Template[p + 1];
     390    Variant := Template[P + 1];
    391391    CaseUp := Variant in ['A' .. 'Z'];
    392392    if CaseUp then
    393393      Inc(Variant, 32);
    394     Delete(Template, p, 2);
     394    Delete(Template, P, 2);
    395395    if Variant in ['a' .. 'z'] then
    396396    begin
    397397      if NumberName < 0 then
    398         Insert(Name[Variant], Template, p)
     398        Insert(Name[Variant], Template, P)
    399399      else
    400         Insert(Format('P%d', [NumberName]), Template, p);
    401       if CaseUp and (Length(Template) >= p) and
    402         (Template[p] in ['a' .. 'z', #$E0 .. #$FF]) then
    403         Dec(Template[p], 32);
     400        Insert(Format('P%d', [NumberName]), Template, P);
     401      if CaseUp and (Length(Template) >= P) and
     402        (Template[P] in ['a' .. 'z', #$E0 .. #$FF]) then
     403        Dec(Template[P], 32);
    404404    end
    405405  until False;
     
    418418  TLine = array [0 .. 649, 0 .. 2] of Byte;
    419419var
    420   i, x, Gray: Integer;
     420  I, X, Gray: Integer;
    421421  Item: string;
    422422begin
     
    426426  with Script do
    427427  begin
    428     i := 0;
    429     while (i < Count) and (Copy(Strings[i], 1, 6) <>
     428    I := 0;
     429    while (I < Count) and (Copy(Strings[I], 1, 6) <>
    430430        '#AGE' + char(48 + Age) + ' ') do
    431       Inc(i);
    432     if i < Count then
    433     begin
    434       Input := Strings[i];
     431      Inc(I);
     432    if I < Count then
     433    begin
     434      Input := Strings[I];
    435435      system.Delete(Input, 1, 6);
    436436      Item := Get;
     
    448448          end;
    449449        cHGr := LoadGraphicSet(Item + '.png');
    450         for x := 0 to 3 do
    451           with CityPicture[x] do begin
    452             FindPosition(cHGr, x * 65, cpix * 49, 63, 47, $00FFFF,
     450        for X := 0 to 3 do
     451          with CityPicture[X] do begin
     452            FindPosition(cHGr, X * 65, cpix * 49, 63, 47, $00FFFF,
    453453              xShield, yShield);
    454454            // FindPosition(cHGr,x*65,cpix*49,$FFFFFF,xf,yf);
     
    486486procedure TTribe.SetModelPicture(const Info: TModelPictureInfo; IsNew: Boolean);
    487487var
    488   i: Integer;
     488  I: Integer;
    489489  ok: Boolean;
    490490begin
     
    493493    if not IsNew then
    494494    begin
    495       i := nPictureList - 1;
    496       while (i >= 0) and (PictureList[i].Hash <> Info.Hash) do
    497         Dec(i);
    498       assert(i >= 0);
    499       assert(PictureList[i].HGr = LoadGraphicSet(GrName));
    500       assert(PictureList[i].pix = pix);
    501       ModelPicture[mix].HGr := PictureList[i].HGr;
    502       ModelPicture[mix].pix := PictureList[i].pix;
    503       ModelName[mix] := PictureList[i].ModelName;
     495      I := nPictureList - 1;
     496      while (I >= 0) and (PictureList[I].Hash <> Info.Hash) do
     497        Dec(I);
     498      Assert(I >= 0);
     499      Assert(PictureList[I].HGr = LoadGraphicSet(GrName));
     500      Assert(PictureList[I].pix = pix);
     501      ModelPicture[mix].HGr := PictureList[I].HGr;
     502      ModelPicture[mix].pix := PictureList[I].pix;
     503      ModelName[mix] := PictureList[I].ModelName;
    504504    end
    505505    else
     
    515515      // read model name from tribe script
    516516      ok := False;
    517       for i := 0 to Script.Count - 1 do
    518       begin
    519         Input := Script[i];
     517      for I := 0 to Script.Count - 1 do
     518      begin
     519        Input := Script[I];
    520520        if Input = '#UNITS ' + ExtractFileNameOnly(GrName) then
    521521          ok := True
     
    531531      if ModelName[mix] = '' then
    532532      begin // read model name from StdUnits.txt
    533         for i := 0 to StdUnitScript.Count - 1 do
     533        for I := 0 to StdUnitScript.Count - 1 do
    534534        begin
    535           Input := StdUnitScript[i];
     535          Input := StdUnitScript[I];
    536536          if GetNum = pix then
    537537          begin
     
    567567  Code, Turn: Integer; ForceNew: Boolean): Boolean;
    568568var
    569   i: Integer;
     569  I: Integer;
    570570  Cnt: Integer;
    571571  HGr: TGraphicSet;
     
    606606  if not ForceNew and (Picture.Hash > 0) then
    607607  begin
    608     for i := 0 to nPictureList - 1 do
    609       if PictureList[i].Hash = Picture.Hash then
    610       begin
    611         Picture.GrName := PictureList[i].HGr.Name;
    612         Picture.pix := PictureList[i].pix;
     608    for I := 0 to nPictureList - 1 do
     609      if PictureList[I].Hash = Picture.Hash then
     610      begin
     611        Picture.GrName := PictureList[I].HGr.Name;
     612        Picture.pix := PictureList[I].pix;
    613613        Result := False;
    614614        Exit;
     
    622622  TestPic.GrName := 'StdUnits.png';
    623623  HGr := HGrStdUnits;
    624   for i := 0 to StdUnitScript.Count - 1 do
     624  for I := 0 to StdUnitScript.Count - 1 do
    625625  begin // look through StdUnits
    626     Input := StdUnitScript[i];
     626    Input := StdUnitScript[I];
    627627    Check;
    628628  end;
    629629
    630630  ok := False;
    631   for i := 0 to Script.Count - 1 do
     631  for I := 0 to Script.Count - 1 do
    632632  begin // look through units defined in tribe script
    633     Input := Script[i];
     633    Input := Script[I];
    634634    if Copy(Input, 1, 6) = '#UNITS' then
    635635    begin
Note: See TracChangeset for help on using the changeset viewer.