Changeset 126
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r125 r126 52 52 StoredDimension: TControlDimension; 53 53 RegistryContext: TRegistryContext; 54 procedure StartNewGame; 54 55 procedure DoPlayerChange(Sender: TObject); 55 56 procedure DoOnMove(CellFrom, CellTo: TCell; var CountOnce, … … 285 286 if Game.CurrentPlayer.Mode = pmComputer then begin 286 287 Computer := TComputer.Create; 287 Computer.Game := Game; 288 Computer.Process; 289 Computer.Free; 288 try 289 Computer.Game := Game; 290 Computer.Process; 291 finally 292 Computer.Free; 293 end; 290 294 FormMain.Redraw; 291 295 Delay(Trunc((100 - AnimationSpeed) / 100 * 2000)); … … 320 324 if FormNew.ShowModal = mrOk then begin 321 325 FormNew.Save(Game); 322 Game.New; 323 SelectClient; 324 Game.Running := True; 325 FormMain.AZoomAll.Execute; 326 UpdateActions; 326 StartNewGame; 327 327 end; 328 328 end; … … 331 331 begin 332 332 if MessageDlg(SRestartGame, SRestartGameQuestion, mtConfirmation, mbYesNo, 0) = mrYes then begin 333 Game.New; 334 Game.Running := True; 335 FormMain.AZoomAll.Execute; 336 FormMain.Redraw; 337 UpdateActions; 333 StartNewGame; 338 334 end; 339 335 end; … … 396 392 end; 397 393 394 procedure TCore.StartNewGame; 395 begin 396 Game.New; 397 SelectClient; 398 Game.Running := True; 399 FormMain.Redraw; 400 UpdateActions; 401 end; 402 398 403 procedure TCore.DoPlayerChange(Sender: TObject); 399 404 begin … … 413 418 FInitialized := True; 414 419 LoadConfig; 415 for I := 0 to Game.Clients.Count - 1 do416 TClient(Game.Clients[I]).View.DestRect := Rect(0, 0, FormMain.PaintBox1.Width,417 FormMain.PaintBox1.Height);418 420 Game.LoadConfig(XMLConfig1, 'Game'); 419 421 … … 421 423 ScaleDPI; 422 424 423 if Game.FileName = '' then begin 424 Game.New; 425 SelectClient; 426 Game.Running := True; 427 FormMain.AZoomAll.Execute; 428 end; 425 if Game.FileName = '' then StartNewGame; 429 426 end; 430 427 -
trunk/UGame.pas
r125 r126 128 128 procedure SelectCell(Pos: TPoint; Player: TPlayer; ShiftState: TShiftState); 129 129 procedure CenterMap; 130 procedure CenterPlayerCity(Player: TPlayer); 130 131 function CanvasToCellPos(Pos: TPoint): TPoint; 131 132 function CellToCanvasPos(Pos: TPoint): TPoint; … … 2226 2227 end; 2227 2228 2229 procedure TView.CenterPlayerCity(Player: TPlayer); 2230 begin 2231 SourceRect := Bounds(Player.StartCell.PosPx.X - (SourceRect.Right - SourceRect.Left) div 2, 2232 Player.StartCell.PosPx.Y - (SourceRect.Bottom - SourceRect.Top) div 2, 2233 SourceRect.Right - SourceRect.Left, 2234 SourceRect.Bottom - SourceRect.Top); 2235 end; 2236 2228 2237 procedure TPlayer.Paint(Canvas: TCanvas; View: TView); 2229 2238 begin … … 3048 3057 View.Clear; 3049 3058 View.Zoom := 1; 3050 View.CenterMap; 3059 if Assigned(ControlPlayer) then View.CenterPlayerCity(ControlPlayer) 3060 else View.CenterMap; 3051 3061 end; 3052 3062 end;
Note:
See TracChangeset
for help on using the changeset viewer.