[vassalengine-devel] catching every GamePiece added to/moved on/removed from a map
Brought to you by:
rodneykinney,
uckelman
From: Joel U. <uck...@no...> - 2007-05-28 20:20:54
|
I have a BSP tree ready to use for drawing pieces on maps now, but I'm having a devil of a time finding all of the places in Map where a piece can be added to, moved within, or removed from a Map. I think I've covered all of the removals: pieces.remove() is called in Map.removePiece() and pieces.clear() is called in Map.setup(). Other than those two, I don't see any way for a piece to leave a map. What I'm unsure about are on-map moves, additions of pieces to a Map, and especially creation of pieces on a Map due to loading a game. I think that Map.addPiece() does something only when a piece isn't already on a Map. However, it seems not to be called when saved games are loaded. I think that all on-map moves go through Map.placeAt(), as do drops from the piece tray, but I'm having a hard time getting the actual token which ends up on Map in the case of drops. What I keep getting is the actual piece plus some phantom one (possibly created for the drag? or is this the one which is in the tray?). -- J. |