Changeset 417 for trunk/LocalPlayer


Ignore:
Timestamp:
Nov 17, 2021, 11:11:01 AM (3 years ago)
Author:
chronos
Message:
  • Modified: Merged LoadGraphicSet and LoadGraphicSet2 into single method.
  • Modified: Moved brain load picture code into TBrain.LoadPicture method.
  • Added: Brain pictures loaded as TGraphicSetItem.
  • Modified: Code cleanup.
Location:
trunk/LocalPlayer
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/CityScreen.pas

    r380 r417  
    9393    procedure OnPlaySound(var Msg: TMessage); message WM_PLAYSOUND;
    9494  public
    95     RestoreUnFocus: integer;
     95    RestoreUnFocus: Integer;
    9696    CloseAction: TCityCloseAction;
    9797    procedure OffscreenPaint; override;
     
    148148  wZoomEnvironment = 68;
    149149
    150   ImpPosition: array [28 .. nImp - 1] of integer = (-1, // imTrGoods
     150  ImpPosition: array [28 .. nImp - 1] of Integer = (
     151    -1, // imTrGoods
    151152    21, // imBarracks
    152153    6, // imGranary
     
    192193
    193194var
    194   ImpSorted: array [0 .. nImp - 1] of integer;
     195  ImpSorted: array [0 .. nImp - 1] of Integer;
    195196
    196197procedure TCityDlg.FormCreate(Sender: TObject);
     
    206207  SmallMapMode := smImprovements;
    207208  ZoomArea := 1;
    208   ProdHint := false;
     209  ProdHint := False;
    209210  RestoreUnFocus := -1;
    210211  OpenSoundEvent := -1;
     
    489490var
    490491  x, y, xGr, i, j, iix, d, dx, dy, PrCost, Cnt, Loc1, FreeSupp, Paintiix,
    491     HappyGain, OptiType, rx, ry, TrueFood, TrueProd, TruePoll: integer;
    492   av: integer;
     492    HappyGain, OptiType, rx, ry, TrueFood, TrueProd, TruePoll: Integer;
     493  av: Integer;
    493494  PrName, s: string;
    494495  UnitInfo: TUnitInfo;
    495496  UnitReport: TUnitReport;
    496   IsCityAlive, CanGrow: boolean;
     497  IsCityAlive, CanGrow: Boolean;
    497498begin
    498499  inherited;
     
    509510  TrueProd := c.Prod;
    510511  TruePoll := c.Pollution;
    511   if supervising or (cix < 0) then
     512  if Supervising or (cix < 0) then
    512513  begin // normalize city from after-turn state
    513     dec(TrueFood, Report.FoodSurplus);
     514    Dec(TrueFood, Report.FoodSurplus);
    514515    if TrueFood < 0 then
    515516      TrueFood := 0; // shouldn't happen
    516     dec(TrueProd, Report.Production);
     517    Dec(TrueProd, Report.Production);
    517518    if TrueProd < 0 then
    518519      TrueProd := 0; // shouldn't happen
    519     dec(TruePoll, Report.AddPollution);
     520    Dec(TruePoll, Report.AddPollution);
    520521    if TruePoll < 0 then
    521522      TruePoll := 0; // shouldn't happen
     
    534535
    535536  Offscreen.Canvas.Font.Assign(UniFont[ftCaption]);
    536   RisedTextOut(offscreen.Canvas, 42, 7, Caption);
    537   with offscreen.Canvas do
     537  RisedTextOut(Offscreen.Canvas, 42, 7, Caption);
     538  with Offscreen.Canvas do
    538539  begin // city size
    539     brush.Color := $000000;
     540    Brush.Color := $000000;
    540541    FillRect(Rect(8 + 1, 7 + 1, 36 + 1, 32 + 1));
    541     brush.Color := $FFFFFF;
     542    Brush.Color := $FFFFFF;
    542543    FillRect(Rect(8, 7, 36, 32));
    543     brush.style := bsClear;
     544    Brush.style := bsClear;
    544545    Font.Color := $000000;
    545     s := inttostr(c.Size);
    546     TextOut(8 + 14 - textwidth(s) div 2, 7, s);
     546    s := IntToStr(c.Size);
     547    TextOut(8 + 14 - TextWidth(s) div 2, 7, s);
    547548  end;
    548549  Offscreen.Canvas.Font.Assign(UniFont[ftSmall]);
     
    959960          end // unit visible in display
    960961          else
    961             dec(FreeSupp, UnitReport.ProdSupport);
    962           inc(Cnt);
     962            Dec(FreeSupp, UnitReport.ProdSupport);
     963          Inc(Cnt);
    963964        end;
    964965    PageCount := (Cnt + 5) div 6;
     
    973974  PageDownBtn.Visible := PageCount > 1;
    974975
    975   with offscreen.Canvas do
     976  with Offscreen.Canvas do
    976977  begin
    977978    { display project now }
     
    10671068    end;
    10681069
    1069     NextCityBtn.Visible := false;
    1070     PrevCityBtn.Visible := false;
     1070    NextCityBtn.Visible := False;
     1071    PrevCityBtn.Visible := False;
    10711072  end;
    10721073  Page := 0;
     
    10821083
    10831084  // check if port
    1084   IsPort := false;
     1085  IsPort := False;
    10851086  for dx := -2 to 2 do
    10861087    for dy := -2 to 2 do
    1087       if abs(dx) + abs(dy) = 2 then
     1088      if Abs(dx) + Abs(dy) = 2 then
    10881089      begin
    10891090        Loc1 := dLoc(cLoc, dx, dy);
    10901091        if (Loc1 >= 0) and (Loc1 < G.lx * G.ly) and
    10911092          (MyMap[Loc1] and fTerrain < fGrass) then
    1092           IsPort := true;
     1093          IsPort := True;
    10931094      end;
    10941095
     
    11051106  OpenSoundEvent := -1;
    11061107  OffscreenPaint;
    1107   Timer1.Enabled := true;
     1108  Timer1.Enabled := True;
    11081109end;
    11091110
     
    11521153    InitZoomCityMap;
    11531154    SmartUpdateContent;
    1154     exit;
     1155    Exit;
    11551156  end;
    11561157  if (ssLeft in Shift) and (x >= xSupport) and (x < xSupport + wSupport) and
     
    11611162    InitZoomCityMap;
    11621163    SmartUpdateContent;
    1163     exit;
     1164    Exit;
    11641165  end;
    11651166  if not AllowChange then
    1166     exit; // not an own city
     1167    Exit; // Not an own city
    11671168
    11681169  if (ssLeft in Shift) then
     
    15851586procedure TCityDlg.FormClose(Sender: TObject; var Action: TCloseAction);
    15861587begin
    1587   Timer1.Enabled := false;
    1588   ProdHint := false;
     1588  Timer1.Enabled := False;
     1589  ProdHint := False;
    15891590  MarkCityLoc := -1;
    15901591  if Optimize_cixTileChange >= 0 then
     
    17511752  if Page > 0 then
    17521753  begin
    1753     dec(Page);
     1754    Dec(Page);
    17541755    SmartUpdateContent;
    17551756  end;
     
    17601761  if Page < PageCount - 1 then
    17611762  begin
    1762     inc(Page);
     1763    Inc(Page);
    17631764    SmartUpdateContent;
    17641765  end;
  • trunk/LocalPlayer/Nego.pas

    r352 r417  
    136136    'VII', 'VIII', 'IX', 'X', 'XI', 'XII', 'XIII', 'XIV', 'XV', 'XVI');
    137137
    138   ButtonPrice: array [0 .. 11] of cardinal = (opChoose, opCivilReport,
     138  ButtonPrice: array [0 .. 11] of Cardinal = (opChoose, opCivilReport,
    139139    opMilReport, opMap, opAllTech, opAllTech, opAllModel, opMoney, opTreaty,
    140140    opLowTreaty, opShipParts, opShipParts);
     
    142142procedure TNegoDlg.FormCreate(Sender: TObject);
    143143var
    144   cix: integer;
     144  cix: Integer;
    145145begin
    146146  InitButtons;
     
    153153        BackGraphic := HGrSystem2.Data;
    154154        case Tag shr 8 of
    155           1:
    156             SmartHint := Phrases.Lookup('WANT', ButtonIndex - 6);
    157           2:
    158             SmartHint := Phrases.Lookup('OFFER', ButtonIndex - 6);
     155          1: SmartHint := Phrases.Lookup('WANT', ButtonIndex - 6);
     156          2: SmartHint := Phrases.Lookup('OFFER', ButtonIndex - 6);
    159157        end;
    160158      end;
    161159
    162   fillchar(History, sizeof(History), 0);
     160  FillChar(History, SizeOf(History), 0);
    163161  RomanFont := TFont.Create;
    164162  RomanFont.Name := 'Times New Roman';
  • trunk/LocalPlayer/Term.pas

    r414 r417  
    43354335    if ClientMode <> cEditMap then
    43364336    begin
    4337       if supervising then
     4337      if Supervising then
    43384338      begin
    43394339        ScreenTools.Frame(Panel.Canvas, ClientWidth - xPalace - 1, yPalace - 1,
  • trunk/LocalPlayer/Tribes.pas

    r315 r417  
    430430        if CompareText(Item, 'stdcities') = 0 then
    431431          case cpix of
    432             3:
    433               cpix := 0;
    434             6:
    435             begin
     432            3: cpix := 0;
     433            6: begin
    436434              cpix := 0;
    437435              Item := 'Nation2';
    438             end
     436            end;
    439437          end;
    440438        cHGr := LoadGraphicSet(Item + '.png');
    441439        for x := 0 to 3 do
    442           with CityPicture[x] do
    443           begin
     440          with CityPicture[x] do begin
    444441            FindPosition(cHGr, x * 65, cpix * 49, 63, 47, $00FFFF,
    445442              xShield, yShield);
Note: See TracChangeset for help on using the changeset viewer.