Changeset 213 for trunk/UCore.pas


Ignore:
Timestamp:
May 24, 2018, 9:25:17 PM (6 years ago)
Author:
chronos
Message:
  • Added: Button with action to surrender the game.
  • Fixed: Added framing comm component for correct separation of network messages.
  • Added: New game protocol command NextPlayer. GUI client will redraw map on this event to see how other players/AI fight each other.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r211 r213  
    4545    procedure AExitExecute(Sender: TObject);
    4646    procedure AGameEndExecute(Sender: TObject);
    47     procedure AGameEndTurnExecute(Sender: TObject);
    4847    procedure AGameLoadExecute(Sender: TObject);
    4948    procedure AGameNewExecute(Sender: TObject);
     
    9695    procedure SaveConfig;
    9796    procedure Spectate(Player: TPlayer);
    98     procedure UpdateActions;
     97    procedure UpdateInterface;
    9998    procedure ScaleDPI;
    10099    procedure Init;
     
    250249end;
    251250
    252 procedure TCore.UpdateActions;
     251procedure TCore.UpdateInterface;
    253252begin
    254253  Core.AGameEnd.Enabled := Core.Game.Running;
     
    276275    Game.Running := False;
    277276    Server.GameEnd;
    278     UpdateActions;
    279   end;
    280 end;
    281 
    282 procedure TCore.AGameEndTurnExecute(Sender: TObject);
    283 begin
    284 
     277    UpdateInterface;
     278  end;
    285279end;
    286280
     
    302296    FormNew.PageControl1.TabIndex := FormNewTabIndex;
    303297    if FormNew.ShowModal = mrOk then begin
     298      Game.Running := False;
    304299      FormNew.Save(Server);
    305300      Game.Assign(GameSettings);
     
    369364      Game.SaveConfig(XMLConfig1, 'Game');
    370365      Server.SaveConfig(XMLConfig1, 'Server');
     366      XMLConfig1.Flush;
    371367    end;
    372368  finally
     
    457453  // Create local LocalClients for human players
    458454  LocalClients.Clear;
     455  FormClient.Client := nil;
    459456  for Player in Game.Players do
    460457  with Player do
     
    484481  SelectClient;
    485482  LastOpenedList1.AddItem(FileName);
    486   with FormClient.Client do
    487     View.DestRect := TRect.CreateBounds(TPoint.Create(0, 0),
    488       TPoint.Create(FormClient.PaintBox1.Width, FormClient.PaintBox1.Height));
    489483  FormClient.AZoomAll.Execute;
    490484  UpdateOtherForms;
    491   UpdateActions;
     485  UpdateInterface;
    492486  ServerClient := Server.Clients.SearchByPlayer(Game.CurrentPlayer);
    493487  if Assigned(ServerClient) then ServerClient.TurnStart
     
    507501  I: Integer;
    508502begin
     503  // Copy all actions from docked form to main form so keyboard shortcuts will be active
    509504  for I := 0 to FormClient.ActionList1.ActionCount - 1 do begin
    510505    Action := TAction.Create(FormMain);
     
    539534  // Create local LocalClients for human players
    540535  LocalClients.Clear;
     536  FormClient.Client := nil;
    541537  for Player in Game.Players do
    542538  with Player do
     
    569565    else ShowMessage(Format(SPlayersNotInitialized, [Game.Players.Count, Game.Players.GetAliveCount]));
    570566  UpdateOtherForms;
    571   UpdateActions;
     567  UpdateInterface;
    572568  ServerClient := Server.Clients.SearchByPlayer(Game.CurrentPlayer);
    573569  if Assigned(ServerClient) then ServerClient.TurnStart
     
    580576  ServerClient: TServerClient;
    581577begin
     578  Application.ProcessMessages;
     579  Server.NextPlayer;
    582580  if Assigned(Game.CurrentPlayer) then begin
    583581    if Game.CurrentPlayer.Mode = pmHuman then begin
Note: See TracChangeset for help on using the changeset viewer.