Changeset 294 for trunk/UGame.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/UGame.pas

    r291 r294  
    77uses
    88  Classes, SysUtils, ExtCtrls, Graphics, XMLConf, XMLRead, XMLWrite, Forms,
    9   DOM, Math, LazFileUtils, UXMLUtils, Dialogs, LCLType, LCLIntf, fgl,
     9  DOM, Math, LazFileUtils, UXMLUtils, Dialogs, LCLType, LCLIntf, fgl, UBuilding,
    1010  UGeometry, UPlayer, UMap, UMapType, UUnit, UGameSystem;
    1111
     
    6464    Players: TPlayers;
    6565    Units: TUnits;
     66    Buildings: TBuildings;
    6667    Map: TMap;
    6768    MapImageFileName: string;
     
    315316  for Cell in Map.Cells do
    316317  with Cell do begin
    317     if (Terrain = ttNormal) and CityEnabled and (Random < CityPercentage / 100) then
    318       Terrain := ttCity;
     318    if (Terrain = ttNormal) and CityEnabled and (Random < CityPercentage / 100) then begin
     319      Building := TBuilding(Buildings.AddItem('City'));
     320      Building.Kind := TBuildingKind(GameSystem.BuildingKinds.FindBySpecialType(stCity));
     321    end;
    319322  end;
    320323end;
     
    341344          StartCell := Map.Cells[Map.Cells.Count - 1 - Map.Cells.IndexOf(Players[0].StartCell)];
    342345
    343         if CityEnabled then StartCell.Terrain := ttCity;
     346        if CityEnabled then begin
     347          StartCell.Building := TBuilding(Buildings.AddItem('City'));
     348          StartCell.Building.Kind := TBuildingKind(GameSystem.BuildingKinds.FindBySpecialType(stCity));
     349        end;
    344350        StartCell.Player := Player;
    345351        if not Assigned(StartCell.OneUnit) then
     
    855861  Units := TUnits.Create;
    856862  Units.Game := Self;
     863  Buildings := TBuildings.Create;
     864  Buildings.Game := Self;
    857865  Map := TMap.Create;
    858866  Map.Game := Self;
     
    878886  FreeAndNil(Players);
    879887  FreeAndNil(Map);
     888  FreeAndNil(Buildings);
    880889  FreeAndNil(Units);
    881890  inherited Destroy;
Note: See TracChangeset for help on using the changeset viewer.