Changeset 191 for trunk/UCore.pas
- Timestamp:
- May 1, 2018, 10:16:08 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r185 r191 155 155 procedure TCore.LoadConfig; 156 156 begin 157 RegistryContext := RegContext(HKEY_CURRENT_USER, DefaultRegKey);157 RegistryContext := TRegistryContext.Create(HKEY_CURRENT_USER, DefaultRegKey); 158 158 PersistentForm.RegistryContext := RegistryContext; 159 159 XMLConfig1.Filename := GetAppConfigDir(False) + 'Config.xml'; … … 415 415 416 416 procedure TCore.LoadGame(FileName: string); 417 var 418 Player: TPlayer; 419 NewClient: TClient; 417 420 begin 418 421 Game.LoadFromFile(FileName); 419 Server.InitClients;420 SelectClient;421 LastOpenedList1.AddItem(FileName);422 with FormClient.Client do423 View.DestRect := TRect.CreateBounds(TPoint.Create(0, 0),424 TPoint.Create(FormClient.PaintBox1.Width, FormClient.PaintBox1.Height));425 FormClient.AZoomAll.Execute;426 RedrawClients;427 UpdateOtherForms;428 end;429 430 procedure TCore.RedrawClients;431 var432 Form: TFormClient;433 begin434 for Form in FormClients do435 Form.Redraw;436 FormClient.Redraw;437 end;438 439 procedure TCore.UpdateOtherForms;440 begin441 if Assigned(FormCharts) and FormCharts.Visible then FormCharts.Redraw;442 if Assigned(FormUnitMoves) and FormUnitMoves.Visible then FormUnitMoves.ReloadList;443 if Assigned(FormPlayersStats) and FormPlayersStats.Visible then FormPlayersStats.ReloadList;444 end;445 446 procedure TCore.Spectate(Player: TPlayer);447 var448 Form: TFormClient;449 begin450 Form := TFormClient.Create(nil);451 Form.Client := Clients.New(SSpectator);452 //Form.Client.Form := Form;453 //Form.Client.ControlPlayer := Player;454 Form.AZoomAll.Execute;455 Form.Show;456 FormClients.Add(Form);457 end;458 459 procedure TCore.StartNewGame;460 var461 NewClient: TClient;462 Player: TPlayer;463 begin464 Game.New;465 422 Server.InitClients; 466 423 … … 478 435 end; 479 436 437 SelectClient; 438 LastOpenedList1.AddItem(FileName); 439 with FormClient.Client do 440 View.DestRect := TRect.CreateBounds(TPoint.Create(0, 0), 441 TPoint.Create(FormClient.PaintBox1.Width, FormClient.PaintBox1.Height)); 442 FormClient.AZoomAll.Execute; 443 RedrawClients; 444 UpdateOtherForms; 445 end; 446 447 procedure TCore.RedrawClients; 448 var 449 Form: TFormClient; 450 begin 451 for Form in FormClients do 452 Form.Redraw; 453 FormClient.Redraw; 454 end; 455 456 procedure TCore.UpdateOtherForms; 457 begin 458 if Assigned(FormCharts) and FormCharts.Visible then FormCharts.Redraw; 459 if Assigned(FormUnitMoves) and FormUnitMoves.Visible then FormUnitMoves.ReloadList; 460 if Assigned(FormPlayersStats) and FormPlayersStats.Visible then FormPlayersStats.ReloadList; 461 end; 462 463 procedure TCore.Spectate(Player: TPlayer); 464 var 465 Form: TFormClient; 466 begin 467 Form := TFormClient.Create(nil); 468 Form.Client := Clients.New(SSpectator); 469 //Form.Client.Form := Form; 470 //Form.Client.ControlPlayer := Player; 471 Form.AZoomAll.Execute; 472 Form.Show; 473 FormClients.Add(Form); 474 end; 475 476 procedure TCore.StartNewGame; 477 var 478 NewClient: TClient; 479 Player: TPlayer; 480 begin 481 Game.New; 482 Server.InitClients; 483 484 // Create local clients for human players 485 for Player in Game.Players do 486 with Player do 487 if Mode = pmHuman then begin 488 NewClient := Clients.New(Name); 489 NewClient.ControlPlayer := Player; 490 NewClient.View.Clear; 491 NewClient.View.Zoom := 1; 492 if Assigned(NewClient.ControlPlayer.StartCell) then 493 NewClient.View.CenterPlayerCity(NewClient.ControlPlayer) 494 else NewClient.View.CenterMap; 495 end; 496 480 497 Game.DevelMode := DevelMode; 481 498 SelectClient;
Note:
See TracChangeset
for help on using the changeset viewer.