Changeset 127 for trunk/UGame.pas


Ignore:
Timestamp:
Jun 17, 2017, 3:14:16 PM (7 years ago)
Author:
chronos
Message:
  • Added: Load recent menu action to load recently opened/saved files.
  • Fixed: Init clients after loading game from file.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UGame.pas

    r126 r127  
    394394    procedure BuildBridges;
    395395    procedure BuildMapAreas;
     396    procedure InitClients;
    396397  public
    397398    Players: TPlayers;
     
    27032704end;
    27042705
     2706procedure TGame.InitClients;
     2707var
     2708  I: Integer;
     2709begin
     2710  Clients.Clear;
     2711  Clients.New('Spectator');
     2712  for I := 0 to Players.Count - 1 do
     2713  with TPlayer(Players[I]) do
     2714  if Mode = pmHuman then begin
     2715    Clients.New(TPlayer(Players[I]).Name);
     2716    TPlayer(Players[I]).Client := TClient(Clients.Last);
     2717  end;
     2718
     2719  for I := 0 to Clients.Count - 1 do
     2720  with TClient(Clients[I]) do begin
     2721    View.Clear;
     2722    View.Zoom := 1;
     2723    if Assigned(ControlPlayer) then View.CenterPlayerCity(ControlPlayer)
     2724      else View.CenterMap;
     2725  end;
     2726end;
     2727
    27052728procedure TGame.SaveConfig(Config: TXmlConfig; Path: string);
    27062729begin
     
    27932816        else CurrentPlayer := nil;
    27942817
     2818      InitClients;
     2819
    27952820      NewNode := FindNode('UnitMoves');
    27962821      if Assigned(NewNode) then
     
    30443069    else CurrentPlayer := nil;
    30453070
    3046   Clients.Clear;
    3047   Clients.New('Spectator');
    3048   for I := 0 to Players.Count - 1 do
    3049   with TPlayer(Players[I]) do
    3050   if Mode = pmHuman then begin
    3051     Clients.New(TPlayer(Players[I]).Name);
    3052     TPlayer(Players[I]).Client := TClient(Clients.Last);
    3053   end;
    3054 
    3055   for I := 0 to Clients.Count - 1 do
    3056   with TClient(Clients[I]) do begin
    3057     View.Clear;
    3058     View.Zoom := 1;
    3059     if Assigned(ControlPlayer) then View.CenterPlayerCity(ControlPlayer)
    3060       else View.CenterMap;
    3061   end;
     3071  InitClients;
    30623072end;
    30633073
Note: See TracChangeset for help on using the changeset viewer.