summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/effects.cc27
-rw-r--r--crawl-ref/source/effects.h2
-rw-r--r--crawl-ref/source/enum.h6
-rw-r--r--crawl-ref/source/item_use.cc16
-rw-r--r--crawl-ref/source/itemname.cc6
-rw-r--r--crawl-ref/source/makeitem.cc9
-rw-r--r--crawl-ref/source/spells1.cc1
7 files changed, 29 insertions, 38 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 1e04e81b36..e04ba8b87e 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -1395,29 +1395,6 @@ bool acquirement(object_class_type force_class, int agent)
return (true);
} // end acquirement()
-// Remove the "empty" autoinscription, if present.
-// Return true if the inscription was there, false otherwise.
-bool remove_empty_inscription( item_def& item )
-{
- const char* empty_inscription = "empty";
- size_t p = item.inscription.find(empty_inscription);
- if ( p != std::string::npos )
- {
- // found it, delete it
- size_t prespace = 0;
- // if preceded by a space, delete that too
- if ( p != 0 && item.inscription[p-1] == ' ' )
- prespace = 1;
- item.inscription =
- item.inscription.substr(0, p - prespace) +
- item.inscription.substr(p + strlen(empty_inscription),
- std::string::npos);
- return true;
- }
- else
- return false;
-}
-
bool recharge_wand(void)
{
if (you.equip[EQ_WEAPON] == -1)
@@ -1431,7 +1408,6 @@ bool recharge_wand(void)
int charge_gain = 0;
if (wand.base_type == OBJ_WANDS)
{
- remove_empty_inscription(wand);
switch (wand.sub_type)
{
case WAND_INVISIBILITY:
@@ -1456,6 +1432,9 @@ bool recharge_wand(void)
break;
}
+ // don't display zap counts any more
+ wand.plus2 = ZAPCOUNT_UNKNOWN;
+
mprf("%s glows for a moment.", wand.name(DESC_CAP_YOUR).c_str());
wand.plus += 1 + random2avg( ((charge_gain - 1) * 3) + 1, 3 );
diff --git a/crawl-ref/source/effects.h b/crawl-ref/source/effects.h
index 19714869d1..f5e9dcd4ce 100644
--- a/crawl-ref/source/effects.h
+++ b/crawl-ref/source/effects.h
@@ -92,6 +92,4 @@ void torment( int caster, int tx, int ty );
int torment_monsters(int x, int y, int pow, int caster);
-bool remove_empty_inscription( item_def& item );
-
#endif
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 7d3bdff599..f0c36af87f 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -3996,6 +3996,12 @@ enum zap_type
NUM_ZAPS // must remain last member {dlb}
};
+enum zap_count_type
+{
+ ZAPCOUNT_EMPTY = -1,
+ ZAPCOUNT_UNKNOWN = -2
+};
+
enum zombie_size_type
{
Z_NOZOMBIE,
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index d8fa35541e..a9df7881e1 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -2551,17 +2551,8 @@ void zap_wand(void)
{
// it's an empty wand, inscribe it that way
canned_msg(MSG_NOTHING_HAPPENS);
+ you.inv[item_slot].plus2 = ZAPCOUNT_EMPTY;
you.turn_is_over = true;
- if ( !item_ident(you.inv[item_slot], ISFLAG_KNOW_PLUSES) )
- {
- if ( you.inv[item_slot].inscription.find("empty") ==
- std::string::npos )
- {
- if ( !you.inv[item_slot].inscription.empty() )
- you.inv[item_slot].inscription += ' ';
- you.inv[item_slot].inscription += "empty";
- }
- }
return;
}
@@ -2654,8 +2645,13 @@ void zap_wand(void)
you.inv[item_slot].sub_type, ID_TRIED_TYPE );
}
+ // take off a charge
you.inv[item_slot].plus--;
+ // increment zap count
+ if ( you.inv[item_slot].plus2 >= 0 )
+ you.inv[item_slot].plus2++;
+
if (get_ident_type( you.inv[item_slot].base_type,
you.inv[item_slot].sub_type ) == ID_KNOWN_TYPE
&& (item_ident( you.inv[item_slot], ISFLAG_KNOW_PLUSES )
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index be82ce922b..c9344ea041 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -1172,6 +1172,12 @@ std::string item_def::name_aux( description_level_type desc,
if (know_pluses)
buff << " (" << it_plus << ")";
+ else if (item_plus2 == ZAPCOUNT_EMPTY)
+ buff << " {empty}";
+ else if (item_plus2 > 0)
+ buff << " {zapped " << item_plus2
+ << ((item_plus2 > 1) ? " times" : " time")
+ << '}';
break;
case OBJ_POTIONS:
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index 8165e0a4ed..f11995ae42 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -2265,7 +2265,14 @@ int items( int allow_uniques, // not just true-false,
// generate charges randomly:
mitm[p].plus = random2avg(range_charges, 3);
- //
+
+ // plus2 tracks how many times the player has zapped it.
+ // If it is -1, then the player knows it's empty.
+ // If it is -2, then the player has messed with it somehow
+ // (presumably by recharging), so don't bother to display the
+ // count.
+ mitm[p].plus2 = 0;
+
// set quantity to one:
quant = 1;
break;
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index 9c783f89c5..014e736af6 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -386,7 +386,6 @@ void identify(int power)
you.inv[item_slot].sub_type, ID_KNOWN_TYPE );
set_ident_flags( you.inv[item_slot], ISFLAG_IDENT_MASK );
- remove_empty_inscription(you.inv[item_slot]);
// output identified item
mpr(you.inv[item_slot].name(DESC_INVENTORY_EQUIP).c_str());