From: Daniel H. <wik...@us...> - 2006-08-26 21:14:58
|
Update of /cvsroot/arianne/stendhal/src/games/stendhal/server/entity/portal In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv29581/src/games/stendhal/server/entity/portal Modified Files: Door.java Log Message: use TurnNotifier.dontNotify() instead of the turnToClose hack Index: Door.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/server/entity/portal/Door.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Door.java 25 Aug 2006 01:01:19 -0000 1.3 --- Door.java 26 Aug 2006 21:14:56 -0000 1.4 *************** *** 46,50 **** * The turn at which this door should close the next time. */ ! private int turnToClose = 0; public static void generateRPClass() { --- 46,50 ---- * The turn at which this door should close the next time. */ ! // private int turnToClose = 0; public static void generateRPClass() { *************** *** 91,103 **** */ public void open() { - this.open = true; - TurnNotifier turnNotifier = TurnNotifier.get(); ! // remember the turn number, in case someone else uses the door ! // while it is still open; in this time, the door should stay ! // open longer. ! this.turnToClose = turnNotifier.getNumberOfNextTurn() + TURNS_TO_STAY_OPEN; ! turnNotifier.notifyAtTurn(turnToClose, this, null); ! put("open", ""); } --- 91,104 ---- */ public void open() { TurnNotifier turnNotifier = TurnNotifier.get(); ! if (open) { ! // The door is still open because another player just used it. ! // Thus, it is scheduled to auto-close soon. We delay this ! // auto-closing. ! turnNotifier.dontNotify(this, null); ! } ! turnNotifier.notifyInTurns(TURNS_TO_STAY_OPEN, this, null); ! ! open = true; put("open", ""); } *************** *** 118,122 **** public void onUsed(RPEntity user) { if (has("locked") && user.isEquipped(get("locked"))) { ! // open it, even it is already open to reset turnToClose open(); notifyWorldAboutChanges(); --- 119,124 ---- public void onUsed(RPEntity user) { if (has("locked") && user.isEquipped(get("locked"))) { ! // open it, even it is already open to reset the auto-close ! // countdown. open(); notifyWorldAboutChanges(); *************** *** 149,158 **** public void onTurnReached(int currentTurn, String message) { ! // if two players use this turn, we will be called twice. ! // Ignore the first call. ! if (currentTurn == turnToClose) { ! close(); ! notifyWorldAboutChanges(); ! } } --- 151,156 ---- public void onTurnReached(int currentTurn, String message) { ! close(); ! notifyWorldAboutChanges(); } |