Changeset 590 for trunk/Database.pas


Ignore:
Timestamp:
Jul 24, 2024, 10:25:56 PM (8 weeks ago)
Author:
chronos
Message:
  • Modified: Map load and save moved to separate class TMap.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Database.pas

    r558 r590  
    77
    88uses
    9   SysUtils, Protocol, CmdList;
     9  SysUtils, Protocol, CmdList, Map;
    1010
    1111const
     
    120120function MapGeneratorAvailable: Boolean;
    121121procedure CreateElevation;
    122 procedure CreateMap(preview: Boolean);
     122procedure CreateMap(Preview: Boolean);
    123123procedure InitMapEditor;
    124124procedure ReleaseMapEditor;
     
    970970end;
    971971
    972 procedure CreateMap(preview: Boolean);
     972procedure CreateMap(Preview: Boolean);
    973973const
    974974  ShHiHills = 6; { of land }
     
    10891089
    10901090var
    1091   X, Y, N, Dir, plus, Count, Loc0, Loc1, bLand, bHills, bMountains, V8: Integer;
     1091  X, Y, N, Dir, Plus, Count, Loc0, Loc1, bLand, bHills, bMountains, V8: Integer;
    10921092  CopyFrom: array [0 .. lxmax * lymax - 1] of Integer;
    10931093  Adjacent: TVicinity8Loc;
     
    10951095begin
    10961096  FillChar(RealMap, MapSize * SizeOf(Cardinal), 0);
    1097   plus := 0;
     1097  Plus := 0;
    10981098  bMountains := 256;
    1099   while plus < MapSize * LandMass * ShMountains div 10000 do
     1099  while Plus < MapSize * LandMass * ShMountains div 10000 do
    11001100  begin
    11011101    Dec(bMountains);
    1102     Inc(plus, ElCount[bMountains]);
    1103   end;
    1104   Count := plus;
    1105   plus := 0;
     1102    Inc(Plus, ElCount[bMountains]);
     1103  end;
     1104  Count := Plus;
     1105  Plus := 0;
    11061106  bHills := bMountains;
    1107   while plus < MapSize * LandMass * ShHiHills div 10000 do
     1107  while Plus < MapSize * LandMass * ShHiHills div 10000 do
    11081108  begin
    11091109    Dec(bHills);
    1110     Inc(plus, ElCount[bHills]);
    1111   end;
    1112   Inc(Count, plus);
     1110    Inc(Plus, ElCount[bHills]);
     1111  end;
     1112  Inc(Count, Plus);
    11131113  bLand := bHills;
    11141114  while Count < MapSize * LandMass div 100 do
     
    11441144    end;
    11451145
    1146   if not preview then
    1147   begin
    1148     plus := 36 * 56 * 20 * ShTestRiver div (LandMass * 100);
    1149     if plus > MapSize then
    1150       plus := MapSize;
     1146  if not Preview then
     1147  begin
     1148    Plus := 36 * 56 * 20 * ShTestRiver div (LandMass * 100);
     1149    if Plus > MapSize then
     1150      Plus := MapSize;
    11511151    Loc0 := DelphiRandom(MapSize);
    1152     for N := 0 to plus - 1 do
     1152    for N := 0 to Plus - 1 do
    11531153    begin
    11541154      if (RealMap[Loc0] and fTerrain >= fGrass) and (Loc0 >= lx) and
     
    12671267      ($F shl 27);
    12681268
    1269   if not preview then
     1269  if not Preview then
    12701270  begin
    12711271    FindContinents;
     
    19411941// cix=-2 - don't search city, don't calculate city benefits, just government of player p
    19421942var
    1943   p0, Tile, special: Integer;
     1943  p0, Tile, Special: Integer;
    19441944begin
    19451945  with Info do
     
    19711971    end; // no city found here
    19721972
    1973     special := Tile and fSpecial and ResourceMask[P] shr 5;
     1973    Special := Tile and fSpecial and ResourceMask[P] shr 5;
    19741974    with Terrain[Tile and fTerrain] do
    19751975    begin
    1976       Food := FoodRes[special];
    1977       Prod := ProdRes[special];
    1978       Trade := TradeRes[special];
    1979       if (special > 0) and (Tile and fTerrain <> fGrass) and
     1976      Food := FoodRes[Special];
     1977      Prod := ProdRes[Special];
     1978      Trade := TradeRes[Special];
     1979      if (Special > 0) and (Tile and fTerrain <> fGrass) and
    19801980        (RW[P].NatBuilt[imSpacePort] > 0) then
    19811981      begin // GeoSat effect
Note: See TracChangeset for help on using the changeset viewer.