Changeset 289 for trunk/UGameSystem.pas


Ignore:
Timestamp:
Mar 24, 2019, 11:15:07 PM (6 years ago)
Author:
chronos
Message:
  • Added: Allow to add building kinds to game system.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UGameSystem.pas

    r284 r289  
    77uses
    88  Classes, SysUtils, fgl, UUnit, DOM, XMLRead, XMLWrite, UXMLUtils, XMLConf,
    9   FileUtil, UMapType, UNation;
     9  FileUtil, UMapType, UNation, UBuilding;
    1010
    1111type
     
    2323    PreferedMapType: TMapType;
    2424    Nations: TNations;
     25    BuildingKinds: TBuildingKinds;
    2526    constructor Create;
    2627    destructor Destroy; override;
     
    7980begin
    8081  UnitKinds := TUnitKinds.Create;
     82  BuildingKinds := TBuildingKinds.Create;
    8183  Nations := TNations.Create;
    8284end;
     
    8587begin
    8688  Nations.Free;
     89  BuildingKinds.Free;
    8790  UnitKinds.Free;
    8891  inherited Destroy;
     
    9295begin
    9396  UnitKinds.Clear;
     97  BuildingKinds.Clear;
    9498  Nations.Clear;
    9599end;
     
    109113  PreferedMapType := Source.PreferedMapType;
    110114  UnitKinds.Assign(Source.UnitKinds);
     115  BuildingKinds.Assign(Source.BuildingKinds);
    111116  Nations.Assign(Source.Nations);
    112117end;
     
    124129  if Assigned(NewNode) then
    125130    UnitKinds.LoadFromNode(NewNode);
     131  NewNode := Node.FindNode('BuildingKinds');
     132  if Assigned(NewNode) then
     133    BuildingKinds.LoadFromNode(NewNode);
    126134  NewNode := Node.FindNode('Nations');
    127135  if Assigned(NewNode) then
     
    141149  Node.AppendChild(NewNode);
    142150  UnitKinds.SaveToNode(NewNode);
     151  NewNode := Node.OwnerDocument.CreateElement('BuildingKinds');
     152  Node.AppendChild(NewNode);
     153  BuildingKinds.SaveToNode(NewNode);
    143154  NewNode := Node.OwnerDocument.CreateElement('Nations');
    144155  Node.AppendChild(NewNode);
Note: See TracChangeset for help on using the changeset viewer.