Changeset 191
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; -
trunk/UGame.pas
r185 r191 8 8 Classes, SysUtils, ExtCtrls, Graphics, XMLConf, XMLRead, XMLWrite, Forms, 9 9 DOM, Math, LazFileUtils, UXMLUtils, Dialogs, Types, LCLType, LCLIntf, fgl, 10 UGeometry , SpecializedList;10 UGeometry; 11 11 12 12 const … … 1467 1467 if Power < MaxPower then begin 1468 1468 // Increase units count 1469 if Game.GrowAmount = gaByOne then Addition := 1 1470 else if Game.GrowAmount = gaBySquareRoot then begin 1471 Addition := Trunc(Sqrt(Power)); 1472 if Addition = 0 then Addition := 1; 1473 end; 1469 Addition := 0; 1470 if Game.GrowAmount = gaByOne then begin 1471 Addition := 1; 1472 end else 1473 if Game.GrowAmount = gaBySquareRoot then begin 1474 Addition := Trunc(Sqrt(Power)); 1475 if Addition = 0 then Addition := 1; 1476 end; 1474 1477 Power := Min(Power + Addition, MaxPower); 1475 1478 end else -
trunk/UGameServer.pas
r185 r191 192 192 193 193 procedure TServer.InitClients; 194 var195 Client: TServerClient;196 Player: TPlayer;197 194 begin 198 195 Clients.Clear;
Note:
See TracChangeset
for help on using the changeset viewer.