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/CityScreen.pas

    r442 r447  
    3939    procedure FormDestroy(Sender: TObject);
    4040    procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
    41       Shift: TShiftState; x, y: integer);
     41      Shift: TShiftState; X, Y: Integer);
    4242    procedure BuyClick(Sender: TObject);
    4343    procedure CloseBtnClick(Sender: TObject);
     
    5353    procedure PageDownBtnClick(Sender: TObject);
    5454  private
    55     c: TCity;
     55    C: TCity;
    5656    Report: TCityReportNew;
    5757    cOwner: Integer;
     
    7070    Optimize_cixTileChange: Integer;
    7171    Optimize_TilesBeforeChange: Integer;
    72     Happened: cardinal;
    73     imix: array [0 .. 15] of integer;
     72    Happened: Cardinal;
     73    imix: array [0 .. 15] of Integer;
    7474    CityAreaInfo: TCityAreaInfo;
    7575    AreaMap: TIsoMap;
     
    8989    procedure InitZoomCityMap;
    9090    procedure ChooseProject;
    91     procedure ChangeCity(d: integer);
    92     procedure ChangeResourceWeights(iResourceWeights: integer);
     91    procedure ChangeCity(D: Integer);
     92    procedure ChangeResourceWeights(iResourceWeights: Integer);
    9393    procedure OnPlaySound(var Msg: TMessage); message WM_PLAYSOUND;
    9494  public
     
    9696    CloseAction: TCityCloseAction;
    9797    procedure OffscreenPaint; override;
    98     procedure ShowNewContent(NewMode: TWindowMode; Loc: integer; ShowEvent: cardinal);
     98    procedure ShowNewContent(NewMode: TWindowMode; Loc: Integer; ShowEvent: Cardinal);
    9999    procedure Reset;
    100100    procedure CheckAge;
     
    202202  NoMap := TIsoMap.Create;
    203203  AreaMap := TIsoMap.Create;
    204   AreaMap.SetOutput(offscreen);
     204  AreaMap.SetOutput(Offscreen);
    205205  AreaMap.SetPaintBounds(xmArea - 192, ymArea - 96 - 32, xmArea + 192,
    206206    ymArea + 96);
     
    293293procedure TCityDlg.InitSmallCityMap;
    294294var
    295   i, iix, cli1, Color0, Color1, Color2: integer;
     295  I, iix, cli1, Color0, Color1, Color2: Integer;
    296296begin
    297297  if cix >= 0 then
    298     c := MyCity[cix];
     298    C := MyCity[cix];
    299299  case MyMap[cLoc] and fTerrain of
    300300    fPrairie: cli1 := cliPrairie;
     
    329329  begin
    330330    Brush.Color := ScreenTools.Colors.Canvas.Pixels[clkAge0 + Age, cliImp];
    331     for i := 0 to 29 do
     331    for I := 0 to 29 do
    332332    begin
    333333      for iix := nWonder to nImp - 1 do
    334         if (ImpPosition[iix] = i) and (c.Built[iix] > 0) then
     334        if (ImpPosition[iix] = I) and (C.Built[iix] > 0) then
    335335        begin
    336           FillRect(Rect(5 + 16 * (i mod 3) + 48 * (i div 18),
    337             3 + 12 * (i mod 18 div 3), 13 + 16 * (i mod 3) + 48 * (i div 18),
    338             11 + 12 * (i mod 18 div 3)));
    339           break;
     336          FillRect(Rect(5 + 16 * (I mod 3) + 48 * (I div 18),
     337            3 + 12 * (I mod 18 div 3), 13 + 16 * (I mod 3) + 48 * (I div 18),
     338            11 + 12 * (I mod 18 div 3)));
     339          Break;
    340340        end;
    341341    end;
    342     i := 30;
     342    I := 30;
    343343    for iix := 0 to nImp do
    344       if (c.Built[iix] > 0) and ((iix < nWonder) or (ImpPosition[iix] < 0)) then
     344      if (C.Built[iix] > 0) and ((iix < nWonder) or (ImpPosition[iix] < 0)) then
    345345      begin
    346         FillRect(Rect(5 + 16 * (i mod 3) + 48 * (i div 18),
    347           3 + 12 * (i mod 18 div 3), 13 + 16 * (i mod 3) + 48 * (i div 18),
    348           11 + 12 * (i mod 18 div 3)));
    349         inc(i);
    350         if i = 36 then
    351           break; // area is full
     346        FillRect(Rect(5 + 16 * (I mod 3) + 48 * (I div 18),
     347          3 + 12 * (I mod 18 div 3), 13 + 16 * (I mod 3) + 48 * (I div 18),
     348          11 + 12 * (I mod 18 div 3)));
     349        Inc(I);
     350        if I = 36 then
     351          Break; // area is full
    352352      end;
    353     if c.Project and cpImp <> 0 then
    354     begin
    355       iix := c.Project and cpIndex;
     353    if C.Project and cpImp <> 0 then
     354    begin
     355      iix := C.Project and cpIndex;
    356356      if iix <> imTrGoods then
    357357      begin
    358358        if (iix >= nWonder) and (ImpPosition[iix] >= 0) then
    359           i := ImpPosition[iix];
    360         if i < 36 then
     359          I := ImpPosition[iix];
     360        if I < 36 then
    361361        begin
    362           brush.Color := ScreenTools.Colors.Canvas.Pixels[clkAge0 + Age, cliImpProject];
    363           FillRect(Rect(5 + 16 * (i mod 3) + 48 * (i div 18),
    364             3 + 12 * (i mod 18 div 3), 13 + 16 * (i mod 3) + 48 * (i div 18),
    365             11 + 12 * (i mod 18 div 3)));
     362          Brush.Color := ScreenTools.Colors.Canvas.Pixels[clkAge0 + Age, cliImpProject];
     363          FillRect(Rect(5 + 16 * (I mod 3) + 48 * (I div 18),
     364            3 + 12 * (I mod 18 div 3), 13 + 16 * (I mod 3) + 48 * (I div 18),
     365            11 + 12 * (I mod 18 div 3)));
    366366        end;
    367367      end;
    368368    end;
    369     brush.style := bsClear;
     369    Brush.style := bsClear;
    370370  end;
    371371end;
     
    384384        112 * (ZoomArea - 3), wZoomMap - wZoomEnvironment, hZoomMap);
    385385      ImageOp_B(ZoomCityMap, CityMapTemplate, wZoomMap - wZoomEnvironment, 0,
    386         1504 + wZoomEnvironment * byte(IsPort), 112 * (ZoomArea - 3),
     386        1504 + wZoomEnvironment * Byte(IsPort), 112 * (ZoomArea - 3),
    387387        wZoomEnvironment, hZoomMap);
    388388    end;
     
    392392procedure TCityDlg.OffscreenPaint;
    393393
    394   procedure FillBar(x, y, pos, Growth, max, Kind: integer;
    395     IndicateComplete: boolean);
     394  procedure FillBar(X, Y, Pos, Growth, Max, Kind: Integer;
     395    IndicateComplete: Boolean);
    396396  begin
    397397    BarTex.Assign(MainTexture);
     
    400400      BarTex.ColorBevelShade := BarTex.ColorBevelLight;
    401401    end;
    402     PaintRelativeProgressBar(offscreen.Canvas, Kind, x - 3, y, wBar - 4, pos,
    403       Growth, max, IndicateComplete, BarTex);
    404   end;
    405 
    406   procedure PaintResources(x, y, Loc: integer; Add4Happy: boolean);
     402    PaintRelativeProgressBar(Offscreen.Canvas, Kind, X - 3, Y, wBar - 4, Pos,
     403      Growth, Max, IndicateComplete, BarTex);
     404  end;
     405
     406  procedure PaintResources(X, Y, Loc: Integer; Add4Happy: Boolean);
    407407  var
    408     d, i, Total, xGr, yGr: integer;
     408    D, I, Total, xGr, yGr: Integer;
    409409    TileInfo: TTileInfo;
    410     rare: boolean;
     410    rare: Boolean;
    411411  begin
    412412    with AreaMap do begin
    413     if Server(sGetCityTileInfo, me, Loc, TileInfo) <> eOk then
    414     begin
    415       assert(cix < 0);
    416       exit
     413    if Server(sGetCityTileInfo, Me, Loc, TileInfo) <> eOk then
     414    begin
     415      Assert(cix < 0);
     416      Exit
    417417    end;
    418418    Total := TileInfo.Food + TileInfo.Prod + TileInfo.Trade;
    419419    rare := MyMap[Loc] and $06000000 > 0;
    420420    if rare then
    421       inc(Total);
     421      Inc(Total);
    422422    if Add4Happy then
    423       inc(Total, 4);
     423      Inc(Total, 4);
    424424    if Total > 1 then
    425       d := (xxt - 11) div (Total - 1);
    426     if d < 1 then
    427       d := 1;
    428     if d > 4 then
    429       d := 4;
    430     for i := 0 to Total - 1 do
     425      D := (xxt - 11) div (Total - 1);
     426    if D < 1 then
     427      D := 1;
     428    if D > 4 then
     429      D := 4;
     430    for I := 0 to Total - 1 do
    431431    begin
    432432      yGr := 115;
    433       if Add4Happy and (i >= Total - 4) then
     433      if Add4Happy and (I >= Total - 4) then
    434434      begin
    435435        xGr := 132;
    436436        yGr := 126
    437437      end
    438       else if rare and (i = Total - 1) then
     438      else if rare and (I = Total - 1) then
    439439        xGr := 66 + 110
    440       else if i >= TileInfo.Food + TileInfo.Prod then
     440      else if I >= TileInfo.Food + TileInfo.Prod then
    441441        xGr := 66 + 44
    442       else if i >= TileInfo.Prod then
     442      else if I >= TileInfo.Prod then
    443443        xGr := 66
    444444      else
    445445        xGr := 66 + 22;
    446       Sprite(offscreen, HGrSystem, x + xxt - 5 + d * (2 * i + 1 - Total),
    447         y + yyt - 5, 10, 10, xGr, yGr);
     446      Sprite(Offscreen, HGrSystem, X + xxt - 5 + D * (2 * I + 1 - Total),
     447        Y + yyt - 5, 10, 10, xGr, yGr);
    448448    end;
    449449    end;
    450450  end;
    451451var
    452   line, MessageCount: integer;
    453 
    454   procedure CheckMessage(Flag: integer);
     452  Line, MessageCount: Integer;
     453
     454  procedure CheckMessage(Flag: Integer);
    455455  var
    456     i, test: integer;
    457     s: string;
     456    I, Test: Integer;
     457    S: string;
    458458  begin
    459459    if Happened and Flag <> 0 then
    460460    begin
    461       i := 0;
    462       test := 1;
    463       while test < Flag do
     461      I := 0;
     462      Test := 1;
     463      while Test < Flag do
    464464      begin
    465         inc(i);
    466         inc(test, test)
     465        Inc(I);
     466        Inc(Test, Test);
    467467      end;
    468468
    469469      if AllowChange and (Sounds <> nil) and (OpenSoundEvent = -1) then
    470470      begin
    471         s := CityEventSoundItem[i];
    472         if s <> '' then
    473           s := Sounds.Lookup(s);
    474         if (Flag = chProduction) or (s <> '') and (s[1] <> '*') and (s[1] <> '[')
     471        S := CityEventSoundItem[I];
     472        if S <> '' then
     473          S := Sounds.Lookup(S);
     474        if (Flag = chProduction) or (S <> '') and (S[1] <> '*') and (S[1] <> '[')
    475475        then
    476           OpenSoundEvent := i
     476          OpenSoundEvent := I;
    477477      end;
    478478
    479       s := CityEventName(i);
     479      S := CityEventName(I);
    480480      { if Flag=chNoGrowthWarning then
    481         if c.Built[imAqueduct]=0 then
    482         s:=Format(s,[Phrases.Lookup('IMPROVEMENTS',imAqueduct)])
    483         else s:=Format(s,[Phrases.Lookup('IMPROVEMENTS',imSewer)]); }
    484       RisedTextOut(offscreen.Canvas, xmOpt + 40, ymOpt - 1 - 8 * MessageCount +
    485         16 * line, s);
    486       inc(line)
     481        if C.Built[imAqueduct]=0 then
     482        S:=Format(S,[Phrases.Lookup('IMPROVEMENTS',imAqueduct)])
     483        else S:=Format(S,[Phrases.Lookup('IMPROVEMENTS',imSewer)]); }
     484      RisedTextOut(Offscreen.Canvas, xmOpt + 40, ymOpt - 1 - 8 * MessageCount +
     485        16 * Line, S);
     486      Inc(Line);
    487487    end;
    488488  end;
    489489
    490490var
    491   x, y, xGr, i, j, iix, d, dx, dy, PrCost, Cnt, Loc1, FreeSupp, Paintiix,
     491  X, Y, xGr, I, J, iix, D, dx, dy, PrCost, Cnt, Loc1, FreeSupp, Paintiix,
    492492    HappyGain, OptiType, rx, ry, TrueFood, TrueProd, TruePoll: Integer;
    493493  av: Integer;
    494   PrName, s: string;
     494  PrName, S: string;
    495495  UnitInfo: TUnitInfo;
    496496  UnitReport: TUnitReport;
     
    499499  inherited;
    500500  if cix >= 0 then
    501     c := MyCity[cix];
     501    C := MyCity[cix];
    502502  Report.HypoTiles := -1;
    503503  Report.HypoTaxRate := -1;
    504504  Report.HypoLuxuryRate := -1;
    505505  if cix >= 0 then
    506     Server(sGetCityReportNew, me, cix, Report) // own city
     506    Server(sGetCityReportNew, Me, cix, Report) // own city
    507507  else
    508     Server(sGetEnemyCityReportNew, me, cLoc, Report); // enemy city
    509   TrueFood := c.Food;
    510   TrueProd := c.Prod;
    511   TruePoll := c.Pollution;
     508    Server(sGetEnemyCityReportNew, Me, cLoc, Report); // enemy city
     509  TrueFood := C.Food;
     510  TrueProd := C.Prod;
     511  TruePoll := C.Pollution;
    512512  if Supervising or (cix < 0) then
    513513  begin // normalize city from after-turn state
     
    522522      TruePoll := 0; // shouldn't happen
    523523  end;
    524   IsCityAlive := (cGov <> gAnarchy) and (c.Flags and chCaptured = 0);
     524  IsCityAlive := (cGov <> gAnarchy) and (C.Flags and chCaptured = 0);
    525525  if not IsCityAlive then
    526     Report.Working := c.Size;
     526    Report.Working := C.Size;
    527527
    528528  RedTex.Assign(MainTexture);
     
    532532  RedTex.ColorTextShade := $0000FF;
    533533
    534   BitBltCanvas(offscreen.Canvas, 0, 0, 640, 480, Back.Canvas, 0, 0);
     534  BitBltCanvas(Offscreen.Canvas, 0, 0, 640, 480, Back.Canvas, 0, 0);
    535535
    536536  Offscreen.Canvas.Font.Assign(UniFont[ftCaption]);
     
    544544    Brush.style := bsClear;
    545545    Font.Color := $000000;
    546     s := IntToStr(c.Size);
    547     TextOut(8 + 14 - TextWidth(s) div 2, 7, s);
     546    S := IntToStr(C.Size);
     547    TextOut(8 + 14 - TextWidth(S) div 2, 7, S);
    548548  end;
    549549  Offscreen.Canvas.Font.Assign(UniFont[ftSmall]);
     
    553553    MakeRed(Offscreen, 18, 280, 298, 40);
    554554    if cGov = gAnarchy then
    555       s := Phrases.Lookup('GOVERNMENT', gAnarchy)
     555      S := Phrases.Lookup('GOVERNMENT', gAnarchy)
    556556    else { if c.Flags and chCaptured<>0 then }
    557       s := Phrases.Lookup('CITYEVENTS', 14);
    558     RisedTextOut(offscreen.Canvas, 167 - BiColorTextWidth(offscreen.Canvas, s)
    559       div 2, ymOpt - 9, s);
     557      S := Phrases.Lookup('CITYEVENTS', 14);
     558    RisedTextOut(Offscreen.Canvas, 167 - BiColorTextWidth(Offscreen.Canvas, S)
     559      div 2, ymOpt - 9, S);
    560560  end
    561561  else if AllowChange then
    562562  begin
    563     OptiType := c.Status shr 4 and $0F;
    564     Sprite(offscreen, HGrSystem2, xmOpt - 32, ymOpt - 32, 64, 64,
     563    OptiType := C.Status shr 4 and $0F;
     564    Sprite(Offscreen, HGrSystem2, xmOpt - 32, ymOpt - 32, 64, 64,
    565565      1 + OptiType mod 3 * 64, 217 + OptiType div 3 * 64);
    566566
    567567    { display messages now }
    568568    MessageCount := 0;
    569     for i := 0 to 31 do
    570       if Happened and ($FFFFFFFF - chCaptured) and (1 shl i) <> 0 then
    571         inc(MessageCount);
     569    for I := 0 to 31 do
     570      if Happened and ($FFFFFFFF - chCaptured) and (1 shl I) <> 0 then
     571        Inc(MessageCount);
    572572    if MessageCount > 3 then
    573573      MessageCount := 3;
    574574    if MessageCount > 0 then
    575575    begin
    576       MakeBlue(offscreen, 74, 280, 242, 40);
    577       line := 0;
    578       for i := 0 to nCityEventPriority - 1 do
    579         if line < MessageCount then
    580           CheckMessage(CityEventPriority[i]);
     576      MakeBlue(Offscreen, 74, 280, 242, 40);
     577      Line := 0;
     578      for I := 0 to nCityEventPriority - 1 do
     579        if Line < MessageCount then
     580          CheckMessage(CityEventPriority[I]);
    581581    end
    582582    else
    583583    begin
    584       s := Phrases.Lookup('CITYMANAGETYPE', OptiType);
    585       j := pos('\', s);
    586       if j = 0 then
    587         LoweredTextout(offscreen.Canvas, -1, MainTexture, xmOpt + 40,
    588           ymOpt - 9, s)
     584      S := Phrases.Lookup('CITYMANAGETYPE', OptiType);
     585      J := Pos('\', S);
     586      if J = 0 then
     587        LoweredTextout(Offscreen.Canvas, -1, MainTexture, xmOpt + 40,
     588          ymOpt - 9, S)
    589589      else
    590590      begin
    591         LoweredTextout(offscreen.Canvas, -1, MainTexture, xmOpt + 40,
    592           ymOpt - 17, copy(s, 1, j - 1));
    593         LoweredTextout(offscreen.Canvas, -1, MainTexture, xmOpt + 40, ymOpt - 1,
    594           copy(s, j + 1, 255));
     591        LoweredTextout(Offscreen.Canvas, -1, MainTexture, xmOpt + 40,
     592          ymOpt - 17, Copy(S, 1, J - 1));
     593        LoweredTextout(Offscreen.Canvas, -1, MainTexture, xmOpt + 40, ymOpt - 1,
     594          Copy(S, J + 1, 255));
    595595      end;
    596596    end;
     
    602602    AreaMap.Paint(xmArea - xxt * 2 * rx, ymArea - yyt * 2 * ry - 3 * yyt,
    603603      dLoc(cLoc, -2 * rx + 1, -2 * ry - 1), 4 * rx - 1, 4 * ry + 1, cLoc, cOwner,
    604       false, AllowChange and IsCityAlive and
    605       (c.Status and csResourceWeightsMask = 0));
    606     BitBltCanvas(offscreen.Canvas, xmArea + 102, 42, 90, 33, Back.Canvas,
     604      False, AllowChange and IsCityAlive and
     605      (C.Status and csResourceWeightsMask = 0));
     606    BitBltCanvas(Offscreen.Canvas, xmArea + 102, 42, 90, 33, Back.Canvas,
    607607      xmArea + 102, 42);
    608608
     
    616616              ((Loc1 < 0) or (Loc1 >= G.lx * G.ly) or (MyMap[Loc1] and fCity = 0))
    617617            then
    618               Sprite(offscreen, HGrTerrain, xmArea - xxt + xxt * dx,
     618              Sprite(Offscreen, HGrTerrain, xmArea - xxt + xxt * dx,
    619619                ymArea - yyt + yyt * dy, xxt * 2, yyt * 2, 1 + 5 * (xxt * 2 + 1),
    620620                1 + yyt + 15 * (yyt * 3 + 1));
    621             if (1 shl ((dy + 3) shl 2 + (dx + 3) shr 1) and c.Tiles <> 0) then
     621            if (1 shl ((dy + 3) shl 2 + (dx + 3) shr 1) and C.Tiles <> 0) then
    622622              PaintResources(xmArea - xxt + xxt * dx, ymArea - yyt + yyt * dy,
    623623                Loc1, (dx = 0) and (dy = 0));
     
    626626
    627627  if Report.Working > 1 then
    628     d := (xService - (xmArea - 192) - 8 - 32) div (Report.Working - 1);
    629   if d > 28 then
    630     d := 28;
    631   for i := Report.Working - 1 downto 0 do
     628    D := (xService - (xmArea - 192) - 8 - 32) div (Report.Working - 1);
     629  if D > 28 then
     630    D := 28;
     631  for I := Report.Working - 1 downto 0 do
    632632  begin
    633633    if IsCityAlive then
     
    635635    else
    636636      xGr := 141;
    637     BitBltCanvas(offscreen.Canvas, xmArea - 192 + 5 + i * d, ymArea - 96 - 29,
     637    BitBltCanvas(Offscreen.Canvas, xmArea - 192 + 5 + I * D, ymArea - 96 - 29,
    638638      27, 30, HGrSystem.Mask.Canvas, xGr, 171, SRCAND); { shadow }
    639     Sprite(offscreen, HGrSystem, xmArea - 192 + 4 + i * d, ymArea - 96 - 30, 27,
     639    Sprite(Offscreen, HGrSystem, xmArea - 192 + 4 + I * D, ymArea - 96 - 30, 27,
    640640      30, xGr, 171);
    641641  end;
    642   if c.Size - Report.Working > 1 then
    643     d := (xmArea + 192 - xService - 32) div (c.Size - Report.Working - 1);
    644   if d > 28 then
    645     d := 28;
    646   for i := 0 to c.Size - Report.Working - 1 do
     642  if C.Size - Report.Working > 1 then
     643    D := (xmArea + 192 - xService - 32) div (C.Size - Report.Working - 1);
     644  if D > 28 then
     645    D := 28;
     646  for I := 0 to C.Size - Report.Working - 1 do
    647647  begin
    648648    xGr := 1 + 112;
    649     BitBltCanvas(offscreen.Canvas, xmArea + 192 - 27 + 1 - i * d, 29 + 1, 27,
     649    BitBltCanvas(Offscreen.Canvas, xmArea + 192 - 27 + 1 - I * D, 29 + 1, 27,
    650650      30, HGrSystem.Mask.Canvas, xGr, 171, SRCAND); { shadow }
    651     Sprite(offscreen, HGrSystem, xmArea + 192 - 27 - i * d, 29, 27, 30,
     651    Sprite(Offscreen, HGrSystem, xmArea + 192 - 27 - I * D, 29, 27, 30,
    652652      xGr, 171);
    653     Sprite(offscreen, HGrSystem, xmArea + 192 - 27 + 4 - i * d, 29 + 32, 10,
     653    Sprite(Offscreen, HGrSystem, xmArea + 192 - 27 + 4 - I * D, 29 + 32, 10,
    654654      10, 121, 126);
    655     Sprite(offscreen, HGrSystem, xmArea + 192 - 27 + 13 - i * d, 29 + 32, 10,
     655    Sprite(Offscreen, HGrSystem, xmArea + 192 - 27 + 13 - I * D, 29 + 32, 10,
    656656      10, 121, 126);
    657657    // Sprite(offscreen,HGrSystem,xmArea+192-31+18-i*d,ymArea-96-80+32,10,10,88,115);
    658658  end;
    659659
    660   if c.Project and cpImp = 0 then
    661     PrName := Tribe[cOwner].ModelName[c.Project and cpIndex]
     660  if C.Project and cpImp = 0 then
     661    PrName := Tribe[cOwner].ModelName[C.Project and cpIndex]
    662662  else
    663     PrName := Phrases.Lookup('IMPROVEMENTS', c.Project and cpIndex);
     663    PrName := Phrases.Lookup('IMPROVEMENTS', C.Project and cpIndex);
    664664  PrCost := Report.ProjectCost;
    665665
     
    668668  begin
    669669    if cGov = gFundamentalism then
    670       CountBar(offscreen, xHapp, yHapp + dyBar, wBar, 17,
     670      CountBar(Offscreen, xHapp, yHapp + dyBar, wBar, 17,
    671671        Phrases.Lookup('FAITH'), Report.CollectedControl, MainTexture)
    672672    else
    673673    begin
    674       CountBar(offscreen, xHapp, yHapp + dyBar, wBar, 17,
     674      CountBar(Offscreen, xHapp, yHapp + dyBar, wBar, 17,
    675675        Phrases.Lookup('HAPPINESS'), Report.Morale, MainTexture);
    676       CountBar(offscreen, xHapp, yHapp + 2 * dyBar, wBar, 16,
     676      CountBar(Offscreen, xHapp, yHapp + 2 * dyBar, wBar, 16,
    677677        Phrases.Lookup('CONTROL'), Report.CollectedControl, MainTexture);
    678678    end;
    679     CountBar(offscreen, xHapp, yHapp, wBar, 8, Phrases.Lookup('LUX'),
     679    CountBar(Offscreen, xHapp, yHapp, wBar, 8, Phrases.Lookup('LUX'),
    680680      Report.Luxury, MainTexture);
    681     CountBar(offscreen, xHapp + dxBar, yHapp, wBar, 19,
     681    CountBar(Offscreen, xHapp + dxBar, yHapp, wBar, 19,
    682682      Phrases.Lookup('UNREST'), 2 * Report.Deployed, MainTexture);
    683     CountBar(offscreen, xHapp + dxBar, yHapp + dyBar, wBar, 17,
    684       Phrases.Lookup('HAPPINESSDEMAND'), c.Size, MainTexture);
     683    CountBar(Offscreen, xHapp + dxBar, yHapp + dyBar, wBar, 17,
     684      Phrases.Lookup('HAPPINESSDEMAND'), C.Size, MainTexture);
    685685    if Report.HappinessBalance >= 0 then
    686       CountBar(offscreen, xHapp + dxBar, yHapp + 2 * dyBar, wBar, 17,
     686      CountBar(Offscreen, xHapp + dxBar, yHapp + 2 * dyBar, wBar, 17,
    687687        Phrases.Lookup('HAPPINESSPLUS'), Report.HappinessBalance, MainTexture)
    688688    else
    689689    begin
    690690      MakeRed(Offscreen, xHapp + dxBar - 6, yHapp + 2 * dyBar, wBar + 10, 38);
    691       CountBar(offscreen, xHapp + dxBar, yHapp + 2 * dyBar, wBar, 18,
     691      CountBar(Offscreen, xHapp + dxBar, yHapp + 2 * dyBar, wBar, 18,
    692692        Phrases.Lookup('LACK'), -Report.HappinessBalance, RedTex);
    693693    end;
     
    697697  if IsCityAlive then
    698698  begin
    699     CountBar(offscreen, xFood, yFood + dyBar div 2, wBar, 0,
     699    CountBar(Offscreen, xFood, yFood + dyBar div 2, wBar, 0,
    700700      Phrases.Lookup('FOOD'), Report.CollectedFood, MainTexture);
    701     CountBar(offscreen, xFood + dxBar, yFood + dyBar, wBar, 0,
    702       Phrases.Lookup('DEMAND'), 2 * c.Size, MainTexture);
    703     CountBar(offscreen, xFood + dxBar, yFood, wBar, 0,
     701    CountBar(Offscreen, xFood + dxBar, yFood + dyBar, wBar, 0,
     702      Phrases.Lookup('DEMAND'), 2 * C.Size, MainTexture);
     703    CountBar(Offscreen, xFood + dxBar, yFood, wBar, 0,
    704704      Phrases.Lookup('SUPPORT'), Report.FoodSupport, MainTexture);
    705705    if Report.FoodSurplus >= 0 then
    706       if (cGov = gFuture) or (c.Size >= NeedAqueductSize) and
     706      if (cGov = gFuture) or (C.Size >= NeedAqueductSize) and
    707707        (Report.FoodSurplus < 2) then
    708         CountBar(offscreen, xFood + dxBar, yFood + 2 * dyBar, wBar, 6,
     708        CountBar(Offscreen, xFood + dxBar, yFood + 2 * dyBar, wBar, 6,
    709709          Phrases.Lookup('PROFIT'), Report.FoodSurplus, MainTexture)
    710710      else
    711         CountBar(offscreen, xFood + dxBar, yFood + 2 * dyBar, wBar, 0,
     711        CountBar(Offscreen, xFood + dxBar, yFood + 2 * dyBar, wBar, 0,
    712712          Phrases.Lookup('SURPLUS'), Report.FoodSurplus, MainTexture)
    713713    else
    714714    begin
    715715      MakeRed(Offscreen, xFood + dxBar - 6, yFood + 2 * dyBar, wBar + 10, 38);
    716       CountBar(offscreen, xFood + dxBar, yFood + 2 * dyBar, wBar, 1,
     716      CountBar(Offscreen, xFood + dxBar, yFood + 2 * dyBar, wBar, 1,
    717717        Phrases.Lookup('LACK'), -Report.FoodSurplus, RedTex);
    718718    end;
    719719  end;
    720   CanGrow := (c.Size < MaxCitySize) and (cGov <> gFuture) and
    721     (Report.FoodSurplus > 0) and ((c.Size < NeedAqueductSize) or
    722     (c.Built[imAqueduct] = 1) and (c.Size < NeedSewerSize) or
    723     (c.Built[imSewer] = 1));
     720  CanGrow := (C.Size < MaxCitySize) and (cGov <> gFuture) and
     721    (Report.FoodSurplus > 0) and ((C.Size < NeedAqueductSize) or
     722    (C.Built[imAqueduct] = 1) and (C.Size < NeedSewerSize) or
     723    (C.Built[imSewer] = 1));
    724724  FillBar(xFood + 3, yFood + 102, TrueFood,
    725     CutCityFoodSurplus(Report.FoodSurplus, IsCityAlive, cGov, c.Size),
     725    CutCityFoodSurplus(Report.FoodSurplus, IsCityAlive, cGov, C.Size),
    726726    Report.Storage, 1, CanGrow);
    727   LoweredTextout(offscreen.Canvas, -1, MainTexture, xFood + 3 - 5,
     727  LoweredTextout(Offscreen.Canvas, -1, MainTexture, xFood + 3 - 5,
    728728    yFood + 102 - 20, Format('%d/%d', [TrueFood, Report.Storage]));
    729   LoweredTextout(offscreen.Canvas, -1, MainTexture, xFood - 2, yFood + 66,
     729  LoweredTextout(Offscreen.Canvas, -1, MainTexture, xFood - 2, yFood + 66,
    730730    Phrases.Lookup('STORAGE'));
    731731
     
    733733  if IsCityAlive then
    734734  begin
    735     CountBar(offscreen, xProd, yProd, wBar, 2, Phrases.Lookup('MATERIAL'),
     735    CountBar(Offscreen, xProd, yProd, wBar, 2, Phrases.Lookup('MATERIAL'),
    736736      Report.CollectedMaterial, MainTexture);
    737     CountBar(offscreen, xProd + dxBar, yProd, wBar, 2,
     737    CountBar(Offscreen, xProd + dxBar, yProd, wBar, 2,
    738738      Phrases.Lookup('SUPPORT'), Report.MaterialSupport, MainTexture);
    739739    if Report.Production >= 0 then
    740       if c.Project and (cpImp + cpIndex) = cpImp + imTrGoods then
    741         CountBar(offscreen, xProd + dxBar, yProd + dyBar + 16, wBar, 6,
     740      if C.Project and (cpImp + cpIndex) = cpImp + imTrGoods then
     741        CountBar(Offscreen, xProd + dxBar, yProd + dyBar + 16, wBar, 6,
    742742          Phrases.Lookup('PROFIT'), Report.Production, MainTexture)
    743743      else
    744         CountBar(offscreen, xProd + dxBar, yProd + dyBar + 16, wBar, 2,
     744        CountBar(Offscreen, xProd + dxBar, yProd + dyBar + 16, wBar, 2,
    745745          Phrases.Lookup('PROD'), Report.Production, MainTexture)
    746746    else
    747747    begin
    748748      MakeRed(Offscreen, xProd + dxBar - 6, yProd + dyBar + 17, wBar + 10, 38);
    749       CountBar(offscreen, xProd + dxBar, yProd + dyBar + 16, wBar, 3,
     749      CountBar(Offscreen, xProd + dxBar, yProd + dyBar + 16, wBar, 3,
    750750        Phrases.Lookup('LACK'), -Report.Production, RedTex);
    751751    end;
    752752  end;
    753   if c.Project and (cpImp + cpIndex) <> cpImp + imTrGoods then
    754     with offscreen.Canvas do
    755     begin
    756       i := Report.Production;
    757       if (i < 0) or not IsCityAlive then
    758         i := 0;
    759       FillBar(xProd + 3, yProd + 16 + 63, TrueProd, i, PrCost, 4, true);
    760       LoweredTextout(offscreen.Canvas, -1, MainTexture, xProd + 3 - 5,
     753  if C.Project and (cpImp + cpIndex) <> cpImp + imTrGoods then
     754    with Offscreen.Canvas do
     755    begin
     756      I := Report.Production;
     757      if (I < 0) or not IsCityAlive then
     758        I := 0;
     759      FillBar(xProd + 3, yProd + 16 + 63, TrueProd, I, PrCost, 4, True);
     760      LoweredTextout(Offscreen.Canvas, -1, MainTexture, xProd + 3 - 5,
    761761        yProd + 16 + 43, Format('%d/%d', [TrueProd, PrCost]));
    762       if BiColorTextWidth(offscreen.Canvas, PrName) > wBar + dxBar then
     762      if BiColorTextWidth(Offscreen.Canvas, PrName) > wBar + dxBar then
    763763      begin
    764764        repeat
    765           Delete(PrName, length(PrName), 1)
    766         until BiColorTextWidth(offscreen.Canvas, PrName) <= wBar + dxBar;
     765          Delete(PrName, Length(PrName), 1)
     766        until BiColorTextWidth(Offscreen.Canvas, PrName) <= wBar + dxBar;
    767767        PrName := PrName + '.'
    768768      end;
    769769    end;
    770   RisedTextOut(offscreen.Canvas, xProd - 2, yProd + 36, PrName);
     770  RisedTextOut(Offscreen.Canvas, xProd - 2, yProd + 36, PrName);
    771771
    772772  // pollution section
     
    774774  begin
    775775    FillBar(xPoll + 3, yPoll + 20, TruePoll, Report.AddPollution,
    776       MaxPollution, 3, true);
    777     RisedTextOut(offscreen.Canvas, xPoll + 3 - 5, yPoll + 20 - 20,
     776      MaxPollution, 3, True);
     777    RisedTextOut(Offscreen.Canvas, xPoll + 3 - 5, yPoll + 20 - 20,
    778778      Phrases.Lookup('POLL'));
    779779  end;
     
    782782  if IsCityAlive and (Report.CollectedTrade > 0) then
    783783  begin
    784     CountBar(offscreen, xTrade, yTrade + dyBar div 2, wBar, 4,
     784    CountBar(Offscreen, xTrade, yTrade + dyBar div 2, wBar, 4,
    785785      Phrases.Lookup('TRADE'), Report.CollectedTrade, MainTexture);
    786     CountBar(offscreen, xTrade + dxBar, yTrade + 2 * dyBar, wBar, 5,
     786    CountBar(Offscreen, xTrade + dxBar, yTrade + 2 * dyBar, wBar, 5,
    787787      Phrases.Lookup('CORR'), Report.Corruption, MainTexture);
    788     CountBar(offscreen, xTrade + dxBar, yTrade, wBar, 6, Phrases.Lookup('TAX'),
     788    CountBar(Offscreen, xTrade + dxBar, yTrade, wBar, 6, Phrases.Lookup('TAX'),
    789789      Report.Tax, MainTexture);
    790     CountBar(offscreen, xTrade + dxBar, yTrade + dyBar, wBar, 12,
     790    CountBar(Offscreen, xTrade + dxBar, yTrade + dyBar, wBar, 12,
    791791      Phrases.Lookup('SCIENCE'), Report.Science, MainTexture);
    792792  end;
    793793
    794794  // small map
    795   BitBltCanvas(offscreen.Canvas, xSmallMap, ySmallMap, wSmallMap, hSmallMap,
     795  BitBltCanvas(Offscreen.Canvas, xSmallMap, ySmallMap, wSmallMap, hSmallMap,
    796796    SmallCityMap.Canvas, 0, 0);
    797797  if SmallMapMode = smImprovements then
    798     Frame(offscreen.Canvas, xSmallMap + 48 * (ZoomArea div 3),
     798    Frame(Offscreen.Canvas, xSmallMap + 48 * (ZoomArea div 3),
    799799      ySmallMap + 24 * (ZoomArea mod 3), xSmallMap + 48 * (ZoomArea div 3) + 49,
    800800      ySmallMap + 24 * (ZoomArea mod 3) + 25, MainTexture.ColorMark,
    801801      MainTexture.ColorMark);
    802   Frame(offscreen.Canvas, xSmallMap - 1, ySmallMap - 1, xSmallMap + wSmallMap,
     802  Frame(Offscreen.Canvas, xSmallMap - 1, ySmallMap - 1, xSmallMap + wSmallMap,
    803803    ySmallMap + hSmallMap, $B0B0B0, $FFFFFF);
    804   RFrame(offscreen.Canvas, xSmallMap - 2, ySmallMap - 2, xSmallMap + wSmallMap +
     804  RFrame(Offscreen.Canvas, xSmallMap - 2, ySmallMap - 2, xSmallMap + wSmallMap +
    805805    1, ySmallMap + hSmallMap + 1, $FFFFFF, $B0B0B0);
    806806
    807   Frame(offscreen.Canvas, xSupport - 1, ySupport - 1, xSupport + wSupport,
     807  Frame(Offscreen.Canvas, xSupport - 1, ySupport - 1, xSupport + wSupport,
    808808    ySupport + hSupport, $B0B0B0, $FFFFFF);
    809   RFrame(offscreen.Canvas, xSupport - 2, ySupport - 2, xSupport + wSupport + 1,
     809  RFrame(Offscreen.Canvas, xSupport - 2, ySupport - 2, xSupport + wSupport + 1,
    810810    ySupport + hSupport + 1, $FFFFFF, $B0B0B0);
    811   x := xSupport + wSupport div 2;
    812   y := ySupport + hSupport div 2;
     811  X := xSupport + wSupport div 2;
     812  Y := ySupport + hSupport div 2;
    813813  if SmallMapMode = smSupportedUnits then
    814814  begin
    815     offscreen.Canvas.brush.Color := MainTexture.ColorMark;
    816     offscreen.Canvas.FillRect(Rect(x - 27, y - 6, x + 27, y + 6));
    817     offscreen.Canvas.brush.style := bsClear;
    818   end;
    819   Sprite(offscreen, HGrSystem, x - 16, y - 5, 10, 10, 88, 115);
    820   Sprite(offscreen, HGrSystem, x - 5, y - 5, 10, 10, 66, 115);
    821   Sprite(offscreen, HGrSystem, x + 6, y - 5, 10, 10, 154, 126);
    822 
    823   BitBltCanvas(offscreen.Canvas, xZoomMap, yZoomMap, wZoomMap, hZoomMap,
     815    Offscreen.Canvas.Brush.Color := MainTexture.ColorMark;
     816    Offscreen.Canvas.FillRect(Rect(X - 27, Y - 6, X + 27, Y + 6));
     817    Offscreen.Canvas.Brush.style := bsClear;
     818  end;
     819  Sprite(Offscreen, HGrSystem, X - 16, Y - 5, 10, 10, 88, 115);
     820  Sprite(Offscreen, HGrSystem, X - 5, Y - 5, 10, 10, 66, 115);
     821  Sprite(Offscreen, HGrSystem, X + 6, Y - 5, 10, 10, 154, 126);
     822
     823  BitBltCanvas(Offscreen.Canvas, xZoomMap, yZoomMap, wZoomMap, hZoomMap,
    824824    ZoomCityMap.Canvas, 0, 0);
    825825
    826   for i := 0 to 5 do
    827     imix[i] := -1;
     826  for I := 0 to 5 do
     827    imix[I] := -1;
    828828  if SmallMapMode = smImprovements then
    829829  begin
     
    832832      Cnt := 0;
    833833      for iix := 0 to nImp - 1 do
    834         if ((iix < nWonder) or (ImpPosition[iix] < 0)) and (c.Built[iix] > 0) then
     834        if ((iix < nWonder) or (ImpPosition[iix] < 0)) and (C.Built[iix] > 0) then
    835835        begin
    836           i := Cnt - Page * 6;
    837           if (i >= 0) and (i < 6) then
    838             imix[i] := iix;
    839           inc(Cnt);
     836          I := Cnt - Page * 6;
     837          if (I >= 0) and (I < 6) then
     838            imix[I] := iix;
     839          Inc(Cnt);
    840840        end;
    841841      PageCount := (Cnt + 5) div 6;
     
    845845      for iix := nWonder to nImp - 1 do
    846846      begin
    847         i := ImpPosition[iix] - 6 * ZoomArea;
    848         if (i >= 0) and (i < 6) and (c.Built[iix] > 0) then
    849           imix[i] := iix;
     847        I := ImpPosition[iix] - 6 * ZoomArea;
     848        if (I >= 0) and (I < 6) and (C.Built[iix] > 0) then
     849          imix[I] := iix;
    850850      end;
    851851      PageCount := 0;
    852852    end;
    853     for i := 0 to 5 do
    854       if imix[i] >= 0 then
     853    for I := 0 to 5 do
     854      if imix[I] >= 0 then
    855855      begin
    856         iix := imix[i];
    857         x := xZoomMap + 14 + 72 * (i mod 3);
    858         y := yZoomMap + 14 + 56 * (i div 3);
    859         ImpImage(offscreen.Canvas, x, y, iix, cGov, AllowChange and
     856        iix := imix[I];
     857        X := xZoomMap + 14 + 72 * (I mod 3);
     858        Y := yZoomMap + 14 + 56 * (I div 3);
     859        ImpImage(Offscreen.Canvas, X, Y, iix, cGov, AllowChange and
    860860          (ClientMode < scContact));
    861861        if IsCityAlive then
     
    863863          if iix = imColosseum then
    864864          begin
    865             Sprite(offscreen, HGrSystem, x + 46, y, 14, 14, 82, 100);
     865            Sprite(Offscreen, HGrSystem, X + 46, Y, 14, 14, 82, 100);
    866866          end
    867867          else
     
    881881            if HappyGain > 1 then
    882882            begin
    883               d := 30 div (HappyGain - 1);
    884               if d > 10 then
    885                 d := 10
     883              D := 30 div (HappyGain - 1);
     884              if D > 10 then
     885                D := 10
    886886            end;
    887             for j := 0 to HappyGain - 1 do
    888               Sprite(offscreen, HGrSystem, x + 50, y + d * j, 10, 10, 132, 126);
     887            for J := 0 to HappyGain - 1 do
     888              Sprite(Offscreen, HGrSystem, X + 50, Y + D * J, 10, 10, 132, 126);
    889889          end;
    890           for j := 0 to Imp[iix].Maint - 1 do
    891             Sprite(offscreen, HGrSystem, x - 4, y + 29 - 3 * j, 10, 10,
     890          for J := 0 to Imp[iix].Maint - 1 do
     891            Sprite(Offscreen, HGrSystem, X - 4, Y + 29 - 3 * J, 10, 10,
    892892              132, 115);
    893893        end
     
    920920  else { if SmallMapMode = smSupportedUnits then }
    921921  begin
    922     LoweredTextout(offscreen.Canvas, -1, MainTexture, xZoomMap + 6,
     922    LoweredTextout(Offscreen.Canvas, -1, MainTexture, xZoomMap + 6,
    923923      yZoomMap + 2, Phrases.Lookup('SUPUNITS'));
    924     FreeSupp := c.Size * SupportFree[cGov] shr 1;
     924    FreeSupp := C.Size * SupportFree[cGov] shr 1;
    925925    Cnt := 0;
    926     for i := 0 to MyRO.nUn - 1 do
    927       if (MyUn[i].Loc >= 0) and (MyUn[i].Home = cix) then
    928         with MyModel[MyUn[i].mix] do
     926    for I := 0 to MyRO.nUn - 1 do
     927      if (MyUn[I].Loc >= 0) and (MyUn[I].Home = cix) then
     928        with MyModel[MyUn[I].mix] do
    929929        begin
    930           Server(sGetUnitReport, me, i, UnitReport);
     930          Server(sGetUnitReport, Me, I, UnitReport);
    931931          if (Cnt >= 6 * Page) and (Cnt < 6 * (Page + 1)) then
    932932          begin // unit visible in display
    933             imix[Cnt - 6 * Page] := i;
    934             x := ((Cnt - 6 * Page) mod 3) * 64 + xZoomMap;
    935             y := ((Cnt - 6 * Page) div 3) * 52 + yZoomMap + 20;
    936             MakeUnitInfo(me, MyUn[i], UnitInfo);
    937             NoMap.SetOutput(offscreen);
    938             NoMap.PaintUnit(x, y, UnitInfo, MyUn[i].Status);
    939 
    940             for j := 0 to UnitReport.FoodSupport - 1 do
    941               Sprite(offscreen, HGrSystem, x + 38 + 11 * j, y + 40, 10,
     933            imix[Cnt - 6 * Page] := I;
     934            X := ((Cnt - 6 * Page) mod 3) * 64 + xZoomMap;
     935            Y := ((Cnt - 6 * Page) div 3) * 52 + yZoomMap + 20;
     936            MakeUnitInfo(Me, MyUn[I], UnitInfo);
     937            NoMap.SetOutput(Offscreen);
     938            NoMap.PaintUnit(X, Y, UnitInfo, MyUn[I].Status);
     939
     940            for J := 0 to UnitReport.FoodSupport - 1 do
     941              Sprite(Offscreen, HGrSystem, X + 38 + 11 * J, Y + 40, 10,
    942942                10, 66, 115);
    943             for j := 0 to UnitReport.ProdSupport - 1 do
     943            for J := 0 to UnitReport.ProdSupport - 1 do
    944944            begin
    945945              if (FreeSupp > 0) and
    946946                (UnitReport.ReportFlags and urfAlwaysSupport = 0) then
    947947              begin
    948                 Sprite(offscreen, HGrSystem, x + 16 - 11 * j, y + 40, 10,
     948                Sprite(Offscreen, HGrSystem, X + 16 - 11 * J, Y + 40, 10,
    949949                  10, 143, 115);
    950                 dec(FreeSupp);
     950                Dec(FreeSupp);
    951951              end
    952952              else
    953                 Sprite(offscreen, HGrSystem, x + 16 - 11 * j, y + 40, 10,
     953                Sprite(Offscreen, HGrSystem, X + 16 - 11 * J, Y + 40, 10,
    954954                  10, 88, 115);
    955955            end;
    956956            if UnitReport.ReportFlags and urfDeployed <> 0 then
    957               for j := 0 to 1 do
    958                 Sprite(offscreen, HGrSystem, x + 27 + 11 * j, y + 40, 10,
     957              for J := 0 to 1 do
     958                Sprite(Offscreen, HGrSystem, X + 27 + 11 * J, Y + 40, 10,
    959959                  10, 154, 126)
    960960          end // unit visible in display
     
    977977  begin
    978978    { display project now }
    979     DLine(offscreen.Canvas, xView + 9 + xSizeBig, xProd + 2 * wBar + 10,
     979    DLine(Offscreen.Canvas, xView + 9 + xSizeBig, xProd + 2 * wBar + 10,
    980980      yProd + dyBar + 16, $FFFFFF, $B0B0B0);
    981981    if ProdHint then
    982982    begin
    983       ScreenTools.Frame(offscreen.Canvas, xView + 9 - 1, yView + 5 - 1,
     983      ScreenTools.Frame(Offscreen.Canvas, xView + 9 - 1, yView + 5 - 1,
    984984        xView + 9 + xSizeBig, yView + 5 + ySizeBig, $B0B0B0, $FFFFFF);
    985       RFrame(offscreen.Canvas, xView + 9 - 2, yView + 5 - 2,
     985      RFrame(Offscreen.Canvas, xView + 9 - 2, yView + 5 - 2,
    986986        xView + 9 + xSizeBig + 1, yView + 5 + ySizeBig + 1, $FFFFFF, $B0B0B0);
    987       with offscreen.Canvas do
     987      with Offscreen.Canvas do
    988988      begin
    989         brush.Color := $000000;
     989        Brush.Color := $000000;
    990990        FillRect(Rect(xView + 9, yView + 5, xView + 1 + 72 - 8,
    991991          yView + 5 + 40));
    992         brush.style := bsClear;
     992        Brush.style := bsClear;
    993993      end;
    994994    end
    995     else if AllowChange and (c.Status and 7 <> 0) then
     995    else if AllowChange and (C.Status and 7 <> 0) then
    996996    begin // city type autobuild
    997       FrameImage(offscreen.Canvas, bigimp, xView + 9, yView + 5, xSizeBig,
    998         ySizeBig, (c.Status and 7 - 1 + 3) * xSizeBig, 0, (cix >= 0) and
     997      FrameImage(Offscreen.Canvas, bigimp, xView + 9, yView + 5, xSizeBig,
     998        ySizeBig, (C.Status and 7 - 1 + 3) * xSizeBig, 0, (cix >= 0) and
    999999        (ClientMode < scContact));
    10001000    end
    1001     else if c.Project and cpImp = 0 then
     1001    else if C.Project and cpImp = 0 then
    10021002    begin // project is unit
    1003       FrameImage(offscreen.Canvas, bigimp, xView + 9, yView + 5, xSizeBig,
     1003      FrameImage(Offscreen.Canvas, bigimp, xView + 9, yView + 5, xSizeBig,
    10041004        ySizeBig, 0, 0, AllowChange and (ClientMode < scContact));
    1005       with Tribe[cOwner].ModelPicture[c.Project and cpIndex] do
    1006         Sprite(offscreen, HGr, xView + 5, yView + 1, 64, 44,
     1005      with Tribe[cOwner].ModelPicture[C.Project and cpIndex] do
     1006        Sprite(Offscreen, HGr, xView + 5, yView + 1, 64, 44,
    10071007          pix mod 10 * 65 + 1, pix div 10 * 49 + 1);
    10081008    end
     
    10101010    begin // project is building
    10111011      if ProdHint then
    1012         Paintiix := c.Project0 and cpIndex
     1012        Paintiix := C.Project0 and cpIndex
    10131013      else
    1014         Paintiix := c.Project and cpIndex;
    1015       ImpImage(offscreen.Canvas, xView + 9, yView + 5, Paintiix, cGov,
     1014        Paintiix := C.Project and cpIndex;
     1015      ImpImage(Offscreen.Canvas, xView + 9, yView + 5, Paintiix, cGov,
    10161016        AllowChange and (ClientMode < scContact));
    10171017    end;
     
    10201020  if AllowChange and (ClientMode < scContact) then
    10211021  begin
    1022     i := Server(sBuyCityProject - sExecute, me, cix, nil^);
    1023     BuyBtn.Visible := (i = eOk) or (i = eViolation);
     1022    I := Server(sBuyCityProject - sExecute, Me, cix, nil^);
     1023    BuyBtn.Visible := (I = eOk) or (I = eViolation);
    10241024  end
    10251025  else
    1026     BuyBtn.Visible := false;
     1026    BuyBtn.Visible := False;
    10271027
    10281028  MarkUsedOffscreen(ClientWidth, ClientHeight);
     
    10311031procedure TCityDlg.FormShow(Sender: TObject);
    10321032var
    1033   dx, dy, Loc1: integer;
     1033  dx, dy, Loc1: Integer;
    10341034  GetCityData: TGetCityData;
    10351035begin
     
    10371037  if cix >= 0 then
    10381038  begin { own city }
    1039     c := MyCity[cix];
    1040     cOwner := me;
     1039    C := MyCity[cix];
     1040    cOwner := Me;
    10411041    cGov := MyRO.Government;
    10421042    ProdHint := (cGov <> gAnarchy) and
    10431043      (Happened and (chProduction or chFounded or chCaptured or
    10441044      chAllImpsMade) <> 0);
    1045     Server(sGetCityAreaInfo, me, cix, CityAreaInfo);
     1045    Server(sGetCityAreaInfo, Me, cix, CityAreaInfo);
    10461046    NextCityBtn.Visible := WindowMode = wmPersistent;
    10471047    PrevCityBtn.Visible := WindowMode = wmPersistent;
     
    10501050  begin
    10511051    SmallMapMode := smImprovements;
    1052     Server(sGetCity, me, cLoc, GetCityData);
    1053     c := GetCityData.c;
     1052    Server(sGetCity, Me, cLoc, GetCityData);
     1053    C := GetCityData.C;
    10541054    cOwner := GetCityData.Owner;
    10551055    cGov := MyRO.EnemyReport[cOwner].Government;
    1056     Happened := c.Flags and $7FFFFFFF;
    1057     ProdHint := false;
    1058     Server(sGetEnemyCityAreaInfo, me, cLoc, CityAreaInfo);
    1059 
    1060     if c.Project and cpImp = 0 then
     1056    Happened := C.Flags and $7FFFFFFF;
     1057    ProdHint := False;
     1058    Server(sGetEnemyCityAreaInfo, Me, cLoc, CityAreaInfo);
     1059
     1060    if C.Project and cpImp = 0 then
    10611061    begin
    10621062      emix := MyRO.nEnemyModel - 1;
    10631063      while (emix > 0) and ((MyRO.EnemyModel[emix].Owner <> cOwner) or
    1064         (integer(MyRO.EnemyModel[emix].mix) <> c.Project and cpIndex)) do
    1065         dec(emix);
    1066       if not Assigned(Tribe[cOwner].ModelPicture[c.Project and cpIndex].HGr) then
     1064        (Integer(MyRO.EnemyModel[emix].mix) <> C.Project and cpIndex)) do
     1065        Dec(emix);
     1066      if not Assigned(Tribe[cOwner].ModelPicture[C.Project and cpIndex].HGr) then
    10671067        InitEnemyModel(emix);
    10681068    end;
     
    10731073  Page := 0;
    10741074
    1075   if c.Size < 5 then
     1075  if C.Size < 5 then
    10761076    SizeClass := 0
    1077   else if c.Size < 9 then
     1077  else if C.Size < 9 then
    10781078    SizeClass := 1
    1079   else if c.Size < 13 then
     1079  else if C.Size < 13 then
    10801080    SizeClass := 2
    10811081  else
     
    11001100  end;
    11011101
    1102   Caption := CityName(c.ID);
     1102  Caption := CityName(C.ID);
    11031103
    11041104  InitSmallCityMap;
     
    11091109end;
    11101110
    1111 procedure TCityDlg.ShowNewContent(NewMode: TWindowMode; Loc: integer; ShowEvent: cardinal);
     1111procedure TCityDlg.ShowNewContent(NewMode: TWindowMode; Loc: Integer; ShowEvent: Cardinal);
    11121112begin
    11131113  if MyMap[Loc] and fOwned <> 0 then
     
    11151115    cix := MyRO.nCity - 1;
    11161116    while (cix >= 0) and (MyCity[cix].Loc <> Loc) do
    1117       dec(cix);
    1118     assert(cix >= 0);
     1117      Dec(cix);
     1118    Assert(cix >= 0);
    11191119    if (Optimize_cixTileChange >= 0) and
    11201120      (Optimize_TilesBeforeChange and not MyCity[Optimize_cixTileChange].Tiles
     
    11321132  else
    11331133    cix := -1;
    1134   AllowChange := not supervising and (cix >= 0);
     1134  AllowChange := not Supervising and (cix >= 0);
    11351135  cLoc := Loc;
    11361136  Happened := ShowEvent;
     
    11391139
    11401140procedure TCityDlg.FormMouseDown(Sender: TObject; Button: TMouseButton;
    1141   Shift: TShiftState; x, y: integer);
     1141  Shift: TShiftState; X, Y: Integer);
    11421142var
    1143   i, qx, qy, dx, dy, fix, NewTiles, Loc1, iix, SellResult: integer;
    1144   Rebuild: boolean;
    1145 begin
    1146   if (ssLeft in Shift) and (x >= xSmallMap) and (x < xSmallMap + wSmallMap) and
    1147     (y >= ySmallMap) and (y < ySmallMap + hSmallMap) then
     1143  I, qx, qy, dx, dy, fix, NewTiles, Loc1, iix, SellResult: Integer;
     1144  Rebuild: Boolean;
     1145begin
     1146  if (ssLeft in Shift) and (X >= xSmallMap) and (X < xSmallMap + wSmallMap) and
     1147    (Y >= ySmallMap) and (Y < ySmallMap + hSmallMap) then
    11481148  begin
    11491149    SmallMapMode := smImprovements;
    1150     ZoomArea := (y - ySmallMap) * 3 div hSmallMap + 3 *
    1151       ((x - xSmallMap) * 2 div wSmallMap);
     1150    ZoomArea := (Y - ySmallMap) * 3 div hSmallMap + 3 *
     1151      ((X - xSmallMap) * 2 div wSmallMap);
    11521152    Page := 0;
    11531153    InitZoomCityMap;
     
    11551155    Exit;
    11561156  end;
    1157   if (ssLeft in Shift) and (x >= xSupport) and (x < xSupport + wSupport) and
    1158     (y >= ySupport) and (y < ySupport + hSupport) then
     1157  if (ssLeft in Shift) and (X >= xSupport) and (X < xSupport + wSupport) and
     1158    (Y >= ySupport) and (Y < ySupport + hSupport) then
    11591159  begin
    11601160    SmallMapMode := smSupportedUnits;
     
    11681168
    11691169  if (ssLeft in Shift) then
    1170     if (ClientMode < scContact) and (x >= xView) and (y >= yView) and
    1171       (x < xView + 73) and (y < yView + 50) then
     1170    if (ClientMode < scContact) and (X >= xView) and (Y >= yView) and
     1171      (X < xView + 73) and (Y < yView + 50) then
    11721172      if cGov = gAnarchy then
    11731173        with MessgExDlg do
    11741174        begin
    11751175          { MessgText:=Phrases.Lookup('OUTOFCONTROL');
    1176             if c.Project and cpImp=0 then
    1177             MessgText:=Format(MessgText,[Tribe[cOwner].ModelName[c.Project and cpIndex]])
    1178             else MessgText:=Format(MessgText,[Phrases.Lookup('IMPROVEMENTS',c.Project and cpIndex)]); }
     1176            if C.Project and cpImp=0 then
     1177            MessgText:=Format(MessgText,[Tribe[cOwner].ModelName[C.Project and cpIndex]])
     1178            else MessgText:=Format(MessgText,[Phrases.Lookup('IMPROVEMENTS',C.Project and cpIndex)]); }
    11791179          MessgText := Phrases.Lookup('NOCHANGEINANARCHY');
    11801180          Kind := mkOk;
     
    11851185        if ProdHint then
    11861186        begin
    1187           ProdHint := false;
     1187          ProdHint := False;
    11881188          SmartUpdateContent
    11891189        end;
    11901190        ChooseProject;
    11911191      end
    1192     else if (SmallMapMode = smImprovements) and (x >= xZoomMap) and (x < xZoomMap + wZoomMap) and
    1193       (y >= yZoomMap) and (y < yZoomMap + hZoomMap) then
    1194     begin
    1195       i := 5;
    1196       while (i >= 0) and not((x >= xZoomMap + 14 + 72 * (i mod 3)) and
    1197         (x < xZoomMap + 14 + 56 + 72 * (i mod 3)) and
    1198         (y >= yZoomMap + 14 + 56 * (i div 3)) and
    1199         (y < yZoomMap + 14 + 40 + 56 * (i div 3))) do
    1200         dec(i);
    1201       if i >= 0 then
     1192    else if (SmallMapMode = smImprovements) and (X >= xZoomMap) and (X < xZoomMap + wZoomMap) and
     1193      (Y >= yZoomMap) and (Y < yZoomMap + hZoomMap) then
     1194    begin
     1195      I := 5;
     1196      while (I >= 0) and not((X >= xZoomMap + 14 + 72 * (I mod 3)) and
     1197        (X < xZoomMap + 14 + 56 + 72 * (I mod 3)) and
     1198        (Y >= yZoomMap + 14 + 56 * (I div 3)) and
     1199        (Y < yZoomMap + 14 + 40 + 56 * (I div 3))) do
     1200        Dec(I);
     1201      if I >= 0 then
    12021202      begin
    1203         iix := imix[i];
     1203        iix := imix[I];
    12041204        if iix >= 0 then
    12051205          if ssShift in Shift then
     
    12211221              else
    12221222              begin
    1223                 SellResult := Server(sSellCityImprovement - sExecute, me,
     1223                SellResult := Server(sSellCityImprovement - sExecute, Me,
    12241224                  cix, iix);
    12251225                if SellResult < rExecuted then
     
    12361236                else
    12371237                begin
    1238                   if Server(sRebuildCityImprovement - sExecute, me, cix, iix) < rExecuted
     1238                  if Server(sRebuildCityImprovement - sExecute, Me, cix, iix) < rExecuted
    12391239                  then
    12401240                  begin // no rebuild possible, ask for sell only
    1241                     Rebuild := false;
     1241                    Rebuild := False;
    12421242                    MessgText := Phrases.Lookup('IMPROVEMENTS', iix);
    12431243                    if not Phrases2FallenBackToEnglish then
    12441244                      MessgText := Format(Phrases2.Lookup('SELL2'),
    12451245                        [MessgText, Imp[iix].Cost * BuildCostMod
    1246                         [G.Difficulty[me]] div 12])
     1246                        [G.Difficulty[Me]] div 12])
    12471247                    else
    12481248                      MessgText := Format(Phrases.Lookup('SELL'), [MessgText]);
    12491249                    if iix = imSpacePort then
    1250                       with MyRO.Ship[me] do
     1250                      with MyRO.Ship[Me] do
    12511251                        if Parts[0] + Parts[1] + Parts[2] > 0 then
    12521252                          MessgText := MessgText + ' ' +
     
    12591259                  else
    12601260                  begin
    1261                     Rebuild := true;
     1261                    Rebuild := True;
    12621262                    MessgText := Phrases.Lookup('IMPROVEMENTS', iix);
    12631263                    if not Phrases2FallenBackToEnglish then
    12641264                      MessgText := Format(Phrases2.Lookup('DISPOSE2'),
    12651265                        [MessgText, Imp[iix].Cost * BuildCostMod
    1266                         [G.Difficulty[me]] div 12 * 2 div 3])
     1266                        [G.Difficulty[Me]] div 12 * 2 div 3])
    12671267                    else
    12681268                      MessgText := Format(Phrases.Lookup('DISPOSE'),
    12691269                        [MessgText]);
    12701270                    if iix = imSpacePort then
    1271                       with MyRO.Ship[me] do
     1271                      with MyRO.Ship[Me] do
    12721272                        if Parts[0] + Parts[1] + Parts[2] > 0 then
    12731273                          MessgText := MessgText + ' ' +
     
    12831283                    begin
    12841284                      Play('CITY_REBUILDIMP');
    1285                       Server(sRebuildCityImprovement, me, cix, iix);
     1285                      Server(sRebuildCityImprovement, Me, cix, iix);
    12861286                    end
    12871287                    else
    12881288                    begin
    12891289                      Play('CITY_SELLIMP');
    1290                       Server(sSellCityImprovement, me, cix, iix);
     1290                      Server(sSellCityImprovement, Me, cix, iix);
    12911291                    end;
    12921292                    CityOptimizer_CityChange(cix);
     
    13011301      end;
    13021302    end
    1303     else if (SmallMapMode = smSupportedUnits) and (x >= xZoomMap) and (x < xZoomMap + wZoomMap) and
    1304       (y >= yZoomMap) and (y < yZoomMap + hZoomMap) then
    1305     begin
    1306       i := 5;
    1307       while (i >= 0) and not((x >= xZoomMap + 64 * (i mod 3)) and
    1308         (x < xZoomMap + 64 + 64 * (i mod 3)) and
    1309         (y >= yZoomMap + 20 + 48 * (i div 3)) and
    1310         (y < yZoomMap + 20 + 52 + 48 * (i div 3))) do
    1311         dec(i);
    1312       if (i >= 0) and (imix[i] >= 0) then
     1303    else if (SmallMapMode = smSupportedUnits) and (X >= xZoomMap) and (X < xZoomMap + wZoomMap) and
     1304      (Y >= yZoomMap) and (Y < yZoomMap + hZoomMap) then
     1305    begin
     1306      I := 5;
     1307      while (I >= 0) and not((X >= xZoomMap + 64 * (I mod 3)) and
     1308        (X < xZoomMap + 64 + 64 * (I mod 3)) and
     1309        (Y >= yZoomMap + 20 + 48 * (I div 3)) and
     1310        (Y < yZoomMap + 20 + 52 + 48 * (I div 3))) do
     1311        Dec(I);
     1312      if (I >= 0) and (imix[I] >= 0) then
    13131313        if ssShift in Shift then
    13141314        else if (cix >= 0) and (ClientMode < scContact) and
     
    13171317          CloseAction := None;
    13181318          Close;
    1319           MainScreen.CityClosed(imix[i], false, true);
     1319          MainScreen.CityClosed(imix[I], False, True);
    13201320        end;
    13211321    end
    1322     else if (x >= xmArea - 192) and (x < xmArea + 192) and (y >= ymArea - 96)
    1323       and (y < ymArea + 96) then
     1322    else if (X >= xmArea - 192) and (X < xmArea + 192) and (Y >= ymArea - 96)
     1323      and (Y < ymArea + 96) then
    13241324    with AreaMap do begin
    1325       qx := ((4000 * xxt * yyt) + (x - xmArea) * (yyt * 2) + (y - ymArea + yyt)
     1325      qx := ((4000 * xxt * yyt) + (X - xmArea) * (yyt * 2) + (Y - ymArea + yyt)
    13261326        * (xxt * 2)) div (xxt * yyt * 4) - 1000;
    1327       qy := ((4000 * xxt * yyt) + (y - ymArea + yyt) * (xxt * 2) - (x - xmArea)
     1327      qy := ((4000 * xxt * yyt) + (Y - ymArea + yyt) * (xxt * 2) - (X - xmArea)
    13281328        * (yyt * 2)) div (xxt * yyt * 4) - 1000;
    13291329      dx := qx - qy;
     
    13381338        end
    13391339        else if (ClientMode < scContact) and (cGov <> gAnarchy) and
    1340           (c.Flags and chCaptured = 0) then
     1340          (C.Flags and chCaptured = 0) then
    13411341        begin // toggle exploitation
    1342           assert(not supervising);
    1343           if c.Status and csResourceWeightsMask <> 0 then
     1342          Assert(not Supervising);
     1343          if C.Status and csResourceWeightsMask <> 0 then
    13441344          begin
    13451345            with MessgExDlg do
     
    13551355              MyCity[cix].Status := MyCity[cix].Status and
    13561356                not csResourceWeightsMask; // off
    1357               c.Status := MyCity[cix].Status;
     1357              C.Status := MyCity[cix].Status;
    13581358              SmartUpdateContent;
    13591359            end;
    1360             exit;
     1360            Exit;
    13611361          end;
    13621362          fix := (dy + 3) shl 2 + (dx + 3) shr 1;
    13631363          NewTiles := MyCity[cix].Tiles xor (1 shl fix);
    1364           if Server(sSetCityTiles, me, cix, NewTiles) >= rExecuted then
     1364          if Server(sSetCityTiles, Me, cix, NewTiles) >= rExecuted then
    13651365          begin
    13661366            SmartUpdateContent;
     
    13711371    end
    13721372    else if (ClientMode < scContact) and (cGov <> gAnarchy) and
    1373       (c.Flags and chCaptured = 0) and (x >= xmOpt - 32) and (x < xmOpt + 32)
    1374       and (y >= ymOpt - 32) and (y < ymOpt + 32) then
    1375     begin
    1376       i := sqr(x - xmOpt) + sqr(y - ymOpt); // click radius
    1377       if i <= 32 * 32 then
     1373      (C.Flags and chCaptured = 0) and (X >= xmOpt - 32) and (X < xmOpt + 32)
     1374      and (Y >= ymOpt - 32) and (Y < ymOpt + 32) then
     1375    begin
     1376      I := sqr(X - xmOpt) + sqr(Y - ymOpt); // click radius
     1377      if I <= 32 * 32 then
    13781378      begin
    1379         if i < 16 * 16 then // inner area clicked
    1380           if c.Status and csResourceWeightsMask <> 0 then
    1381             i := (c.Status shr 4 and $0F) mod 5 + 1 // rotate except off
     1379        if I < 16 * 16 then // inner area clicked
     1380          if C.Status and csResourceWeightsMask <> 0 then
     1381            I := (C.Status shr 4 and $0F) mod 5 + 1 // rotate except off
    13821382          else
    1383             i := 3 // rwGrowth
     1383            I := 3 // rwGrowth
    13841384        else
    1385           case trunc(arctan2(x - xmOpt, ymOpt - y) * 180 / pi) of
     1385          case trunc(arctan2(X - xmOpt, ymOpt - Y) * 180 / pi) of
    13861386            - 25 - 52 * 2 .. -26 - 52:
    1387               i := 1;
     1387              I := 1;
    13881388            -25 - 52 .. -26:
    1389               i := 2;
     1389              I := 2;
    13901390            -25 .. 25:
    1391               i := 3;
     1391              I := 3;
    13921392            26 .. 25 + 52:
    1393               i := 4;
     1393              I := 4;
    13941394            26 + 52 .. 25 + 52 * 2:
    1395               i := 5;
     1395              I := 5;
    13961396            180 - 26 .. 180, -180 .. -180 + 26:
    1397               i := 0;
     1397              I := 0;
    13981398          else
    1399             i := -1;
     1399            I := -1;
    14001400          end;
    1401         if i >= 0 then
     1401        if I >= 0 then
    14021402        begin
    1403           ChangeResourceWeights(i);
     1403          ChangeResourceWeights(I);
    14041404          SmartUpdateContent;
    14051405          if WindowMode <> wmModal then
     
    14231423  );
    14241424
    1425   function ProjectType(Project: integer): TProjectType;
     1425  function ProjectType(Project: Integer): TProjectType;
    14261426  begin
    14271427    if Project and cpCompleted <> 0 then
     
    14451445
    14461446var
    1447   NewProject, OldMoney, cix1: integer;
     1447  NewProject, OldMoney, cix1: Integer;
    14481448  pt0, pt1: TProjectType;
    1449   QueryOk: boolean;
    1450 begin
    1451   Assert(not supervising);
     1449  QueryOk: Boolean;
     1450begin
     1451  Assert(not Supervising);
    14521452  ModalSelectDlg.ShowNewContent_CityProject(wmModal, cix);
    1453   if ModalSelectDlg.result <> -1 then
    1454   begin
    1455     if ModalSelectDlg.result and cpType <> 0 then
     1453  if ModalSelectDlg.Result <> -1 then
     1454  begin
     1455    if ModalSelectDlg.Result and cpType <> 0 then
    14561456    begin
    14571457      MyCity[cix].Status := MyCity[cix].Status and not 7 or
    1458         (1 + ModalSelectDlg.result and cpIndex);
    1459       AutoBuild(cix, MyData.ImpOrder[ModalSelectDlg.result and cpIndex]);
     1458        (1 + ModalSelectDlg.Result and cpIndex);
     1459      AutoBuild(cix, MyData.ImpOrder[ModalSelectDlg.Result and cpIndex]);
    14601460    end
    14611461    else
     
    15221522        then
    15231523          NewProject := NewProject or cpDisbandCity;
    1524       Server(sSetCityProject, me, cix, NewProject);
    1525       c.Project := MyCity[cix].Project;
     1524      Server(sSetCityProject, Me, cix, NewProject);
     1525      C.Project := MyCity[cix].Project;
    15261526      if MyRO.Money > OldMoney then
    15271527        Play('CITY_SELLIMP');
     
    15381538procedure TCityDlg.BuyClick(Sender: TObject);
    15391539var
    1540   NextProd, Cost: integer;
     1540  NextProd, Cost: Integer;
    15411541begin
    15421542  if (cix < 0) or (ClientMode >= scContact) then
    1543     exit;
     1543    Exit;
    15441544  with MyCity[cix], MessgExDlg do
    15451545  begin
     
    15491549      NextProd := 0;
    15501550    Cost := Cost - Prod - NextProd;
    1551     if (MyRO.Wonder[woMich].EffectiveOwner = me) and (Project and cpImp <> 0)
     1551    if (MyRO.Wonder[woMich].EffectiveOwner = Me) and (Project and cpImp <> 0)
    15521552    then
    15531553      Cost := Cost * 2
     
    15731573    if (Kind = mkYesNo) and (ModalResult = mrOK) then
    15741574    begin
    1575       if Server(sBuyCityProject, me, cix, nil^) >= rExecuted then
     1575      if Server(sBuyCityProject, Me, cix, nil^) >= rExecuted then
    15761576      begin
    15771577        Play('CITY_BUYPROJECT');
     
    16331633    else if BlinkTime = 6 then
    16341634    begin
    1635       if AllowChange and (c.Status and 7 <> 0) then
     1635      if AllowChange and (C.Status and 7 <> 0) then
    16361636      begin // city type autobuild
    16371637        FrameImage(Canvas, bigimp, xView + 9, yView + 5, xSizeBig, ySizeBig,
    1638           (c.Status and 7 - 1 + 3) * xSizeBig, 0, true);
     1638          (C.Status and 7 - 1 + 3) * xSizeBig, 0, True);
    16391639      end
    1640       else if c.Project and cpImp = 0 then
     1640      else if C.Project and cpImp = 0 then
    16411641      begin // project is unit
    16421642        BitBltCanvas(Canvas, xView + 9, yView + 5, xSizeBig, ySizeBig,
    16431643          Bigimp.Canvas, 0, 0);
    1644         with Tribe[cOwner].ModelPicture[c.Project and cpIndex] do
     1644        with Tribe[cOwner].ModelPicture[C.Project and cpIndex] do
    16451645          Sprite(Canvas, HGr, xView + 5, yView + 1, 64, 44, pix mod 10 * 65 + 1,
    16461646            pix div 10 * 49 + 1);
    16471647      end
    16481648      else
    1649         ImpImage(Canvas, xView + 9, yView + 5, c.Project0 and cpIndex,
    1650           cGov, true);
     1649        ImpImage(Canvas, xView + 9, yView + 5, C.Project0 and cpIndex,
     1650          cGov, True);
    16511651    end;
    16521652  end;
     
    16641664  if 1 shl OpenSoundEvent = chProduction then
    16651665  begin
    1666     if c.Project0 and cpImp <> 0 then
    1667     begin
    1668       if c.Project0 and cpIndex >= 28 then
     1666    if C.Project0 and cpImp <> 0 then
     1667    begin
     1668      if C.Project0 and cpIndex >= 28 then
    16691669      // wonders have already extra message with sound
    1670         if Imp[c.Project0 and cpIndex].Kind = ikShipPart then
     1670        if Imp[C.Project0 and cpIndex].Kind = ikShipPart then
    16711671          Play('SHIP_BUILT')
    16721672        else
     
    16821682end;
    16831683
    1684 function Prio(iix: integer): integer;
     1684function Prio(iix: Integer): Integer;
    16851685begin
    16861686  case Imp[iix].Kind of
    16871687    ikWonder:
    1688       result := iix + 10000;
     1688      Result := iix + 10000;
    16891689    ikNatLocal, ikNatGlobal:
    16901690      case iix of
    16911691        imPalace:
    1692           result := 0;
     1692          Result := 0;
    16931693      else
    1694         result := iix + 20000;
     1694        Result := iix + 20000;
    16951695      end;
    16961696  else
    16971697    case iix of
    16981698      imTownHall, imCourt:
    1699         result := iix + 30000;
     1699        Result := iix + 30000;
    17001700      imAqueduct, imSewer:
    1701         result := iix + 40000;
     1701        Result := iix + 40000;
    17021702      imTemple, imTheater, imCathedral:
    1703         result := iix + 50000;
    1704     else
    1705       result := iix + 90000;
     1703        Result := iix + 50000;
     1704    else
     1705      Result := iix + 90000;
    17061706    end;
    17071707  end;
     
    17181718end;
    17191719
    1720 procedure TCityDlg.ChangeCity(d: integer);
     1720procedure TCityDlg.ChangeCity(D: Integer);
    17211721var
    1722   cixNew: integer;
     1722  cixNew: Integer;
    17231723begin
    17241724  cixNew := cix;
    17251725  repeat
    1726     cixNew := (cixNew + MyRO.nCity + d) mod MyRO.nCity;
     1726    cixNew := (cixNew + MyRO.nCity + D) mod MyRO.nCity;
    17271727  until (MyCity[cixNew].Loc >= 0) or (cixNew = cix);
    17281728  if cixNew <> cix then
     
    17661766end;
    17671767
    1768 procedure TCityDlg.ChangeResourceWeights(iResourceWeights: integer);
     1768procedure TCityDlg.ChangeResourceWeights(iResourceWeights: Integer);
    17691769var
    17701770  Advice: TCityTileAdviceData;
    17711771begin
    1772   assert(not supervising);
    1773   assert(cix >= 0);
     1772  Assert(not Supervising);
     1773  Assert(cix >= 0);
    17741774  MyCity[cix].Status := MyCity[cix].Status and not csResourceWeightsMask or
    17751775    (iResourceWeights shl 4);
    1776   c.Status := MyCity[cix].Status;
     1776  C.Status := MyCity[cix].Status;
    17771777  if iResourceWeights > 0 then
    17781778  begin
    17791779    Advice.ResourceWeights := OfferedResourceWeights[iResourceWeights];
    1780     Server(sGetCityTileAdvice, me, cix, Advice);
     1780    Server(sGetCityTileAdvice, Me, cix, Advice);
    17811781    if Advice.Tiles <> MyCity[cix].Tiles then
    1782       Server(sSetCityTiles, me, cix, Advice.Tiles);
     1782      Server(sSetCityTiles, Me, cix, Advice.Tiles);
    17831783  end;
    17841784end;
     
    17861786procedure SortImprovements;
    17871787var
    1788   i, j, k: integer;
    1789 begin
    1790   for i := 0 to nImp - 1 do
    1791     ImpSorted[i] := i;
    1792   for i := 0 to nImp - 2 do
    1793     for j := i + 1 to nImp - 1 do
    1794       if Prio(ImpSorted[i]) > Prio(ImpSorted[j]) then begin
    1795         k := ImpSorted[i];
    1796         ImpSorted[i] := ImpSorted[j];
    1797         ImpSorted[j] := k;
     1788  I, J, K: Integer;
     1789begin
     1790  for I := 0 to nImp - 1 do
     1791    ImpSorted[I] := I;
     1792  for I := 0 to nImp - 2 do
     1793    for J := I + 1 to nImp - 1 do
     1794      if Prio(ImpSorted[I]) > Prio(ImpSorted[J]) then begin
     1795        K := ImpSorted[I];
     1796        ImpSorted[I] := ImpSorted[J];
     1797        ImpSorted[J] := K;
    17981798      end;
    17991799end;
Note: See TracChangeset for help on using the changeset viewer.