Ignore:
Timestamp:
Nov 15, 2017, 6:19:17 PM (7 years ago)
Author:
chronos
Message:
  • Added: Remember players configuration for new game.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormNew.pas

    r151 r152  
    333333
    334334procedure TFormNew.Load(Game: TGame);
    335 var
    336   I: Integer;
    337335begin
    338336  CheckBoxSymetricMap.Checked := Game.SymetricMap;
     
    340338  SpinEditVoidPercent.Value := Game.VoidPercentage;
    341339  SpinEditVoidPercent.Enabled := Game.VoidEnabled;
    342   for I := 0 to Players.Count - 1 do
    343     Players[I] := nil;
    344   Players.Count := Game.Players.Count;
    345   for I := 0 to Game.Players.Count - 1 do begin
    346     Players[I] := TPlayer.Create;
    347     TPlayer(Players[I]).Assign(TPlayer(Game.Players[I]));
    348   end;
    349   Players.NewPlayerId := Game.Players.NewPlayerId;
    350 
     340  Players.Assign(Game.Players);
    351341  CheckBoxCity.Checked := Game.CityEnabled;
    352342  SpinEditCityPercent.Value := Game.CityPercentage;
     
    367357
    368358procedure TFormNew.Save(Game: TGame);
    369 var
    370   I: Integer;
    371 begin
    372   while Game.Players.Count > Players.Count do
    373     Game.Players.Delete(Game.Players.Count - 1);
    374   while Game.Players.Count < Players.Count do
    375     Game.Players.Add(TPlayer.Create);
    376   for I := 0 to Game.Players.Count - 1 do begin
    377     TPlayer(Game.Players[I]).Assign(TPlayer(Players[I]));
    378     TPlayer(Game.Players[I]).Game := Game;
    379   end;
     359begin
     360  Game.Players.Assign(Players);
    380361  Game.Players.NewPlayerId := Players.NewPlayerId;
    381362  Game.SymetricMap := CheckBoxSymetricMap.Checked;
Note: See TracChangeset for help on using the changeset viewer.