Changeset 185 for trunk/UCore.pas
- Timestamp:
- Feb 12, 2018, 3:08:27 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r184 r185 8 8 Classes, SysUtils, XMLConf, FileUtil, ActnList, Controls, Dialogs, Forms, 9 9 UGame, UApplicationInfo, UPersistentForm, UScaleDPI, UCoolTranslator, 10 URegistry, ULastOpenedList, Registry, Menus, UGeometry, Contnrs,UFormClient,11 UGameServer, UGameClient ;10 URegistry, ULastOpenedList, Registry, Menus, UGeometry, UFormClient, 11 UGameServer, UGameClient, fgl; 12 12 13 13 type … … 87 87 AnimationSpeed: Integer; 88 88 AutoSaveEnabled: Boolean; 89 FormClients: TObjectList; // TFormClient 90 //CurrentClient: TClient; 91 LocalClients: TObjectList; // TClient 89 FormClients: TFPGObjectList<TFormClient>; 90 Clients: TClients; 92 91 procedure Spectate(Player: TPlayer); 93 92 procedure UpdateActions; … … 219 218 begin 220 219 FirstHuman := Game.Players.GetFirstHuman; 221 if Assigned(FirstHuman) then FormClient.Client := Server.Clients.SearchPlayer(FirstHuman)222 else FormClient.Client := TClient( Server.Clients.First);220 if Assigned(FirstHuman) then FormClient.Client := Clients.SearchPlayer(FirstHuman) 221 else FormClient.Client := TClient(Clients.First); 223 222 end; 224 223 … … 376 375 begin 377 376 Server := TServer.Create; 377 Clients := TClients.Create; 378 378 Game := TGame.Create; 379 379 Game.OnMoveUpdated := DoMoveUpdated; … … 382 382 Game.OnPlayerChange := DoPlayerChange; 383 383 Server.Game := Game; 384 Clients.Game := Game; 384 385 StoredDimension := TControlDimension.Create; 385 386 XMLConfig1.Filename := GetAppConfigDir(False) + 'Config.xml'; 386 387 ForceDirectories(GetAppConfigDir(False)); 387 FormClients := T ObjectList.Create;388 FormClients := TFPGObjectList<TFormClient>.Create; 388 389 end; 389 390 … … 400 401 FreeAndNil(Server); 401 402 FreeAndNil(Game); 403 FreeAndNil(Clients); 402 404 end; 403 405 … … 447 449 begin 448 450 Form := TFormClient.Create(nil); 449 Form.Client := Server.Clients.New(SSpectator);451 Form.Client := Clients.New(SSpectator); 450 452 //Form.Client.Form := Form; 451 453 //Form.Client.ControlPlayer := Player; … … 456 458 457 459 procedure TCore.StartNewGame; 460 var 461 NewClient: TClient; 462 Player: TPlayer; 458 463 begin 459 464 Game.New; 460 465 Server.InitClients; 466 467 // Create local clients for human players 468 for Player in Game.Players do 469 with Player do 470 if Mode = pmHuman then begin 471 NewClient := Clients.New(Name); 472 NewClient.ControlPlayer := Player; 473 NewClient.View.Clear; 474 NewClient.View.Zoom := 1; 475 if Assigned(NewClient.ControlPlayer.StartCell) then 476 NewClient.View.CenterPlayerCity(NewClient.ControlPlayer) 477 else NewClient.View.CenterMap; 478 end; 479 461 480 Game.DevelMode := DevelMode; 462 481 SelectClient; … … 474 493 begin 475 494 if Assigned(Game.CurrentPlayer) then begin 476 PlayerClient := Server.Clients.SearchPlayer(Game.CurrentPlayer);495 PlayerClient := Clients.SearchPlayer(Game.CurrentPlayer); 477 496 if Assigned(PlayerClient) then FormClient.Client := PlayerClient; 478 497 end;
Note:
See TracChangeset
for help on using the changeset viewer.