Ignore:
Timestamp:
Jan 12, 2026, 11:29:21 AM (12 hours ago)
Author:
chronos
Message:
  • Fixed: Map objects not drawn beyond city radius in city dialog if fractional scaling active.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/IsoEngine.pas

    r715 r719  
    7777    procedure PaintTileExtraTerrain(X, Y, Loc: Integer);
    7878    procedure PaintTileObjects(nx, ny, X, Y, Loc, CityLoc, CityOwner: Integer;
    79       UseBlink: Boolean);
    80     procedure PaintTileObjectsRadius(nx, ny, X, Y, Loc, CityLoc, CityOwner: Integer;
    81       UseBlink: Boolean; Radius: Integer; Inside: Boolean);
     79      UseBlink: Boolean; Radius: Integer = -1; Inside: Boolean = False);
    8280    procedure PaintTileObjects1(X, Y, Loc, CityLoc, CityOwner: Integer;
    8381      UseBlink: Boolean);
     
    11821180end;
    11831181
    1184 procedure TIsoMap.PaintTileObjects(nx, ny, X, Y, Loc, CityLoc, CityOwner: Integer;
    1185   UseBlink: Boolean);
     1182procedure TIsoMap.PaintTileObjects(nx, ny, X, Y, Loc, CityLoc,
     1183  CityOwner: Integer; UseBlink: Boolean; Radius: Integer = -1; Inside: Boolean = False);
    11861184var
    11871185  dx, dy: Integer;
     1186  ALoc: Integer;
    11881187begin
    11891188  for dy := -2 to ny + 1 do
    11901189    for dx := -2 to nx + 1 do
    1191       if (dx + dy) and 1 = 0 then
    1192         PaintTileObjects1(X + xxt * dx, Y + yyt + yyt * dy, dLoc(Loc, dx, dy),
    1193           CityLoc, CityOwner, UseBlink);
    1194 
    1195   for dy := -2 to ny + 1 do
    1196     for dx := -2 to nx + 1 do
    1197       if (dx + dy) and 1 = 0 then
    1198         PaintTileObjects2(X + xxt * dx, Y + yyt + yyt * dy, dLoc(Loc, dx, dy),
    1199           CityLoc, CityOwner, UseBlink);
    1200 
    1201   for dy := -2 to ny + 1 do
    1202     for dx := -2 to nx + 1 do
    1203       if (dx + dy) and 1 = 0 then
    1204         PaintTileObjects3(X + xxt * dx, Y + yyt + yyt * dy, dLoc(Loc, dx, dy),
    1205           CityLoc, CityOwner, UseBlink);
    1206 end;
    1207 
    1208 procedure TIsoMap.PaintTileObjectsRadius(nx, ny, X, Y, Loc, CityLoc,
    1209   CityOwner: Integer; UseBlink: Boolean; Radius: Integer; Inside: Boolean);
    1210 var
    1211   dx, dy: Integer;
    1212   ALoc: Integer;
    1213 begin
    1214   for dy := -2 to ny + 1 do
    1215     for dx := -2 to nx + 1 do
    1216       if (dx + dy) and 1 = 0 then
    1217       begin
     1190      if (dx + dy) and 1 = 0 then begin
    12181191        ALoc := dLoc(Loc, dx, dy);
    1219         if (Inside and (Distance(ALoc, CityLoc) <= 5)) or
    1220           (not Inside and (Distance(ALoc, CityLoc) > 5)) then
     1192        if (Radius < 0) or
     1193          (Inside and (Distance(ALoc, CityLoc) <= Radius)) or
     1194          (not Inside and (Distance(ALoc, CityLoc) > Radius)) then
    12211195          PaintTileObjects1(X + xxt * dx, Y + yyt + yyt * dy, ALoc, CityLoc,
    12221196            CityOwner, UseBlink);
     
    12251199  for dy := -2 to ny + 1 do
    12261200    for dx := -2 to nx + 1 do
    1227       if (dx + dy) and 1 = 0 then
    1228       begin
     1201      if (dx + dy) and 1 = 0 then begin
    12291202        ALoc := dLoc(Loc, dx, dy);
    1230         if (Inside and (Distance(ALoc, CityLoc) <= 5)) or
    1231           (not Inside and (Distance(ALoc, CityLoc) > 5)) then
     1203        if (Radius < 0) or
     1204          (Inside and (Distance(ALoc, CityLoc) <= Radius)) or
     1205          (not Inside and (Distance(ALoc, CityLoc) > Radius)) then
    12321206          PaintTileObjects2(X + xxt * dx, Y + yyt + yyt * dy, ALoc, CityLoc,
    12331207            CityOwner, UseBlink);
    12341208      end;
    12351209
     1210  if Radius >= 0 then UnshareBitmap(FOutput);
     1211
    12361212  for dy := -2 to ny + 1 do
    12371213    for dx := -2 to nx + 1 do
    1238       if (dx + dy) and 1 = 0 then
    1239       begin
     1214      if (dx + dy) and 1 = 0 then begin
    12401215        ALoc := dLoc(Loc, dx, dy);
    1241         if (Inside and (Distance(ALoc, CityLoc) <= 5)) or
    1242           (not Inside and (Distance(ALoc, CityLoc) > 5)) then
     1216        if (Radius < 0) or
     1217          (Inside and (Distance(ALoc, CityLoc) <= Radius)) or
     1218          (not Inside and (Distance(ALoc, CityLoc) > Radius)) then
    12431219          PaintTileObjects3(X + xxt * dx, Y + yyt + yyt * dy, ALoc, CityLoc,
    12441220            CityOwner, UseBlink);
     
    14031379
    14041380  if moEditMode in MapOptions then
    1405      Fog := (Loc < 0) or (Loc >= G.lx * G.ly)
    1406      // else if CityLoc >= 0 then
    1407      // Fog:= (Loc < 0) or (Loc >= G.lx * G.ly) or (Distance(Loc, CityLoc) > 5)
    1408    else if ShowGrWall then
    1409      Fog := Tile and fGrWall = 0
    1410    else
    1411      Fog := FogOfWar and (Tile and fObserved = 0);
    1412    if Fog and ShowObjects then
    1413      if Loc < -G.lx then
    1414        Sprite(HGrTerrain, X, Y + yyt, xxt * 2, yyt, 1 + 6 * (xxt * 2 + 1),
    1415          1 + yyt * 2 + 15 * (yyt * 3 + 1))
    1416      else if Loc >= G.lx * (G.ly + 1) then
    1417        Sprite(HGrTerrain, X, Y, xxt * 2, yyt, 1 + 6 * (xxt * 2 + 1),
    1418          1 + yyt + 15 * (yyt * 3 + 1))
    1419      else begin
    1420        TerrainSprite(X, Y, spGrid, xxt <> 33, True);
    1421      end;
     1381    Fog := (Loc < 0) or (Loc >= G.lx * G.ly)
     1382    // else if CityLoc >= 0 then
     1383    // Fog := (Loc < 0) or (Loc >= G.lx * G.ly) or (Distance(Loc, CityLoc) > 5)
     1384  else if ShowGrWall then
     1385    Fog := Tile and fGrWall = 0
     1386  else
     1387    Fog := FogOfWar and (Tile and fObserved = 0);
     1388
     1389  if Fog and ShowObjects then begin
     1390    if Loc < -G.lx then
     1391      Sprite(HGrTerrain, X, Y + yyt, xxt * 2, yyt, 1 + 6 * (xxt * 2 + 1),
     1392        1 + yyt * 2 + 15 * (yyt * 3 + 1))
     1393    else if Loc >= G.lx * (G.ly + 1) then
     1394      Sprite(HGrTerrain, X, Y, xxt * 2, yyt, 1 + 6 * (xxt * 2 + 1),
     1395        1 + yyt + 15 * (yyt * 3 + 1))
     1396    else begin
     1397      TerrainSprite(X, Y, spGrid, xxt <> 33, True);
     1398    end;
     1399  end;
    14221400end;
    14231401
     
    15121490    else if Tile and fStealthUnit <> 0 then
    15131491      Sprite(HGrStdUnits, X + (xxt - xxu), Y + (yyt - yyu_anchor), xxu * 2,
    1514         yyu * 2, 1 + 5 * (xxu * 2 + 1), 1 + 1 * (yyu * 2 + 1))
     1492        yyu * 2, 1 + 5 * (xxu * 2 + 1), 1 + 1 * (yyu * 2 + 1));
    15151493  end;
    15161494
     
    15241502      (Loc < G.lx * G.ly) and (DebugMap[Loc] <> 0) then
    15251503      TextOut(X + xxt - 16, Y + yyt - 9, $00E0FF,
    1526         IntToStr(Integer(DebugMap[Loc])))
     1504        IntToStr(Integer(DebugMap[Loc])));
    15271505end;
    15281506
     
    17511729  if CityOwner >= 0 then begin
    17521730    // Paint objects outside radius
    1753     PaintTileObjectsRadius(nx, ny, X, Y, Loc, CityLoc, CityOwner, UseBlink, 5, False);
     1731    PaintTileObjects(nx, ny, X, Y, Loc, CityLoc, CityOwner, UseBlink, 5, False);
    17541732
    17551733    dx := ((CityLoc mod G.lx * 2 + CityLoc div G.lx and 1) -
     
    17631741
    17641742    // Paint objects inside radius
    1765     PaintTileObjectsRadius(nx, ny, X, Y, Loc, CityLoc, CityOwner, UseBlink, 5, True);
     1743    PaintTileObjects(nx, ny, X, Y, Loc, CityLoc, CityOwner, UseBlink, 5, True);
    17661744  end else begin
    17671745    if ShowLoc or (moEditMode in MapOptions) or (moGrid in MapOptions) then
Note: See TracChangeset for help on using the changeset viewer.