Changeset 328 for trunk/Database.pas


Ignore:
Timestamp:
Mar 25, 2021, 3:02:29 PM (3 years ago)
Author:
chronos
Message:
  • Modified: Use nWonder constant as number of wonders instead of numeric value.
  • Modified: Code cleanup.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Database.pas

    r319 r328  
    4949  GTestFlags: Integer;
    5050  Mode: TGameMode;
    51   GWonder: array [0 .. 27] of TWonderInfo;
     51  GWonder: array [0 .. nWonder - 1] of TWonderInfo;
    5252  ServerVersion: array [0 .. nPl - 1] of integer;
    5353  ProcessClientData: array [0 .. nPl - 1] of boolean;
     
    452452    ResourceMask[p] := ResourceMask[p] or fModern;
    453453
    454   for i := 0 to 27 do { check whether wonders expired }
     454  for i := 0 to nWonder - 1 do { check whether wonders expired }
    455455    if (GWonder[i].EffectiveOwner <> GWonder[woEiffel].EffectiveOwner) and
    456456      (Imp[i].Expiration = ad) then
     
    31493149  i, j, uix1, cix1, nearest: integer;
    31503150begin
    3151   for i := 0 to 27 do
     3151  for i := 0 to nWonder - 1 do
    31523152    if RW[p].City[cix].Built[i] = 1 then
    31533153    begin
     
    31563156        FreeSlaves;
    31573157      if i = woEiffel then // deactivate expired wonders
    3158         for j := 0 to 27 do
     3158        for j := 0 to nWonder - 1 do
    31593159          if GWonder[j].EffectiveOwner = p then
    31603160            CheckExpiration(j);
    31613161    end;
    3162   for i := 28 to nImp - 1 do
     3162  for i := nWonder to nImp - 1 do
    31633163    if (Imp[i].Kind <> ikCommon) and (RW[p].City[cix].Built[i] > 0) then
    31643164    begin { destroy national projects }
     
    31913191begin
    31923192  StealCity(p, cix, SaveUnits);
    3193   with RW[p].City[cix] do
    3194   begin
    3195     for i := 0 to 27 do
     3193  with RW[p].City[cix] do begin
     3194    for i := 0 to nWonder - 1 do
    31963195      if Built[i] > 0 then
    31973196        GWonder[i].CityID := WonderDestroyed;
     
    32433242    Built[imTownHall] := 0;
    32443243    Built[imCourt] := 0;
    3245     for i := 28 to nImp - 1 do
     3244    for i := nWonder to nImp - 1 do
    32463245      if Imp[i].Kind <> ikCommon then
    32473246        Built[i] := 0; { destroy national projects }
    3248     for i := 0 to 27 do
     3247    for i := 0 to nWonder - 1 do
    32493248      if Built[i] = 1 then
    32503249      begin // new wonder owner!
     
    32523251        if i = woEiffel then // reactivate expired wonders
    32533252        begin
    3254           for j := 0 to 27 do
     3253          for j := 0 to nWonder - 1 do
    32553254            if Imp[j].Expiration >= 0 then
    32563255              for cix1 := 0 to (RW[pNew].nCity - 1) do
    32573256                if RW[pNew].City[cix1].Built[j] = 1 then
    3258                   GWonder[j].EffectiveOwner := pNew
     3257                  GWonder[j].EffectiveOwner := pNew;
    32593258        end
    32603259        else
Note: See TracChangeset for help on using the changeset viewer.