Changeset 282 for trunk/UGameSystem.pas


Ignore:
Timestamp:
Mar 10, 2019, 4:48:41 PM (6 years ago)
Author:
chronos
Message:
  • Modified: Allow to set nation in player settings.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UGameSystem.pas

    r281 r282  
    77uses
    88  Classes, SysUtils, fgl, UUnit, DOM, XMLRead, XMLWrite, UXMLUtils, XMLConf,
    9   FileUtil, UMapType;
     9  FileUtil, UMapType, UNation;
    1010
    1111type
     
    2222    UnitsMoveImmediately: Boolean;
    2323    PreferedMapType: TMapType;
     24    Nations: TNations;
    2425    constructor Create;
    2526    destructor Destroy; override;
     
    7576begin
    7677  UnitKinds := TUnitKinds.Create;
     78  Nations := TNations.Create;
    7779end;
    7880
    7981destructor TGameSystem.Destroy;
    8082begin
     83  Nations.Free;
    8184  UnitKinds.Free;
    8285  inherited Destroy;
     
    8689begin
    8790  UnitKinds.Clear;
     91  Nations.Clear;
    8892end;
    8993
     
    102106  PreferedMapType := Source.PreferedMapType;
    103107  UnitKinds.Assign(Source.UnitKinds);
     108  Nations.Assign(Source.Nations);
    104109end;
    105110
     
    116121  if Assigned(NewNode) then
    117122    UnitKinds.LoadFromNode(NewNode);
     123  NewNode := Node.FindNode('Nations');
     124  if Assigned(NewNode) then
     125    Nations.LoadFromNode(NewNode);
    118126end;
    119127
     
    130138  Node.AppendChild(NewNode);
    131139  UnitKinds.SaveToNode(NewNode);
     140  NewNode := Node.OwnerDocument.CreateElement('Nations');
     141  Node.AppendChild(NewNode);
     142  Nations.SaveToNode(NewNode);
    132143end;
    133144
Note: See TracChangeset for help on using the changeset viewer.