Changeset 414
- Timestamp:
- Jan 10, 2025, 4:24:19 PM (3 hours ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Core.pas
r408 r414 213 213 ThemeManager1.Theme := ThemeManager1.Themes.FindByName(String(XmlConfig1.GetValue('Theme', 'System'))); 214 214 LastOpenedList1.LoadFromXMLConfig(XMLConfig1, 'RecentFiles'); 215 DevelMode := XMLConfig1.GetValue('DevelMode', false);215 DevelMode := XMLConfig1.GetValue('DevelMode', False); 216 216 AnimationSpeed := XMLConfig1.GetValue('AnimationSpeed', 50); 217 217 Translator1.Language := Translator1.Languages.SearchByCode(String(XMLConfig1.GetValue('Language', ''))); -
trunk/Forms/FormClient.pas
r404 r414 320 320 if RedrawPending and not Drawing then begin 321 321 Drawing := True; 322 if not Core.Core.DevelMode then RedrawPending := False; 322 RedrawPending := False; 323 Timer1.Enabled := False; 323 324 TimerPeriod := (9 * TimerPeriod + (Now - LastTimerTime)) / 10; 324 325 LastTimerTime := Now; … … 358 359 begin 359 360 Redraw; 361 Core.Core.FormMain.UpdateInterface; 360 362 end; 361 363 … … 421 423 begin 422 424 RedrawPending := True; 425 Timer1.Enabled := True; 423 426 end; 424 427 -
trunk/Forms/FormMain.lfm
r364 r414 1 1 object FormMain: TFormMain 2 2 Left = 534 3 Height = 9 593 Height = 925 4 4 Top = 223 5 5 Width = 1491 6 6 Caption = 'xTactics' 7 ClientHeight = 9 597 ClientHeight = 925 8 8 ClientWidth = 1491 9 9 DesignTimePPI = 144 … … 97 97 object PanelMain: TPanel 98 98 Left = 0 99 Height = 91999 Height = 885 100 100 Top = 40 101 101 Width = 1491 … … 107 107 object MainMenu1: TMainMenu 108 108 Images = Core.ImageListSmall 109 Left = 224110 Top = 48109 Left = 88 110 Top = 112 111 111 object MenuItem1: TMenuItem 112 112 Caption = 'Game' … … 233 233 end 234 234 end 235 object Timer1: TTimer236 Interval = 20237 OnTimer = Timer1Timer238 Left = 128239 Top = 263240 end241 235 object ActionList1: TActionList 242 236 Images = Core.ImageListSmall 243 Left = 280244 Top = 1 52237 Left = 88 238 Top = 184 245 239 object AToolBarBigIcons: TAction 246 240 Caption = 'Toolbar big icons' … … 265 259 end 266 260 object PopupMenuToolbar: TPopupMenu 267 Left = 4 52268 Top = 98261 Left = 432 262 Top = 112 269 263 object MenuItem18: TMenuItem 270 264 Action = AToolBarBigIcons … … 272 266 end 273 267 object PopupMenuOpenRecent: TPopupMenu 274 Left = 4 48275 Top = 251268 Left = 432 269 Top = 184 276 270 end 277 271 end -
trunk/Forms/FormMain.pas
r364 r414 67 67 PopupMenuToolbar: TPopupMenu; 68 68 Separator1: TMenuItem; 69 Timer1: TTimer;70 69 ToolBar1: TToolBar; 71 70 ToolButton1: TToolButton; … … 94 93 procedure FormDestroy(Sender: TObject); 95 94 procedure EraseBackground(DC: HDC); override; 96 procedure Timer1Timer(Sender: TObject);97 95 private 98 96 FormActivated: Boolean; … … 106 104 FormUnitMoves: TFormUnitMoves; 107 105 FormCharts: TFormCharts; 106 procedure UpdateInterface; 108 107 procedure LoadConfig(Config: TXmlConfig; Path: string); 109 108 procedure SaveConfig(Config: TXmlConfig; Path: string); … … 128 127 begin 129 128 // Do nothing, all background space covered by controls 130 end;131 132 procedure TFormMain.Timer1Timer(Sender: TObject);133 var134 NewCaption: string;135 begin136 NewCaption := 'xTactics';137 if Assigned(Core.Core.Game.CurrentPlayer) then138 NewCaption := Core.Core.Game.CurrentPlayer.Name + ' - ' + STurn + ' ' +139 IntToStr(Core.Core.Game.TurnCounter) + ' - ' + NewCaption;140 Caption := NewCaption;141 129 end; 142 130 … … 311 299 end; 312 300 301 procedure TFormMain.UpdateInterface; 302 var 303 NewCaption: string; 304 begin 305 NewCaption := 'xTactics'; 306 if Assigned(Core.Core.Game.CurrentPlayer) then 307 NewCaption := Core.Core.Game.CurrentPlayer.Name + ' - ' + STurn + ' ' + 308 IntToStr(Core.Core.Game.TurnCounter) + ' - ' + NewCaption; 309 Caption := NewCaption; 310 end; 311 313 312 procedure TFormMain.FormShow(Sender: TObject); 314 313 begin -
trunk/Game.pas
r407 r414 59 59 procedure WinObjectiveMapPrepare; 60 60 procedure BuildCity(Cell: TCell); 61 procedure DoChange; 61 62 public 62 63 GameSystem: TGameSystem; … … 510 511 end; 511 512 513 procedure TGame.DoChange; 514 begin 515 if Assigned(FOnChange) then 516 FOnChange(Self); 517 end; 518 512 519 procedure TGame.Assign(Source: TGame); 513 520 begin … … 678 685 FreeAndNil(Doc); 679 686 end; 687 DoChange; 680 688 end; 681 689 … … 851 859 CurrentPlayer.RemoveInvalidMoves; 852 860 CurrentPlayer.InitUnitMoves; 853 if Assigned(FOnChange) then 854 FOnChange(Self); 861 DoChange; 855 862 end; 856 863 … … 1009 1016 1010 1017 ComputePlayerStats; 1018 DoChange; 1011 1019 end; 1012 1020 … … 1015 1023 Running := False; 1016 1024 if Assigned(OnWin) then OnWin(Winner); 1025 DoChange; 1017 1026 end; 1018 1027 -
trunk/Packages/PinConnection/CommThread.pas
r340 r414 12 12 TReceiveDataEvent = procedure(Stream: TMemoryStream) of object; 13 13 14 { TCommThreadReceive Thread }15 16 TCommThreadReceive Thread = class(TTermThread)14 { TCommThreadReceiveDataThread } 15 16 TCommThreadReceiveDataThread = class(TTermThread) 17 17 public 18 18 Parent: TCommThread; … … 24 24 end; 25 25 26 { TCommThreadReceiveStatusThread } 27 28 TCommThreadReceiveStatusThread = class(TTermThread) 29 public 30 Parent: TCommThread; 31 Stream: TBinarySerializer; 32 procedure Execute; override; 33 constructor Create(CreateSuspended: Boolean; 34 const StackSize: SizeUInt = DefaultStackSize); 35 destructor Destroy; override; 36 end; 37 26 38 { TCommThread } 27 39 … … 29 41 private 30 42 //FOnReceiveData: TReceiveDataEvent; 31 FReceiveThread: TCommThreadReceiveThread; 43 FReceiveDataThread: TCommThreadReceiveDataThread; 44 FReceiveStatusThread: TCommThreadReceiveStatusThread; 32 45 FInputBuffer: TBinarySerializer; 33 46 FInputBufferLock: TCriticalSection; … … 91 104 92 105 if AValue then begin 93 FReceiveThread := TCommThreadReceiveThread.Create(True); 94 FReceiveThread.FreeOnTerminate := False; 95 FReceiveThread.Parent := Self; 96 FReceiveThread.Name := 'CommThread'; 97 FReceiveThread.Start; 106 FReceiveDataThread := TCommThreadReceiveDataThread.Create(True); 107 FReceiveDataThread.FreeOnTerminate := False; 108 FReceiveDataThread.Parent := Self; 109 FReceiveDataThread.Name := 'CommThreadData'; 110 FReceiveDataThread.Start; 111 112 FReceiveStatusThread := TCommThreadReceiveStatusThread.Create(True); 113 FReceiveStatusThread.FreeOnTerminate := False; 114 FReceiveStatusThread.Parent := Self; 115 FReceiveStatusThread.Name := 'CommThreadStatus'; 116 FReceiveStatusThread.Start; 98 117 end else begin 99 FreeAndNil(FReceiveThread); 118 FreeAndNil(FReceiveDataThread); 119 FreeAndNil(FReceiveStatusThread); 100 120 end; 101 121 inherited; … … 134 154 end; 135 155 136 { TCommThreadReceiveThread } 137 138 procedure TCommThreadReceiveThread.Execute; 139 var 140 TempStatus: Integer; 141 DoSleep: Boolean; 156 { TCommThreadReceiveDataThread } 157 158 procedure TCommThreadReceiveDataThread.Execute; 142 159 begin 143 160 with Parent do 144 161 repeat 145 DoSleep := True;146 162 // Check if new data arrived 147 if FDataAvailable.WaitFor(0) = wrSignaled then begin 148 DoSleep := False; 163 if FDataAvailable.WaitFor(100) = wrSignaled then begin 149 164 try 150 165 FInputBufferLock.Acquire; … … 157 172 Pin.Send(Stream.List); 158 173 end; 159 174 until Terminated; 175 end; 176 177 constructor TCommThreadReceiveDataThread.Create(CreateSuspended: Boolean; 178 const StackSize: SizeUInt); 179 begin 180 inherited; 181 Stream := TBinarySerializer.Create; 182 Stream.List := TListByte.Create; 183 Stream.OwnsList := True; 184 end; 185 186 destructor TCommThreadReceiveDataThread.Destroy; 187 begin 188 FreeAndNil(Stream); 189 inherited; 190 end; 191 192 { TCommThreadReceiveStatusThread } 193 194 procedure TCommThreadReceiveStatusThread.Execute; 195 var 196 TempStatus: Integer; 197 begin 198 with Parent do 199 repeat 160 200 // Check if state changed 161 if FStatusEvent.WaitFor(0) = wrSignaled then begin 162 DoSleep := False; 201 if FStatusEvent.WaitFor(100) = wrSignaled then begin 163 202 try 164 203 FInputBufferLock.Acquire; … … 170 209 Pin.Status := TempStatus; 171 210 end; 172 if not Terminated and DoSleep then begin173 Sleep(1);174 end;175 211 until Terminated; 176 212 end; 177 213 178 constructor TCommThreadReceive Thread.Create(CreateSuspended: Boolean;214 constructor TCommThreadReceiveStatusThread.Create(CreateSuspended: Boolean; 179 215 const StackSize: SizeUInt); 180 216 begin … … 185 221 end; 186 222 187 destructor TCommThreadReceive Thread.Destroy;223 destructor TCommThreadReceiveStatusThread.Destroy; 188 224 begin 189 225 FreeAndNil(Stream);
Note:
See TracChangeset
for help on using the changeset viewer.