From 725cb5b4d5a3ade5c5e7b04a6210cedc839c2bdd Mon Sep 17 00:00:00 2001 From: zelgadis Date: Wed, 19 Sep 2007 01:19:56 +0000 Subject: Added new commands "re-do previous command" (bound to `) and "repeat next command" (bound to 0). Though this is just an interface change, it changes code in the core input processing function (input() in acr.cc), and also messes around with the input buffer, so it could probably do with more testing before merging it into the 0.3 branch. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2137 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/items.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'crawl-ref/source/items.cc') diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index bad4a28d7a..e26558acdc 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -68,6 +68,7 @@ #include "spl-util.h" #include "stuff.h" #include "stash.h" +#include "state.h" #include "terrain.h" #include "transfor.h" #include "tutorial.h" @@ -156,6 +157,8 @@ static bool item_ok_to_clean(int item) // unsuccessful cleanup (should be exceedingly rare!) int cull_items(void) { + crawl_state.cancel_cmd_repeat(); + // XXX: Not the prettiest of messages, but the player // deserves to know whenever this kicks in. -- bwr mpr( "Too many items on level, removing some.", MSGCH_WARN ); @@ -261,6 +264,12 @@ bool dec_inv_item_quantity( int obj, int amount ) you.inv[obj].quantity = 0; ret = true; + + // If we're repeating a command, the repetitions used up the + // item stack being repeated on, so stop rather than move onto + // the next stack. + crawl_state.cancel_cmd_repeat(); + crawl_state.cancel_cmd_again(); } else { @@ -280,6 +289,11 @@ bool dec_mitm_item_quantity( int obj, int amount ) if (mitm[obj].quantity <= amount) { destroy_item( obj ); + // If we're repeating a command, the repetitions used up the + // item stack being repeated on, so stop rather than move onto + // the next stack. + crawl_state.cancel_cmd_repeat(); + crawl_state.cancel_cmd_again(); return (true); } -- cgit v1.2.3-54-g00ecf