Changeset 155 for trunk/UGame.pas


Ignore:
Timestamp:
Nov 16, 2017, 12:43:42 AM (7 years ago)
Author:
chronos
Message:
  • Modified: Store player settings for new game separately to current game players.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UGame.pas

    r154 r155  
    444444    procedure CalculatePlayersDistance;
    445445    procedure PropagatePlayerDistance(List: TCells);
    446     procedure InitDefaultPlayers;
     446    procedure InitDefaultPlayersSetting;
    447447  public
    448448    Players: TPlayers;
     449    PlayersSetting: TPlayers;
    449450    Clients: TClients;
    450451    Map: TMap;
     
    30843085end;
    30853086
    3086 procedure TGame.InitDefaultPlayers;
    3087 begin
    3088   Players.Clear;
    3089   Players.New(SPlayer + ' 1', clBlue, pmHuman);
    3090   Players.New(SPlayer + ' 2', clRed, pmComputer);
     3087procedure TGame.InitDefaultPlayersSetting;
     3088begin
     3089  PlayersSetting.Clear;
     3090  PlayersSetting.New(SPlayer + ' 1', clBlue, pmHuman);
     3091  PlayersSetting.New(SPlayer + ' 2', clRed, pmComputer);
    30913092end;
    30923093
     
    31093110    SetValue(DOMString(Path + '/GrowCells'), Integer(GrowCells));
    31103111    SetValue(DOMString(Path + '/WinObjective'), Integer(WinObjective));
    3111     Players.SaveConfig(Config, Path + '/Players');
     3112    PlayersSetting.SaveConfig(Config, Path + '/Players');
    31123113  end;
    31133114end;
     
    31413142    if (Value >= Integer(Low(TWinObjective))) and (Value <= Integer(High(TWinObjective))) then
    31423143      WinObjective := TWinObjective(Value) else WinObjective := Low(TWinObjective);
    3143     Players.LoadConfig(Config, Path + '/Players');
     3144    PlayersSetting.LoadConfig(Config, Path + '/Players');
    31443145  end;
    31453146end;
     
    33673368  Players := TPlayers.Create;
    33683369  Players.Game := Self;
     3370  PlayersSetting := TPlayers.Create;
     3371  PlayersSetting.Game := Self;
    33693372  Clients := TClients.Create;
    33703373  Clients.Game := Self;
     
    33723375  MapImageFileName := 'Images/Maps/WorldMap.png';
    33733376  Randomize;
     3377  InitDefaultPlayersSetting;
    33743378
    33753379  VoidEnabled := True;
     
    33843388begin
    33853389  FreeAndNil(Clients);
     3390  FreeAndNil(PlayersSetting);
    33863391  FreeAndNil(Players);
    33873392  FreeAndNil(Map);
     
    34303435  end;
    34313436
    3432   InitDefaultPlayers;
     3437  Players.Assign(PlayersSetting);
    34333438  for Player in Players do Player.StartCell := nil;
    34343439  I := 0;
Note: See TracChangeset for help on using the changeset viewer.