Changeset 203 for trunk/UCore.pas


Ignore:
Timestamp:
May 18, 2018, 12:54:37 AM (6 years ago)
Author:
chronos
Message:
  • Fixed: Player turn start/end signaling from server to clients.
  • Added: Save action to save game without opening save dialog.
  • Fixed: Move dialog was not opened after new game was created.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r202 r203  
    1717  TCore = class(TDataModule)
    1818    AAbout: TAction;
     19    AGameSave: TAction;
    1920    APlayersStats: TAction;
    2021    ANewSpectatorClient: TAction;
     
    2223    AShowCharts: TAction;
    2324    AHelp: TAction;
    24     AGameSave: TAction;
     25    AGameSaveAs: TAction;
    2526    AGameLoad: TAction;
    2627    ApplicationInfo: TApplicationInfo;
     
    2930    AExit: TAction;
    3031    AGameEnd: TAction;
    31     AGameEndTurn: TAction;
    3232    AGameNew: TAction;
    3333    AGameRestart: TAction;
     
    4848    procedure AGameNewExecute(Sender: TObject);
    4949    procedure AGameRestartExecute(Sender: TObject);
     50    procedure AGameSaveAsExecute(Sender: TObject);
    5051    procedure AGameSaveExecute(Sender: TObject);
    5152    procedure AHelpExecute(Sender: TObject);
     
    245246procedure TCore.UpdateActions;
    246247begin
    247   Core.AGameEndTurn.Enabled := Core.Game.Running;
    248248  Core.AGameEnd.Enabled := Core.Game.Running;
    249249end;
     
    276276procedure TCore.AGameEndTurnExecute(Sender: TObject);
    277277begin
    278   Game.NextPlayer;
    279   RedrawClients;
    280   UpdateActions;
     278
    281279end;
    282280
     
    314312end;
    315313
    316 procedure TCore.AGameSaveExecute(Sender: TObject);
     314procedure TCore.AGameSaveAsExecute(Sender: TObject);
    317315begin
    318316  SaveDialog1.Filter := SFileDialogFilter;
     
    323321    LastOpenedList1.AddItem(SaveDialog1.FileName);
    324322  end;
     323end;
     324
     325procedure TCore.AGameSaveExecute(Sender: TObject);
     326begin
     327  if FileExists(Game.FileName) then
     328    Game.SaveToFile(Game.FileName)
     329    else AGameSave.Execute;
    325330end;
    326331
     
    434439
    435440  // Create local LocalClients for human players
     441  LocalClients.Clear;
    436442  for Player in Game.Players do
    437443  with Player do
     
    509515
    510516  // Create local LocalClients for human players
     517  LocalClients.Clear;
    511518  for Player in Game.Players do
    512519  with Player do
Note: See TracChangeset for help on using the changeset viewer.