Changeset 8


Ignore:
Timestamp:
Feb 12, 2014, 9:32:54 PM (11 years ago)
Author:
chronos
Message:
  • Fixed: Cell selection and deselection on left mouse button up.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/UFormMain.pas

    r7 r8  
    137137    StartViewPoint := Point(TPlayer(Game.Players[0]).View.Left, TPlayer(Game.Players[0]).View.Top);
    138138    MoveActive := True;
    139     TPlayer(Game.Players[0]).SelectCell(Point(X, Y));
    140     Redraw;
    141139  end;
    142140end;
     
    155153      TPlayer(Game.Players[0]).View.Right - TPlayer(Game.Players[0]).View.Left,
    156154      TPlayer(Game.Players[0]).View.Bottom - TPlayer(Game.Players[0]).View.Top);
    157     TPlayer(Game.Players[0]).SelectCell(Point(X, Y));
    158155    Redraw;
    159156  end;
     
    163160  Shift: TShiftState; X, Y: Integer);
    164161begin
     162  if (StartMousePoint.X = X) and (StartMousePoint.Y = Y) then begin
     163    TPlayer(Game.Players[0]).SelectCell(Point(X, Y));
     164    Redraw;
     165  end;
    165166  MoveActive := False;
    166167end;
  • trunk/UGame.pas

    r7 r8  
    110110
    111111procedure TPlayer.SelectCell(Pos: TPoint);
    112 begin
    113   SelectedCell := Game.Map.PosToCell(Pos, View, ViewZoom);
     112var
     113  NewSelectedCell: TPoint;
     114begin
     115  NewSelectedCell := Game.Map.PosToCell(Pos, View, ViewZoom);
     116  if (NewSelectedCell.X = SelectedCell.X) and (NewSelectedCell.Y = SelectedCell.Y) then
     117    SelectedCell := Point(-1, -1)
     118    else SelectedCell := NewSelectedCell;
    114119end;
    115120
Note: See TracChangeset for help on using the changeset viewer.