From d520132440a8d2b27e6fd8687246678328bf6b6f Mon Sep 17 00:00:00 2001 From: mdb Date: Thu, 18 Oct 2001 02:17:30 +0000 Subject: [PATCH] Allow reenabling of piecen placement and paint a white rectangle around the last placed tile. git-svn-id: https://samskivert.googlecode.com/svn/trunk@369 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../atlanti/client/AtlantiBoard.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiBoard.java b/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiBoard.java index 7e6ea45d..141dddd5 100644 --- a/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiBoard.java +++ b/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiBoard.java @@ -1,5 +1,5 @@ // -// $Id: AtlantiBoard.java,v 1.10 2001/10/17 23:27:52 mdb Exp $ +// $Id: AtlantiBoard.java,v 1.11 2001/10/18 02:17:30 mdb Exp $ package com.threerings.venison; @@ -111,6 +111,9 @@ public class VenisonBoard // add the tile _tiles.add(tile); + // reference this as our most recently placed tile + _lastPlacedTile = tile; + // resort the list Collections.sort(_tiles); @@ -185,6 +188,15 @@ public class VenisonBoard _placingPiecen = false; } + /** + * If we freed up a placeable piecen that we didn't have when we + * placed our tile, this can be called to reenable piecen placement. + */ + public void enablePiecenPlacement () + { + _placingPiecen = true; + } + /** * Sets the tile to be placed on the board. The tile will be displayed * in the square under the mouse cursor where it can be legally placed @@ -272,6 +284,14 @@ public class VenisonBoard g.drawRect(sx, sy, TILE_WIDTH, TILE_HEIGHT); } + // draw a white rectangle around the last placed + if (_lastPlacedTile != null) { + g.setColor(Color.white); + int sx = (_lastPlacedTile.x + _origX) * TILE_WIDTH; + int sy = (_lastPlacedTile.y + _origY) * TILE_HEIGHT; + g.drawRect(sx, sy, TILE_WIDTH, TILE_HEIGHT); + } + // undo our translations g.translate(-_tx, -_ty); @@ -600,6 +620,9 @@ public class VenisonBoard /** The last tile being placed by the user. */ protected VenisonTile _placedTile; + /** The last tile placed on the board via {@link #addTile}. */ + protected VenisonTile _lastPlacedTile; + /** A flag indicating whether or not we're placing a piecen. */ protected boolean _placingPiecen = false;