Changeset 184 for trunk/UCore.pas


Ignore:
Timestamp:
Feb 12, 2018, 12:44:04 PM (7 years ago)
Author:
chronos
Message:
  • Modified: Game server and client splitted to units separate from game classes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r183 r184  
    88  Classes, SysUtils, XMLConf, FileUtil, ActnList, Controls, Dialogs, Forms,
    99  UGame, UApplicationInfo, UPersistentForm, UScaleDPI, UCoolTranslator,
    10   URegistry, ULastOpenedList, Registry, Menus, UGeometry, Contnrs, UFormClient;
     10  URegistry, ULastOpenedList, Registry, Menus, UGeometry, Contnrs, UFormClient,
     11  UGameServer, UGameClient;
    1112
    1213type
     
    104105
    105106uses
    106   UFormMove, UFormMain, UFormNew, UFormSettings, UFormAbout,
     107  UFormMain, UFormNew, UFormSettings, UFormAbout,
    107108  UFormHelp, UFormCharts, UFormUnitMoves, UFormPlayersStats;
    108109
     
    218219begin
    219220  FirstHuman := Game.Players.GetFirstHuman;
    220   if Assigned(FirstHuman) then FormClient.Client := FirstHuman.Client
     221  if Assigned(FirstHuman) then FormClient.Client := Server.Clients.SearchPlayer(FirstHuman)
    221222    else FormClient.Client := TClient(Server.Clients.First);
    222223end;
     
    380381  Game.OnNewTurn := GameNewTurnExecute;
    381382  Game.OnPlayerChange := DoPlayerChange;
    382   Game.Server := Server;
    383383  Server.Game := Game;
    384384  StoredDimension := TControlDimension.Create;
     
    447447begin
    448448  Form := TFormClient.Create(nil);
    449   Form.Client := Game.Server.Clients.New(SSpectator);
     449  Form.Client := Server.Clients.New(SSpectator);
    450450  //Form.Client.Form := Form;
    451451  //Form.Client.ControlPlayer := Player;
     
    470470
    471471procedure TCore.DoPlayerChange(Sender: TObject);
    472 begin
    473   if Assigned(Game.CurrentPlayer) and Assigned(Game.CurrentPlayer.Client) then begin
    474     FormClient.Client := Game.CurrentPlayer.Client;
     472var
     473  PlayerClient: TClient;
     474begin
     475  if Assigned(Game.CurrentPlayer) then begin
     476    PlayerClient := Server.Clients.SearchPlayer(Game.CurrentPlayer);
     477    if Assigned(PlayerClient) then FormClient.Client := PlayerClient;
    475478  end;
    476479  UpdateOtherForms;
Note: See TracChangeset for help on using the changeset viewer.