Changeset 155 for trunk


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.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormNew.lfm

    r151 r155  
    192192      object ComboBoxGridType: TComboBox
    193193        Left = 146
    194         Height = 36
     194        Height = 40
    195195        Top = 104
    196196        Width = 208
     
    206206      object ComboBoxMapShape: TComboBox
    207207        Left = 146
    208         Height = 36
     208        Height = 40
    209209        Top = 144
    210210        Width = 208
  • trunk/Forms/UFormNew.pas

    r152 r155  
    338338  SpinEditVoidPercent.Value := Game.VoidPercentage;
    339339  SpinEditVoidPercent.Enabled := Game.VoidEnabled;
    340   Players.Assign(Game.Players);
     340  Players.Assign(Game.PlayersSetting);
    341341  CheckBoxCity.Checked := Game.CityEnabled;
    342342  SpinEditCityPercent.Value := Game.CityPercentage;
     
    358358procedure TFormNew.Save(Game: TGame);
    359359begin
    360   Game.Players.Assign(Players);
    361   Game.Players.NewPlayerId := Players.NewPlayerId;
     360  Game.PlayersSetting.Assign(Players);
    362361  Game.SymetricMap := CheckBoxSymetricMap.Checked;
    363362  Game.VoidEnabled := CheckBoxVoid.Checked;
  • trunk/UCore.pas

    r148 r155  
    460460    FInitialized := True;
    461461
     462    // Update translated default player names
     463    TPlayer(Game.PlayersSetting[0]).Name := SPlayer + ' 1';
     464    TPlayer(Game.PlayersSetting[1]).Name := SPlayer + ' 2';
     465
    462466    LoadConfig;
    463467    Game.LoadConfig(XMLConfig1, 'Game');
    464468
    465     // Update translated default player names
    466     TPlayer(Game.Players[0]).Name := SPlayer + ' 1';
    467     TPlayer(Game.Players[1]).Name := SPlayer + ' 2';
    468 
    469469    CommandLineParams;
    470470    ScaleDPI;
  • 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.