Changeset 301 for trunk/LocalPlayer


Ignore:
Timestamp:
Mar 8, 2021, 10:11:47 PM (4 years ago)
Author:
chronos
Message:
  • Modified: CevoTribeExt string defined on single place.
  • Modified: Code cleanup.
Location:
trunk/LocalPlayer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/IsoEngine.pas

    r290 r301  
    703703    end;
    704704    Textout(xShield + 2, yShield - 1, LabelTextColor, s);
    705   end
     705  end;
    706706end; { PaintCity }
    707707
  • trunk/LocalPlayer/Term.pas

    r295 r301  
    786786function CreateTribe(p: integer; FileName: string; Original: boolean): boolean;
    787787begin
    788   if not FileExists(LocalizedFilePath('Tribes' + DirectorySeparator + FileName +
    789     '.tribe.txt')) then
    790   begin
    791     result := false;
    792     exit
     788  FileName := LocalizedFilePath('Tribes' + DirectorySeparator + FileName +
     789    CevoTribeExt);
     790  if not FileExists(FileName) then
     791  begin
     792    Result := False;
     793    Exit;
    793794  end;
    794795
     
    14131414begin
    14141415  UnusedTribeFiles.Clear;
    1415   ok := FindFirst(LocalizedFilePath('Tribes') + DirectorySeparator + '*.tribe.txt',
     1416  ok := FindFirst(LocalizedFilePath('Tribes') + DirectorySeparator + '*' + CevoTribeExt,
    14161417    faArchive + faReadOnly, SearchRec) = 0;
    14171418  if not ok then
    14181419  begin
    14191420    FindClose(SearchRec);
    1420     ok := FindFirst(LocalizedFilePath('Tribes' + DirectorySeparator + '*.tribe.txt'),
     1421    ok := FindFirst(LocalizedFilePath('Tribes' + DirectorySeparator + '*' + CevoTribeExt),
    14211422      faArchive + faReadOnly, SearchRec) = 0;
    14221423  end;
    14231424  if ok then
    14241425    repeat
    1425       SearchRec.Name := Copy(SearchRec.Name, 1, Length(SearchRec.Name) - 10);
     1426      SearchRec.Name := Copy(SearchRec.Name, 1, Length(SearchRec.Name) - Length(CevoTribeExt));
    14261427      if GetTribeInfo(SearchRec.Name, Name, Color) then
    14271428        UnusedTribeFiles.AddObject(SearchRec.Name, TObject(Color));
     
    14321433function TMainScreen.ChooseUnusedTribe: integer;
    14331434var
    1434   i, j, ColorDistance, BestColorDistance, TestColorDistance,
    1435     CountBest: integer;
     1435  i: Integer;
     1436  j: Integer;
     1437  ColorDistance: Integer;
     1438  BestColorDistance: Integer;
     1439  TestColorDistance: Integer;
     1440  CountBest: Integer;
    14361441begin
    14371442  assert(UnusedTribeFiles.Count > 0);
  • trunk/LocalPlayer/Tribes.pas

    r300 r301  
    55
    66uses
    7   Protocol, ScreenTools, LazFileUtils, Classes, Graphics, SysUtils;
     7  Protocol, ScreenTools, LazFileUtils, Classes, Graphics, SysUtils, Global;
    88
    99type
     
    4949{$IFNDEF SCR} function TString(Template: string): string;
    5050    function TPhrase(Item: string): string; {$ENDIF}
    51     procedure SetModelPicture(const Info: TModelPictureInfo; IsNew: boolean);
     51    procedure SetModelPicture(const Info: TModelPictureInfo; IsNew: Boolean);
    5252    function ChooseModelPicture(var Picture: TModelPictureInfo;
    53       Code, Turn: Integer; ForceNew: boolean): boolean;
     53      Code, Turn: Integer; ForceNew: Boolean): Boolean;
    5454    procedure InitAge(Age: Integer);
    5555  protected
     
    6868function CityName(Founder: Integer): string;
    6969function ModelCode(const ModelInfo: TModelInfo): Integer;
    70 procedure FindStdModelPicture(code: Integer; var pix: Integer; var Name: string);
    71 function GetTribeInfo(FileName: string; var Name: string; var Color: TColor): boolean;
     70procedure FindStdModelPicture(Code: Integer; var pix: Integer; var Name: string);
     71function GetTribeInfo(FileName: string; var Name: string; var Color: TColor): Boolean;
    7272procedure FindPosition(HGr, x, y, xmax, ymax: Integer; Mark: TColor;
    7373  var xp, yp: Integer);
     
    231231end;
    232232
    233 procedure FindStdModelPicture(code: Integer; var pix: Integer; var Name: string);
     233procedure FindStdModelPicture(Code: Integer; var pix: Integer; var Name: string);
    234234var
    235235  i: Integer;
     
    239239    Input := StdUnitScript[i];
    240240    pix := GetNum;
    241     if code = GetNum then
     241    if Code = GetNum then
    242242    begin
    243243      Name := Get;
     
    249249
    250250function GetTribeInfo(FileName: string; var Name: string;
    251   var Color: TColor): boolean;
     251  var Color: TColor): Boolean;
    252252var
    253253  Found: Integer;
     
    258258  Found := 0;
    259259  AssignFile(TribeScript, LocalizedFilePath('Tribes' + DirectorySeparator +
    260     FileName + '.tribe.txt'));
     260    FileName + CevoTribeExt));
    261261  Reset(TribeScript);
    262262  while not EOF(TribeScript) do
     
    285285var
    286286  Line: Integer;
    287   Variant: char;
     287  Variant: Char;
    288288  Item: string;
    289289begin
     
    292292    Name[Variant] := '';
    293293  Script := TStringList.Create;
    294   Script.LoadFromFile(LocalizedFilePath('Tribes' + DirectorySeparator +
    295     FileName + '.tribe.txt'));
     294  Script.LoadFromFile(FileName);
    296295  CityLine0 := 0;
    297296  nCityLines := 0;
     
    476475end;
    477476
    478 procedure TTribe.SetModelPicture(const Info: TModelPictureInfo; IsNew: boolean);
     477procedure TTribe.SetModelPicture(const Info: TModelPictureInfo; IsNew: Boolean);
    479478var
    480479  i: Integer;
Note: See TracChangeset for help on using the changeset viewer.