Changeset 282 for trunk/UPlayer.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/UPlayer.pas

    r274 r282  
    77uses
    88  Classes, SysUtils, Graphics, UMap, DOM, fgl, XMLConf, UXMLUtils, Math,
    9   UGeometry, UUnit;
     9  UGeometry, UUnit, UNation;
    1010
    1111type
     
    120120    Moves: TUnitMoves;
    121121    Units: TUnits;
     122    Nation: TNation;
    122123    function IsAllowedMoveTarget(CellFrom, CellTo: TPlayerCell): Boolean;
    123124    procedure ReduceMovesPower;
     
    895896  Agressivity := Source.Agressivity;
    896897  Defensive := Source.Defensive;
     898  Nation := Source.Nation;
    897899end;
    898900
     
    906908    Defensive := GetValue(DOMString(Path + '/Defensive'), False);
    907909    Agressivity := TComputerAgressivity(GetValue(DOMString(Path + '/Agressivity'), 0));
     910    Nation := TGame(Game).GameSystem.Nations.FindById(GetValue(DOMString(Path + '/Nation'), 0));
    908911  end;
    909912end;
     
    918921    SetValue(DOMString(Path + '/Defensive'), Defensive);
    919922    SetValue(DOMString(Path + '/Agressivity'), Integer(Agressivity));
     923    if Assigned(Nation) then
     924      SetValue(DOMString(Path + '/Nation'), Nation.Id)
     925      else SetValue(DOMString(Path + '/Nation'), 0)
    920926  end;
    921927end;
Note: See TracChangeset for help on using the changeset viewer.