Changeset 298 for trunk/UCore.pas


Ignore:
Timestamp:
Jul 10, 2019, 5:35:15 PM (5 years ago)
Author:
chronos
Message:
  • Added: New item list type reference. Used in players for reference to selected nation.
  • Modified: New game players selection migrated to dynamic item/list forms.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r292 r298  
    531531procedure TCore.LoadGame(FileName: string);
    532532var
    533   Player: TPlayer;
     533  I: Integer;
    534534  NewClient: TClient;
    535535  ServerClient: TServerClient;
     536  Player: TPlayer;
    536537begin
    537538  GameLoaded := True;
     
    544545  LocalClients.Clear;
    545546  FormClient.Client := nil;
    546   for Player in Game.Players do
    547   with Player do
    548   if Mode = pmHuman then begin
    549     NewClient := LocalClients.New(Name);
    550     NewClient.ControlPlayer := Player;
    551     TClientGUI(NewClient).View.Clear;
    552     TClientGUI(NewClient).View.Zoom := 1;
    553     NewClient.LocalServer := Server;
    554     NewClient.ConnectType := ctLocal;
    555     NewClient.Active := True;
    556     if Assigned(NewClient.ControlPlayer.StartCell) then
    557       TClientGUI(NewClient).View.CenterPlayerCity(NewClient.ControlPlayer)
    558       else TClientGUI(NewClient).View.CenterMap;
    559   end else
    560   if Mode = pmComputer then begin
    561     NewClient := TComputer.Create;
    562     NewClient.Game := TGame(Game);
    563     NewClient.Name := Name;
    564     LocalClients.Add(NewClient);
    565     NewClient.ControlPlayer := Player;
    566     NewClient.LocalServer := Server;
    567     NewClient.ConnectType := ctLocal;
    568     NewClient.Active := True;
     547  for I := 0 to Game.Players.Count - 1 do begin
     548    Player := TPlayer(Game.Players[I]);
     549    with Player do
     550    if Mode = pmHuman then begin
     551      NewClient := LocalClients.New(Name);
     552      NewClient.ControlPlayer := Player;
     553      TClientGUI(NewClient).View.Clear;
     554      TClientGUI(NewClient).View.Zoom := 1;
     555      NewClient.LocalServer := Server;
     556      NewClient.ConnectType := ctLocal;
     557      NewClient.Active := True;
     558      if Assigned(NewClient.ControlPlayer.StartCell) then
     559        TClientGUI(NewClient).View.CenterPlayerCity(NewClient.ControlPlayer)
     560        else TClientGUI(NewClient).View.CenterMap;
     561    end else
     562    if Mode = pmComputer then begin
     563      NewClient := TComputer.Create;
     564      NewClient.Game := TGame(Game);
     565      NewClient.Name := Name;
     566      LocalClients.Add(NewClient);
     567      NewClient.ControlPlayer := Player;
     568      NewClient.LocalServer := Server;
     569      NewClient.ConnectType := ctLocal;
     570      NewClient.Active := True;
     571    end;
    569572  end;
    570573
     
    650653  NewClient: TClient;
    651654  Player: TPlayer;
     655  I: Integer;
    652656  ServerClient: TServerClient;
    653657begin
     
    659663  LocalClients.Clear;
    660664  FormClient.Client := nil;
    661   for Player in Game.Players do
    662   with Player do
    663   if Mode = pmHuman then begin
    664     NewClient := LocalClients.New(Name);
    665     NewClient.ControlPlayer := Player;
    666     TClientGUI(NewClient).View.Clear;
    667     TClientGUI(NewClient).View.Zoom := 1;
    668     NewClient.LocalServer := Server;
    669     NewClient.ConnectType := ctLocal;
    670     NewClient.Active := True;
    671     if Assigned(NewClient.ControlPlayer.StartCell) then
    672       TClientGUI(NewClient).View.CenterPlayerCity(NewClient.ControlPlayer)
    673       else TClientGUI(NewClient).View.CenterMap;
    674   end else
    675   if Mode = pmComputer then begin
    676     NewClient := TComputer.Create;
    677     NewClient.Game := TGame(Game);
    678     NewClient.Name := Name;
    679     LocalClients.Add(NewClient);
    680     NewClient.ControlPlayer := Player;
    681     NewClient.LocalServer := Server;
    682     NewClient.ConnectType := ctLocal;
    683     NewClient.Active := True;
     665  for I := 0 to Game.Players.Count - 1 do begin
     666    Player := TPlayer(Game.Players[I]);
     667    with Player do
     668    if Mode = pmHuman then begin
     669      NewClient := LocalClients.New(Name);
     670      NewClient.ControlPlayer := Player;
     671      TClientGUI(NewClient).View.Clear;
     672      TClientGUI(NewClient).View.Zoom := 1;
     673      NewClient.LocalServer := Server;
     674      NewClient.ConnectType := ctLocal;
     675      NewClient.Active := True;
     676      if Assigned(NewClient.ControlPlayer.StartCell) then
     677        TClientGUI(NewClient).View.CenterPlayerCity(NewClient.ControlPlayer)
     678        else TClientGUI(NewClient).View.CenterMap;
     679    end else
     680    if Mode = pmComputer then begin
     681      NewClient := TComputer.Create;
     682      NewClient.Game := TGame(Game);
     683      NewClient.Name := Name;
     684      LocalClients.Add(NewClient);
     685      NewClient.ControlPlayer := Player;
     686      NewClient.LocalServer := Server;
     687      NewClient.ConnectType := ctLocal;
     688      NewClient.Active := True;
     689    end;
    684690  end;
    685691
Note: See TracChangeset for help on using the changeset viewer.