Changeset 294 for trunk/UMap.pas
- Timestamp:
- Mar 29, 2019, 8:40:42 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UMap.pas
r265 r294 6 6 7 7 uses 8 Classes, SysUtils, Graphics, ExtCtrls, UGeometry, DOM, fgl, 8 Classes, SysUtils, Graphics, ExtCtrls, UGeometry, DOM, fgl, UBuilding, 9 9 UXMLUtils, UUnit; 10 10 … … 18 18 TCellLinks = class; 19 19 20 TTerrainType = (ttVoid, ttNormal, ttCity );20 TTerrainType = (ttVoid, ttNormal, ttCityUnused); 21 21 TExtraType = (etNone, etObjectiveTarget, etAttack, etDefense, etLookout, 22 22 etGrowLow, etGrowMedium, etGrowHigh); … … 27 27 private 28 28 FArea: TMapArea; 29 FBuilding: TBuilding; 29 30 FId: Integer; 30 31 FMap: TMap; … … 33 34 function GetPower: Integer; 34 35 procedure SetArea(AValue: TMapArea); 36 procedure SetBuilding(AValue: TBuilding); 35 37 procedure SetId(AValue: Integer); 36 38 procedure SetPower(AValue: Integer); … … 67 69 property Area: TMapArea read FArea write SetArea; 68 70 property OneUnit: TUnit read FUnit write SetUnit; 71 property Building: TBuilding read FBuilding write SetBuilding; 69 72 //property Power: Integer read GetPower; 70 73 end; … … 619 622 if Assigned(OneUnit) then 620 623 Inc(TotalUnits, OneUnit.Power); 621 if Terrain = ttCitythen624 if Assigned(Building) and (Building.Kind.SpecialType = stCity) then 622 625 Inc(TotalCities); 623 626 if Extra = etObjectiveTarget then … … 968 971 end; 969 972 973 procedure TCell.SetBuilding(AValue: TBuilding); 974 var 975 OldValue: TBuilding; 976 begin 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; 983 end; 984 970 985 function TCell.GetPower: Integer; 971 986 begin
Note:
See TracChangeset
for help on using the changeset viewer.