From c8b2f7212be9941aef124eacd244f58593a9e2e6 Mon Sep 17 00:00:00 2001 From: Dave Hoover Date: Thu, 19 Jul 2007 22:38:32 +0000 Subject: [PATCH] Make it easier for drop puzzles to implement their own fancy drop logic if they've got that burning need to do something out of the ordinary. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@371 c613c5cb-e716-0410-b11b-feb51c14d237 --- .../puzzle/drop/client/DropControllerDelegate.java | 12 ++++++++++-- .../puzzle/drop/server/DropManagerDelegate.java | 14 +++++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/java/com/threerings/puzzle/drop/client/DropControllerDelegate.java b/src/java/com/threerings/puzzle/drop/client/DropControllerDelegate.java index 3f6e5465..a638c890 100644 --- a/src/java/com/threerings/puzzle/drop/client/DropControllerDelegate.java +++ b/src/java/com/threerings/puzzle/drop/client/DropControllerDelegate.java @@ -144,7 +144,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate // create the piece dropper if appropriate PieceDropLogic pdl = getPieceDropLogic(); if (pdl != null) { - _dropper = new PieceDropper(pdl); + _dropper = getPieceDropper(pdl); } } @@ -867,7 +867,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate } /** - * Returns the piece dropper used to drop any pieces that need + * Returns the piece drop logic used to drop any pieces that need * dropping in the board. Derived classes that intend to make use of * {@link #dropPieces} must implement this method and return a * reference to their game-specific piece dropper implementation. @@ -877,6 +877,14 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate return null; } + /** + * Returns the piece dropper used to drop any pieces that need dropping in the board. + */ + protected PieceDropper getPieceDropper (PieceDropLogic logic) + { + return new PieceDropper(logic); + } + // documentation inherited public void tick (long tickStamp) { diff --git a/src/java/com/threerings/puzzle/drop/server/DropManagerDelegate.java b/src/java/com/threerings/puzzle/drop/server/DropManagerDelegate.java index 94a5c210..84a2a857 100644 --- a/src/java/com/threerings/puzzle/drop/server/DropManagerDelegate.java +++ b/src/java/com/threerings/puzzle/drop/server/DropManagerDelegate.java @@ -106,7 +106,7 @@ public abstract class DropManagerDelegate extends PuzzleManagerDelegate // create the piece dropper if appropriate PieceDropLogic pdl = getPieceDropLogic(); if (pdl != null) { - _dropper = new PieceDropper(pdl); + _dropper = getPieceDropper(pdl); } } @@ -132,14 +132,22 @@ public abstract class DropManagerDelegate extends PuzzleManagerDelegate } /** - * Returns the piece drop logic used to drop any pieces that need - * dropping in the board. + * Returns the piece drop logic used to drop any pieces that need dropping in the board. */ protected PieceDropLogic getPieceDropLogic () { return null; } + /** + * Returns the piece dropper used to drop any pieces that need dropping in the board. + */ + protected PieceDropper getPieceDropper (PieceDropLogic logic) + { + return new PieceDropper(logic); + } + + /** * This method should be called by derived classes whenever the player * successfully places a drop block.