Changeset 236 for trunk/Forms/UFormClient.pas
- Timestamp:
- Sep 20, 2018, 3:33:04 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormClient.pas
r235 r236 169 169 R: TRect; 170 170 StartP: TPoint; 171 VS: TPoint;172 171 CountP: TPoint; 173 172 X, Y: Integer; … … 193 192 194 193 if Game.CyclicMap then begin 195 VS := View.CellToCanvasPos(Game.Map.Size);196 194 TempView := TView.Create; 197 195 TempView.Game := Game; … … 493 491 OldCell: TPlayerCell; 494 492 CellPos: TPoint; 493 P: TPoint; 494 R: TRect; 495 495 begin 496 496 if Assigned(Client) then begin 497 P := TPoint.Create(X, Y); 497 498 if MoveActive then 498 499 if (Abs(StartMousePoint.X - X) > Trunc(Screen.PixelsPerInch * MouseMinDiff)) or 499 500 (Abs(StartMousePoint.Y - Y) > Trunc(Screen.PixelsPerInch * MouseMinDiff)) then 500 501 with Client do begin 501 View.SourceRect := TRect.CreateBounds(TPoint.Create(Trunc(StartViewPoint.X + (StartMousePoint.X - X) / View.Zoom), 502 View.SourceRect := TRect.CreateBounds(TPoint.Create( 503 Trunc(StartViewPoint.X + (StartMousePoint.X - X) / View.Zoom), 502 504 Trunc(StartViewPoint.Y + (StartMousePoint.Y - Y) / View.Zoom)), 503 505 View.SourceRect.Size); … … 507 509 OldCell := Client.View.FocusedCell; 508 510 with Core.Game do 509 if Assigned(Client.ControlPlayer) then 510 Cell := Client.ControlPlayer.PlayerMap.PosToCell(Client.View.CanvasToCellPos(TPoint.Create(X, Y))); 511 //else Cell := Client.Game.Map.PosToCell(Client.View.CanvasToCellPos(TPoint.Create(X, Y)), Client.View); 511 if Assigned(Client.ControlPlayer) then begin 512 if Map.Cyclic then begin 513 R := Client.View.CellToCanvasRect(Map.PixelRect); 514 CellPos := TPoint.Create( 515 ModNeg(P.X - R.P1.X, R.Size.X) + R.P1.X, 516 ModNeg(P.Y - R.P1.Y, R.Size.Y) + R.P1.Y 517 ); 518 Cell := Client.ControlPlayer.PlayerMap.PosToCell( 519 Client.View.CanvasToCellPos(CellPos)); 520 end else begin 521 Cell := Client.ControlPlayer.PlayerMap.PosToCell( 522 Client.View.CanvasToCellPos(P)); 523 end; 524 end; 512 525 if Assigned(Cell) then begin 513 526 Client.View.FocusedCell := Cell; … … 530 543 (Abs(StartMousePoint.Y - Y) < Trunc(Screen.PixelsPerInch * MouseMinDiff)) then begin 531 544 if Core.Game.Running and (Core.Game.CurrentPlayer.Mode = pmHuman) and 532 545 (Core.Game.CurrentPlayer = Client.ControlPlayer) then begin 533 546 Client.View.SelectCell(TPoint.Create(X, Y), Client.ControlPlayer, Shift); 534 547 Redraw;
Note:
See TracChangeset
for help on using the changeset viewer.