From 7879cb06150dfe95cc3a6f690f0258936d42ff54 Mon Sep 17 00:00:00 2001 From: haranp Date: Thu, 18 Sep 2008 22:01:50 +0000 Subject: [2059553]: recharged wands have their zap counts reinitialized. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6948 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/effects.cc | 6 +++--- crawl-ref/source/item_use.cc | 3 +++ crawl-ref/source/itemname.cc | 2 ++ crawl-ref/source/itemprop.h | 3 ++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 154efed495..feb8da6325 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -1763,8 +1763,8 @@ bool recharge_wand(int item_slot) break; } - // Don't display zap counts any more. - wand.plus2 = ZAPCOUNT_UNKNOWN; + // Reinitialize zap counts. + wand.plus2 = ZAPCOUNT_RECHARGED; const int new_charges = std::max( @@ -1775,7 +1775,7 @@ bool recharge_wand(int item_slot) const bool charged = new_charges > wand.plus; - std::string desc = ""; + std::string desc; if (charged && item_ident(wand, ISFLAG_KNOW_PLUSES)) { snprintf(info, INFO_SIZE, " and now has %d charges", new_charges); diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 80e630bc2d..ac9f0c6e25 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -3546,6 +3546,9 @@ void zap_wand( int slot ) // Take off a charge. wand.plus--; + // Zap counts count from the last recharge. + if (wand.plus2 == ZAPCOUNT_RECHARGED) + wand.plus2 = 0; // Increment zap count. if (wand.plus2 >= 0) wand.plus2++; diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc index af607b4389..2329c7aa6a 100644 --- a/crawl-ref/source/itemname.cc +++ b/crawl-ref/source/itemname.cc @@ -1280,6 +1280,8 @@ std::string item_def::name_aux( description_level_type desc, { if (item_plus2 == ZAPCOUNT_EMPTY) buff << " {empty}"; + else if (item_plus2 == ZAPCOUNT_RECHARGED) + buff << " {recharged}"; else if (item_plus2 > 0) buff << " {zapped: " << item_plus2 << '}'; } diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h index 0ab26097ed..c31e9e11fa 100644 --- a/crawl-ref/source/itemprop.h +++ b/crawl-ref/source/itemprop.h @@ -566,7 +566,8 @@ enum wand_type // mitm[].subtype enum zap_count_type { ZAPCOUNT_EMPTY = -1, - ZAPCOUNT_UNKNOWN = -2 + ZAPCOUNT_UNKNOWN = -2, + ZAPCOUNT_RECHARGED = -3 }; void init_properties(void); -- cgit v1.2.3-54-g00ecf