summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-23 11:25:01 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-23 11:25:01 +0000
commit933b0c361d7ee4914b89e725a8886abb5f5e9d2c (patch)
tree6cd9a4618f4a953e519ba9b0af24d1a184e0b501 /crawl-ref
parent82fa0cb1d1d28ae309754c0dbcd620c554f7f1d9 (diff)
downloadcrawl-ref-933b0c361d7ee4914b89e725a8886abb5f5e9d2c.tar.gz
crawl-ref-933b0c361d7ee4914b89e725a8886abb5f5e9d2c.zip
Fixed bad message with RAP_MAGICAL_POWER.
Type safety; this required moving randart_prop_type to enum.h. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2518 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/enum.h36
-rw-r--r--crawl-ref/source/it_use2.cc12
-rw-r--r--crawl-ref/source/item_use.cc14
-rw-r--r--crawl-ref/source/itemprop.cc14
-rw-r--r--crawl-ref/source/mon-util.cc3
-rw-r--r--crawl-ref/source/player.cc4
-rw-r--r--crawl-ref/source/player.h4
-rw-r--r--crawl-ref/source/randart.cc14
-rw-r--r--crawl-ref/source/randart.h50
9 files changed, 78 insertions, 73 deletions
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 98d7caf2e0..02882954c1 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -2102,6 +2102,42 @@ enum pronoun_type
PRONOUN_REFLEXIVE // 4 (reflexive is always lowercase)
};
+enum randart_prop_type
+{
+ RAP_BRAND, // 0
+ RAP_AC,
+ RAP_EVASION,
+ RAP_STRENGTH,
+ RAP_INTELLIGENCE,
+ RAP_DEXTERITY, // 5
+ RAP_FIRE,
+ RAP_COLD,
+ RAP_ELECTRICITY,
+ RAP_POISON,
+ RAP_NEGATIVE_ENERGY, // 10
+ RAP_MAGIC,
+ RAP_EYESIGHT,
+ RAP_INVISIBLE,
+ RAP_LEVITATE,
+ RAP_BLINK, // 15
+ RAP_CAN_TELEPORT,
+ RAP_BERSERK,
+ RAP_MAPPING,
+ RAP_NOISES,
+ RAP_PREVENT_SPELLCASTING, // 20
+ RAP_CAUSE_TELEPORTATION,
+ RAP_PREVENT_TELEPORTATION,
+ RAP_ANGRY,
+ RAP_METABOLISM,
+ RAP_MUTAGENIC, // 25
+ RAP_ACCURACY,
+ RAP_DAMAGE,
+ RAP_CURSED,
+ RAP_STEALTH,
+ RAP_MAGICAL_POWER, // 30
+ RAP_NUM_PROPERTIES
+};
+
enum score_format_type
{
SCORE_TERSE, // one line
diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc
index 81616c23b7..a43fac7311 100644
--- a/crawl-ref/source/it_use2.cc
+++ b/crawl-ref/source/it_use2.cc
@@ -609,17 +609,17 @@ void unuse_randart(const item_def &item)
if (proprt[RAP_AC])
{
- you.redraw_armour_class = 1;
+ you.redraw_armour_class = true;
if (!known[RAP_AC])
{
mprf("You feel less %s.",
- proprt[RAP_AC] > 0? "well-protected" : "vulnerable");
+ proprt[RAP_AC] > 0? "well-protected" : "vulnerable");
}
}
if (proprt[RAP_EVASION])
{
- you.redraw_evasion = 1;
+ you.redraw_evasion = true;
if (!known[RAP_EVASION])
{
mprf("You feel less %s.",
@@ -629,11 +629,11 @@ void unuse_randart(const item_def &item)
if (proprt[RAP_MAGICAL_POWER])
{
- you.redraw_magic_points = 1;
+ you.redraw_magic_points = true;
if (!known[RAP_MAGICAL_POWER])
{
- mprf("You feel your mana capacity %s.", proprt[RAP_EVASION] > 0?
- "decrease" : "increase");
+ mprf("You feel your mana capacity %s.",
+ proprt[RAP_MAGICAL_POWER] > 0 ? "decrease" : "increase");
}
}
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 2dcb74a054..69f8862bde 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -3986,7 +3986,7 @@ void use_randart(item_def &item)
// Only give property messages for previously unknown properties.
if (proprt[RAP_AC])
{
- you.redraw_armour_class = 1;
+ you.redraw_armour_class = true;
if (!known[RAP_AC])
{
mprf("You feel %s.", proprt[RAP_AC] > 0?
@@ -3997,7 +3997,7 @@ void use_randart(item_def &item)
if (proprt[RAP_EVASION])
{
- you.redraw_evasion = 1;
+ you.redraw_evasion = true;
if (!known[RAP_EVASION])
{
mprf("You feel somewhat %s.", proprt[RAP_EVASION] > 0?
@@ -4008,11 +4008,11 @@ void use_randart(item_def &item)
if (proprt[RAP_MAGICAL_POWER])
{
- you.redraw_magic_points = 1;
+ you.redraw_magic_points = true;
if (!known[RAP_MAGICAL_POWER])
{
- mprf("You feel your mana capacity %s.", proprt[RAP_EVASION] > 0?
- "increase" : "decrease");
+ mprf("You feel your mana capacity %s.",
+ proprt[RAP_MAGICAL_POWER] > 0? "increase" : "decrease");
randart_wpn_learn_prop(item, RAP_MAGICAL_POWER);
}
}
@@ -4023,7 +4023,9 @@ void use_randart(item_def &item)
modify_stat( STAT_INTELLIGENCE, proprt[RAP_INTELLIGENCE], false, item );
modify_stat( STAT_DEXTERITY, proprt[RAP_DEXTERITY], false, item );
- int stat_props[3] = {RAP_STRENGTH, RAP_INTELLIGENCE, RAP_DEXTERITY};
+ const randart_prop_type stat_props[3] =
+ {RAP_STRENGTH, RAP_INTELLIGENCE, RAP_DEXTERITY};
+
for (int i = 0; i < 3; i++)
if (unknown_proprt(stat_props[i]))
randart_wpn_learn_prop(item, stat_props[i]);
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 1ed8f1cc52..dfd8fde379 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -2048,8 +2048,8 @@ bool gives_ability( const item_def &item )
// check for evokable randart properties
for (int rap = RAP_INVISIBLE; rap <= RAP_MAPPING; rap++)
{
- if (randart_wpn_property( item, rap ))
- return true;
+ if (randart_wpn_property( item, static_cast<randart_prop_type>(rap) ))
+ return true;
}
return false;
@@ -2149,11 +2149,11 @@ bool gives_resistance( const item_def &item )
// check for randart resistances
for (int rap = RAP_FIRE; rap <= RAP_CAN_TELEPORT; rap++)
{
- if (rap == RAP_MAGIC || rap >= RAP_INVISIBLE && rap != RAP_CAN_TELEPORT)
- continue;
-
- if (randart_wpn_property( item, rap ))
- return true;
+ if (rap == RAP_MAGIC || rap >= RAP_INVISIBLE && rap != RAP_CAN_TELEPORT)
+ continue;
+
+ if (randart_wpn_property( item, static_cast<randart_prop_type>(rap) ))
+ return true;
}
return false;
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 95ac1f840e..90613f3a66 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -294,7 +294,8 @@ bool mons_class_flag(int mc, int bf)
return ((me->bitfields & bf) != 0);
} // end mons_class_flag()
-static int scan_mon_inv_randarts( const monsters *mon, int ra_prop )
+static int scan_mon_inv_randarts( const monsters *mon,
+ randart_prop_type ra_prop)
{
int ret = 0;
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 4acec82a45..81b6b7eb51 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -4117,7 +4117,7 @@ int slaying_bonus(char which_affected)
// Checks each equip slot for an evokable item (jewellery or randart).
// Returns true if any of these has the same ability as the one handed in.
-bool items_give_ability(const int slot, char abil)
+bool items_give_ability(const int slot, randart_prop_type abil)
{
for (int i = EQ_WEAPON; i < NUM_EQUIP; i++)
{
@@ -4163,7 +4163,7 @@ bool items_give_ability(const int slot, char abil)
/* Checks each equip slot for a randart, and adds up all of those with
a given property. Slow if any randarts are worn, so avoid where possible. */
-int scan_randarts(char which_property, bool calc_unid)
+int scan_randarts(randart_prop_type which_property, bool calc_unid)
{
int i = 0;
int retval = 0;
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index fcfcb6a0c1..443c6666d6 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -245,8 +245,8 @@ int player_teleport(bool calc_unid = true);
/* ***********************************************************************
* called from: ability - acr - items - misc - spells1 - spells3
* *********************************************************************** */
-bool items_give_ability(const int slot, char abil);
-int scan_randarts(char which_property, bool calc_unid = true);
+bool items_give_ability(const int slot, randart_prop_type abil);
+int scan_randarts(randart_prop_type which_property, bool calc_unid = true);
/* ***********************************************************************
diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc
index a0247791ad..9e99180199 100644
--- a/crawl-ref/source/randart.cc
+++ b/crawl-ref/source/randart.cc
@@ -834,7 +834,8 @@ bool is_fixed_artefact( const item_def &item )
return (false);
}
-unique_item_status_type get_unique_item_status( int base_type, int art )
+unique_item_status_type get_unique_item_status( object_class_type base_type,
+ int art )
{
// Note: for weapons "art" is in item.special,
// for orbs it's the sub_type.
@@ -855,7 +856,7 @@ unique_item_status_type get_unique_item_status( int base_type, int art )
return (UNIQ_NOT_EXISTS);
}
-void set_unique_item_status( int base_type, int art,
+void set_unique_item_status( object_class_type base_type, int art,
unique_item_status_type status )
{
// Note: for weapons "art" is in item.special,
@@ -1419,7 +1420,8 @@ void randart_wpn_properties( const item_def &item,
randart_wpn_properties(item, proprt, known);
}
-int randart_wpn_property( const item_def &item, int prop, bool &_known )
+int randart_wpn_property( const item_def &item, randart_prop_type prop,
+ bool &_known )
{
randart_properties_t proprt;
randart_known_props_t known;
@@ -1431,7 +1433,7 @@ int randart_wpn_property( const item_def &item, int prop, bool &_known )
return ( proprt[prop] );
}
-int randart_wpn_property( const item_def &item, int prop )
+int randart_wpn_property( const item_def &item, randart_prop_type prop )
{
bool known;
@@ -1457,7 +1459,7 @@ int randart_wpn_num_props( const randart_properties_t &proprt )
return num;
}
-void randart_wpn_learn_prop( item_def &item, int prop )
+void randart_wpn_learn_prop( item_def &item, randart_prop_type prop )
{
ASSERT( is_random_artefact( item ) );
ASSERT( item.props.exists( KNOWN_PROPS_KEY ) );
@@ -1474,7 +1476,7 @@ void randart_wpn_learn_prop( item_def &item, int prop )
known_vec[prop] = (bool) true;
}
-bool randart_wpn_known_prop( const item_def &item, int prop )
+bool randart_wpn_known_prop( const item_def &item, randart_prop_type prop )
{
bool known;
randart_wpn_property( item, prop, known );
diff --git a/crawl-ref/source/randart.h b/crawl-ref/source/randart.h
index 27ff3a3b19..7658bce3c7 100644
--- a/crawl-ref/source/randart.h
+++ b/crawl-ref/source/randart.h
@@ -12,45 +12,8 @@
#ifndef RANDART_H
#define RANDART_H
-#include "enum.h"
#include "externs.h"
-enum randart_prop_type
-{
- RAP_BRAND, // 0
- RAP_AC,
- RAP_EVASION,
- RAP_STRENGTH,
- RAP_INTELLIGENCE,
- RAP_DEXTERITY, // 5
- RAP_FIRE,
- RAP_COLD,
- RAP_ELECTRICITY,
- RAP_POISON,
- RAP_NEGATIVE_ENERGY, // 10
- RAP_MAGIC,
- RAP_EYESIGHT,
- RAP_INVISIBLE,
- RAP_LEVITATE,
- RAP_BLINK, // 15
- RAP_CAN_TELEPORT,
- RAP_BERSERK,
- RAP_MAPPING,
- RAP_NOISES,
- RAP_PREVENT_SPELLCASTING, // 20
- RAP_CAUSE_TELEPORTATION,
- RAP_PREVENT_TELEPORTATION,
- RAP_ANGRY,
- RAP_METABOLISM,
- RAP_MUTAGENIC, // 25
- RAP_ACCURACY,
- RAP_DAMAGE,
- RAP_CURSED,
- RAP_STEALTH,
- RAP_MAGICAL_POWER, // 30
- RAP_NUM_PROPERTIES
-};
-
// used in files.cc, newgame.cc, randart.cc {dlb}
#define NO_UNRANDARTS 53
#define RA_PROPERTIES RAP_NUM_PROPERTIES
@@ -64,8 +27,9 @@ bool is_random_artefact( const item_def &item );
bool is_unrandom_artefact( const item_def &item );
bool is_fixed_artefact( const item_def &item );
-unique_item_status_type get_unique_item_status( int base_type, int type );
-void set_unique_item_status( int base_type, int type,
+unique_item_status_type get_unique_item_status( object_class_type base_type,
+ int type );
+void set_unique_item_status( object_class_type base_type, int type,
unique_item_status_type status );
/* ***********************************************************************
@@ -112,16 +76,16 @@ void randart_wpn_properties( const item_def &item,
void randart_wpn_properties( const item_def &item,
randart_properties_t &proprt );
-int randart_wpn_property( const item_def &item, int prop,
+int randart_wpn_property( const item_def &item, randart_prop_type prop,
bool &known );
-int randart_wpn_property( const item_def &item, int prop );
+int randart_wpn_property( const item_def &item, randart_prop_type prop );
int randart_wpn_num_props( const item_def &item );
int randart_wpn_num_props( const randart_properties_t &proprt );
-void randart_wpn_learn_prop( item_def &item, int prop );
-bool randart_wpn_known_prop( item_def &item, int prop );
+void randart_wpn_learn_prop( item_def &item, randart_prop_type prop );
+bool randart_wpn_known_prop( item_def &item, randart_prop_type prop );
/* ***********************************************************************
* called from: dungeon