Changeset 294 for trunk/UMap.pas


Ignore:
Timestamp:
Mar 29, 2019, 8:40:42 AM (6 years ago)
Author:
chronos
Message:
  • Modified: Change terrain type ttCity to map cell building with special type stCity.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UMap.pas

    r265 r294  
    66
    77uses
    8   Classes, SysUtils, Graphics, ExtCtrls, UGeometry, DOM, fgl,
     8  Classes, SysUtils, Graphics, ExtCtrls, UGeometry, DOM, fgl, UBuilding,
    99  UXMLUtils, UUnit;
    1010
     
    1818  TCellLinks = class;
    1919
    20   TTerrainType = (ttVoid, ttNormal, ttCity);
     20  TTerrainType = (ttVoid, ttNormal, ttCityUnused);
    2121  TExtraType = (etNone, etObjectiveTarget, etAttack, etDefense, etLookout,
    2222    etGrowLow, etGrowMedium, etGrowHigh);
     
    2727  private
    2828    FArea: TMapArea;
     29    FBuilding: TBuilding;
    2930    FId: Integer;
    3031    FMap: TMap;
     
    3334    function GetPower: Integer;
    3435    procedure SetArea(AValue: TMapArea);
     36    procedure SetBuilding(AValue: TBuilding);
    3537    procedure SetId(AValue: Integer);
    3638    procedure SetPower(AValue: Integer);
     
    6769    property Area: TMapArea read FArea write SetArea;
    6870    property OneUnit: TUnit read FUnit write SetUnit;
     71    property Building: TBuilding read FBuilding write SetBuilding;
    6972    //property Power: Integer read GetPower;
    7073  end;
     
    619622      if Assigned(OneUnit) then
    620623        Inc(TotalUnits, OneUnit.Power);
    621       if Terrain = ttCity then
     624      if Assigned(Building) and (Building.Kind.SpecialType = stCity) then
    622625        Inc(TotalCities);
    623626      if Extra = etObjectiveTarget then
     
    968971end;
    969972
     973procedure TCell.SetBuilding(AValue: TBuilding);
     974var
     975  OldValue: TBuilding;
     976begin
     977  if FBuilding = AValue then Exit;
     978  OldValue := FBuilding;
     979  FBuilding := nil;
     980  if Assigned(OldValue) then OldValue.MapCell := nil;
     981  FBuilding := AValue;
     982  if Assigned(FBuilding) then FBuilding.MapCell := Self;
     983end;
     984
    970985function TCell.GetPower: Integer;
    971986begin
Note: See TracChangeset for help on using the changeset viewer.