Changeset 148 for trunk/UCore.pas
- Timestamp:
- Nov 12, 2017, 11:06:20 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r145 r148 16 16 TCore = class(TDataModule) 17 17 AAbout: TAction; 18 AShowUnitMoves: TAction; 18 19 AShowCharts: TAction; 19 20 AHelp: TAction; … … 48 49 procedure ASettingsExecute(Sender: TObject); 49 50 procedure AShowChartsExecute(Sender: TObject); 51 procedure AShowUnitMovesExecute(Sender: TObject); 50 52 procedure CoolTranslator1Translate(Sender: TObject); 51 53 procedure DataModuleCreate(Sender: TObject); … … 60 62 procedure StartNewGame; 61 63 procedure DoPlayerChange(Sender: TObject); 64 procedure DoMoveUpdated(UnitMove: TUnitMove); 62 65 procedure DoOnMove(CellFrom, CellTo: TCell; var CountOnce, 63 66 CountRepeat: Integer; Update: Boolean; var Confirm: Boolean); … … 95 98 uses 96 99 UFormMove, UFormMain, UFormNew, UFormSettings, UFormAbout, UFormPlayer, 97 UFormHelp, UFormCharts ;100 UFormHelp, UFormCharts, UFormUnitMoves; 98 101 99 102 const … … 278 281 279 282 procedure TCore.ProcessComputerTurns; 280 var281 Computer: TComputer;282 283 begin 283 284 while Game.Running and (Game.CurrentPlayer.Mode <> pmHuman) do begin 284 285 if Game.CurrentPlayer.Mode = pmComputer then begin 285 Computer := TComputer.Create; 286 try 287 Computer.Game := Game; 288 Computer.Process; 289 finally 290 Computer.Free; 291 end; 286 Game.CurrentPlayer.Computer.Process; 292 287 FormMain.Redraw; 293 288 Delay(Trunc((100 - AnimationSpeed) / 100 * 2000)); … … 374 369 end; 375 370 371 procedure TCore.AShowUnitMovesExecute(Sender: TObject); 372 begin 373 FormUnitMoves.Show; 374 end; 375 376 376 procedure TCore.CoolTranslator1Translate(Sender: TObject); 377 377 begin … … 385 385 Game := TGame.Create; 386 386 Game.OnMove := DoOnMove; 387 Game.OnMoveUpdated := DoMoveUpdated; 387 388 Game.OnWin := DoOnWin; 388 389 Game.OnNewTurn := GameNewTurnExecute; … … 421 422 FormMain.Redraw; 422 423 if FormCharts.Visible then FormCharts.Redraw; 424 if FormUnitMoves.Visible then FormUnitMoves.ReloadList; 423 425 end; 424 426 … … 430 432 FormMain.Redraw; 431 433 if FormCharts.Visible then FormCharts.Redraw; 434 if FormUnitMoves.Visible then FormUnitMoves.ReloadList; 432 435 ProcessComputerTurns; 433 436 UpdateActions; … … 439 442 CurrentClient := Game.CurrentPlayer.Client; 440 443 if FormCharts.Visible then FormCharts.Redraw; 444 if FormUnitMoves.Visible then FormUnitMoves.ReloadList; 445 end; 446 447 procedure TCore.DoMoveUpdated(UnitMove: TUnitMove); 448 begin 449 if FormUnitMoves.Visible then FormUnitMoves.ReloadList; 441 450 end; 442 451
Note:
See TracChangeset
for help on using the changeset viewer.