Changeset 10 for trunk/Database.pas


Ignore:
Timestamp:
Jan 7, 2017, 2:33:20 PM (8 years ago)
Author:
chronos
Message:
  • Modified: Created CevoComponents ackage for installable custom components.
  • Fixed: Compile time range check error.
  • Added: Heaptrace check and fixed some memory leaks.
  • Fixed: MaskD function.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Database.pas

    r9 r10  
    7979  TVicinity21Loc = array [0 .. 27] of integer;
    8080
    81 procedure MaskD(var x; Count, Mask: Cardinal);
     81procedure MaskD(var x: array of Cardinal; Count, Mask: Cardinal);
    8282procedure IntServer(Command, Player, Subject: integer; var Data);
    8383procedure CompactLists(p: integer);
     
    171171  UnBuilt: array [0 .. nPl - 1] of integer; { number of units built }
    172172
    173 procedure MaskD(var x; Count, Mask: Cardinal);
    174 begin
    175 { TODO
    176   sub eax,4
    177 @r: and [eax+edx*4],ecx
    178   dec edx
    179   jnz @r
    180   }
     173procedure MaskD(var x: array of Cardinal; Count, Mask: Cardinal);
     174var
     175  I: Integer;
     176begin
     177  for I := 0 to Count - 1 do
     178    x[I] := x[I] and Mask;
    181179end;
    182180
     
    16591657    RealMap[Loc1]:=RealMap[Loc1] or fPoll; }
    16601658
    1661   FillChar(Occupant, MapSize, -1);
     1659  FillChar(Occupant, MapSize, Byte(-1));
    16621660  FillChar(ZoCMap, MapSize, 0);
    16631661  FillChar(ObserveLevel, MapSize * 4, 0);
    1664   FillChar(UsedByCity, MapSize * 4, -1);
     1662  FillChar(UsedByCity, MapSize * 4, Byte(-1));
    16651663  GTestFlags := 0;
    16661664  GInitialized := GAlive or GWatching;
     
    16811679        GetMem(Map, 4 * MapSize);
    16821680        GetMem(MapObservedLast, 2 * MapSize);
    1683         FillChar(MapObservedLast^, 2 * MapSize, -1);
     1681        FillChar(MapObservedLast^, 2 * MapSize, Byte(-1));
    16841682        GetMem(Territory, MapSize);
    16851683        FillChar(Territory^, MapSize, $FF);
     
    17081706            GetMem(EnemyReport[p1], SizeOf(TEnemyReport) - 2 *
    17091707              (INFIN + 1 - nmmax));
    1710             FillChar(EnemyReport[p1].Tech, nAdv, tsNA);
     1708            FillChar(EnemyReport[p1].Tech, nAdv, Byte(tsNA));
    17111709            EnemyReport[p1].TurnOfContact := -1;
    17121710            EnemyReport[p1].TurnOfCivilReport := -1;
     
    17311729        for Loc1 := 0 to MapSize - 1 do
    17321730          Map[Loc1] := fUNKNOWN;
    1733         FillChar(Tech, nAdv, tsNA);
     1731        FillChar(Tech, nAdv, Byte(tsNA));
    17341732        FillChar(NatBuilt, SizeOf(NatBuilt), 0);
    17351733      end;
     
    18201818begin
    18211819  CalculatePrimitive;
    1822   FillChar(Occupant, MapSize, -1);
     1820  FillChar(Occupant, MapSize, Byte(-1));
    18231821  FillChar(ObserveLevel, MapSize * 4, 0);
    18241822  with RW[0] do
     
    18271825    GetMem(Map, 4 * MapSize);
    18281826    GetMem(MapObservedLast, 2 * MapSize);
    1829     FillChar(MapObservedLast^, 2 * MapSize, -1);
     1827    FillChar(MapObservedLast^, 2 * MapSize, Byte(-1));
    18301828    GetMem(Territory, MapSize);
    18311829    FillChar(Territory^, MapSize, $FF);
     
    26932691  if Mode = moLoading_Fast then
    26942692    exit;
    2695   MaskD(RW[p].Map^, MapSize, not Cardinal(fInEnemyZoC));
     2693  MaskD(RW[p].Map^, MapSize, Cardinal(not Cardinal(fInEnemyZoC)));
    26962694  ObserveMask := 3 shl (2 * p);
    26972695  for Loc := 0 to MapSize - 1 do
     
    27212719  if Mode <> moPlaying then
    27222720    exit;
    2723   MaskD(RW[p].Map^, MapSize, not Cardinal(fPeace));
     2721  MaskD(RW[p].Map^, MapSize, Cardinal(not Cardinal(fPeace)));
    27242722  for p1 := -1 to nPl - 1 do
    27252723    PeacePlayer[p1] := (p1 >= 0) and (p1 <> p) and (1 shl p1 and GAlive <> 0)
     
    28292827  end;
    28302828
    2831   FillChar(Country, MapSize, -1);
     2829  FillChar(Country, MapSize, Byte(-1));
    28322830  for Loc := 0 to MapSize - 1 do
    28332831    Dist[Loc] := CountryRadius + 1;
Note: See TracChangeset for help on using the changeset viewer.