--- deliantra/server/common/item.C 2010/04/04 02:51:56 1.79
+++ deliantra/server/common/item.C 2012/10/29 23:55:52 1.96
@@ -1,24 +1,24 @@
/*
* This file is part of Deliantra, the Roguelike Realtime MMORPG.
- *
- * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
+ *
+ * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
* Copyright (©) 2002 Mark Wedel & Crossfire Development Team
* Copyright (©) 1992 Frank Tore Johansen
- *
+ *
* Deliantra is free software: you can redistribute it and/or modify it under
* the terms of the Affero GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the Affero GNU General Public License
* and the GNU General Public License along with this program. If not, see
* .
- *
+ *
* The authors can be reached via e-mail to
*/
@@ -51,21 +51,9 @@
*/
// see include/object.h
Body_Locations body_locations[NUM_BODY_LOCATIONS] = {
- {KW_body_skill , "You can use it as your skill" , "It is used as a skill"},
- {KW_body_combat , "You can wield it as your weapon" , "It is used as a combat weapon"},
- {KW_body_range , "You can use it as your range weapon" , "It is used as a range weapon"},
- {KW_body_shield , "You can wield it as a shield" , "It is used as a shield"},
- {KW_body_arm , "You can put it on your arm" , "It goes on a human's arm"},
- {KW_body_torso , "You can wear it on your body" , "It goes on a human's torso"},
- {KW_body_head , "You can wear it on your head" , "It goes on a human's head"},
- {KW_body_neck , "You can wear it around your neck" , "It goes around a human's neck"},
- {KW_body_finger , "You can wear it on your finger" , "It goes on a human's finger"} ,
- {KW_body_shoulder, "You can wear it around your shoulders", "It goes around a human's shoulders"},
- {KW_body_foot , "You can put it on your foot" , "It goes on a human's foot"},
- {KW_body_hand , "You can put it on your hand" , "It goes on a human's hand"},
- {KW_body_wrist , "You can wear it around your wrist" , "It goes around a human's wrist"},
- {KW_body_waist , "You can wear it around your waist" , "It goes around a human's waist"},
-/*{"body_dragon_torso", "your body", "a dragon's body"} */
+# define def(name, use, nonuse) { # name, KW_body_ ## name, use, nonuse },
+# include "slotinc.h"
+# undef def
};
static char numbers_10[10][20] = {
@@ -73,14 +61,14 @@
"eighty", "ninety"
};
-static char levelnumbers[21][20] = {
+static char ordnumbers[21][20] = {
"zeroth", "first", "second", "third", "fourth", "fifth", "sixth", "seventh",
"eighth", "ninth", "tenth", "eleventh", "twelfth", "thirteenth",
- "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteen",
- "nineteen", "twentieth"
+ "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth",
+ "nineteenth", "twentieth"
};
-static char levelnumbers_10[11][20] = {
+static char ordnumbers_10[11][20] = {
"zeroth", "tenth", "twentieth", "thirtieth", "fortieth", "fiftieth", "sixtieth",
"seventieth", "eightieth", "ninetieth"
};
@@ -153,13 +141,14 @@
{SHOP_FLOOR, "shop floor", "shop floors", 0, 0},
{SHOP_MAT, "shop mat", "shop mats", 0, 0},
{RING, "ring", "rings", SK_JEWELER, 0},
- {FLOOR, "floor", "floors", 0, 0},
+// {FLOOR, "floor", "floors", 0, 0},
{FLESH, "flesh", "flesh", SK_WOODSMAN, 0},
{INORGANIC, "inorganic", "inorganics", SK_ALCHEMY, 0},
{SKILL_TOOL, "skill tool", "skill tools", 0, 0},
{LIGHTER, "lighter", "lighters", 0, 0},
{BUILDABLE_WALL, "buildable wall", "buildable walls", 0, 0},
{MISC_OBJECT, "bric-a-brac", "bric-a-brac", 0, 0},
+ {TORCH, "torch", "torches", 0, 0},
{LAMP, "lamp", "lamps", 0, 0},
{DUPLICATOR, "duplicator", "duplicators", 0, 0},
{SPELLBOOK, "spellbook", "spellbooks", SK_LITERACY, 0},
@@ -204,7 +193,7 @@
{ITEM_TRANSFORMER, "item_transformer", "item_transformers", 0, 0},
};
-static const int item_types_size = sizeof (item_types) / sizeof (*item_types);
+static const int item_types_size = array_length (item_types);
/* This curve may be too steep. But the point is that there should
* be tough choices - there is no real point to this if everyone can
@@ -216,10 +205,11 @@
* custom objects can use whatever they want.
*/
static int enc_to_item_power[21] = {
- 0, 0, 1, 2, 3, 4, /* 5 */
- 5, 7, 9, 11, 13, /* 10 */
- 15, 18, 21, 24, 27, /* 15 */
- 30, 35, 40, 45, 50 /* 20 */
+ 0,
+ 0, 1, 2, 3, 4, // 5
+ 5, 7, 9, 11, 13, // 10
+ 15, 18, 21, 24, 27, // 15
+ 30, 35, 40, 45, 50 // 20
};
int
@@ -228,6 +218,51 @@
return enc_to_item_power [clamp (ench, 0, 20)];
}
+static const struct need_identify_types : typeset
+{
+ need_identify_types ()
+ {
+ set (RING);
+ set (WAND);
+ set (ROD);
+ set (HORN);
+ set (SCROLL);
+ set (SKILL);
+ set (SKILLSCROLL);
+ set (SPELLBOOK);
+ set (FOOD);
+ set (POTION);
+ set (BOW);
+ set (ARROW);
+ set (WEAPON);
+ set (ARMOUR);
+ set (SHIELD);
+ set (HELMET);
+ set (AMULET);
+ set (BOOTS);
+ set (GLOVES);
+ set (BRACERS);
+ set (GIRDLE);
+ set (CONTAINER);
+ set (DRINK);
+ set (FLESH);
+ set (INORGANIC);
+ set (CLOSE_CON);
+ set (CLOAK);
+ set (GEM);
+ set (POWER_CRYSTAL);
+ set (POISON);
+ set (BOOK);
+ set (SKILL_TOOL);
+ }
+} need_identify_types;
+
+bool
+object::need_identify () const
+{
+ return need_identify_types [type];
+}
+
/* This takes an object 'op' and figures out what its item_power
* rating should be. This should only really be used by the treasure
* generation code, and when loading legacy objects. It returns
@@ -309,16 +344,28 @@
return get_power_from_ench (enc);
}
+static const struct get_typedata
+{
+ const typedata *data [NUM_TYPES];
+
+ get_typedata ()
+ {
+ for (int i = 0; i < item_types_size; i++)
+ data [item_types[i].number] = &item_types [i];
+ }
+
+ const typedata *operator ()(int itemtype) const
+ {
+ return data [itemtype];
+ }
+} get_typedata_;
+
/* returns the typedata that has a number equal to itemtype, if there
* isn't one, returns NULL */
const typedata *
get_typedata (int itemtype)
{
- for (int i = 0; i < item_types_size; i++)
- if (item_types[i].number == itemtype)
- return &item_types[i];
-
- return NULL;
+ return get_typedata_ (itemtype);
}
/* returns the typedata that has a name equal to itemtype, if there
@@ -389,25 +436,29 @@
* the number requested (of the form first, second, third...)
*/
const char *
-get_levelnumber (int i)
+ordinal (int i)
{
- static char buf[MAX_BUF];
-
- if (i > 99)
- {
- sprintf (buf, "%d.", i);
- return buf;
- }
+ if (i < 0)
+ return format ("minus %s", ordinal (-i));
if (i < 21)
- return levelnumbers[i];
+ return ordnumbers[i];
- if (!(i % 10))
- return levelnumbers_10[i / 10];
+ int digit = i % 10;
- strcpy (buf, numbers_10[i / 10]);
- strcat (buf, levelnumbers[i % 10]);
- return buf;
+ if (i >= 100)
+ return format (
+ digit == 1 ? "%dst"
+ : digit == 2 ? "%dnd"
+ : digit == 3 ? "%drd"
+ : "%dth",
+ i
+ );
+
+ if (digit == 0)
+ return ordnumbers_10[i / 10];
+ else
+ return format ("%s%s", numbers_10[i / 10], ordnumbers[i % 10]);
}
/*
@@ -427,15 +478,15 @@
ring_desc (const object *op)
{
static dynbuf_text buf; buf.clear ();
- int attr, val, len;
+ int attr, val;
- if (QUERY_FLAG (op, FLAG_IDENTIFIED))
+ if (op->flag [FLAG_IDENTIFIED])
{
for (attr = 0; attr < NUM_STATS; attr++)
if ((val = op->stats.stat (attr)))
buf.printf ("(%s%+d)", short_stat_name[attr], val);
- if (op->stats.exp) buf.printf ("(speed %+lld)", (long long)op->stats.exp);
+ if (op->stats.exp) buf.printf ("(speed %+d)", (int)op->stats.exp);
if (op->stats.wc) buf.printf ("(wc%+d)", op->stats.wc);
if (op->stats.dam) buf.printf ("(dam%+d)", op->stats.dam);
if (op->stats.ac) buf.printf ("(ac%+d)", op->stats.ac);
@@ -448,10 +499,10 @@
if (op->stats.hp) buf.printf ("(regeneration%+d)", op->stats.hp);
if (op->stats.luck) buf.printf ("(luck%+d)", op->stats.luck);
- if (QUERY_FLAG (op, FLAG_LIFESAVE)) buf << "(lifesaving)";
- if (QUERY_FLAG (op, FLAG_REFL_SPELL)) buf << "(reflect spells)";
- if (QUERY_FLAG (op, FLAG_REFL_MISSILE)) buf << "(reflect missiles)";
- if (QUERY_FLAG (op, FLAG_STEALTH)) buf << "(stealth)";
+ if (op->flag [FLAG_LIFESAVE]) buf << "(lifesaving)";
+ if (op->flag [FLAG_REFL_SPELL]) buf << "(reflect spells)";
+ if (op->flag [FLAG_REFL_MISSILE]) buf << "(reflect missiles)";
+ if (op->flag [FLAG_STEALTH]) buf << "(stealth)";
buf.add_paths ("Attuned" , op->path_attuned);
buf.add_paths ("Repelled", op->path_repelled);
@@ -487,7 +538,7 @@
buf << (op->nrof <= 1 ? op->name : op->name_pl);
- if (op->title && QUERY_FLAG (op, FLAG_IDENTIFIED))
+ if (op->title && op->flag [FLAG_IDENTIFIED])
buf << ' ' << op->title;
switch (op->type)
@@ -496,7 +547,7 @@
case SCROLL:
case WAND:
case ROD:
- if (QUERY_FLAG (op, FLAG_IDENTIFIED) || QUERY_FLAG (op, FLAG_BEEN_APPLIED))
+ if (op->flag [FLAG_IDENTIFIED] || op->flag [FLAG_BEEN_APPLIED])
{
if (!op->title)
buf << " of " << (op->inv ? &op->inv->name : "bug, please report");
@@ -545,7 +596,9 @@
break;
default:
- if (op->magic && ((QUERY_FLAG (op, FLAG_BEEN_APPLIED) && need_identify (op)) || QUERY_FLAG (op, FLAG_IDENTIFIED)))
+ if (op->magic
+ && ((op->flag [FLAG_BEEN_APPLIED] && op->need_identify ())
+ || op->flag [FLAG_IDENTIFIED]))
buf.printf (" %+d", op->magic);
}
@@ -569,7 +622,6 @@
const char *
query_name (const object *op)
{
- int len = 0;
static dynbuf_text bufs[5];
static int use_buf = 0;
@@ -586,16 +638,16 @@
buf << query_short_name (op);
- if (QUERY_FLAG (op, FLAG_INV_LOCKED))
+ if (op->flag [FLAG_INV_LOCKED])
buf << " *";
if (op->is_open_container ())
buf << " (open)";
- if (QUERY_FLAG (op, FLAG_KNOWN_CURSED))
+ if (op->flag [FLAG_KNOWN_CURSED])
{
- if (QUERY_FLAG (op, FLAG_DAMNED))
+ if (op->flag [FLAG_DAMNED])
buf << " (damned)";
- else if (QUERY_FLAG (op, FLAG_CURSED))
+ else if (op->flag [FLAG_CURSED])
buf << " (cursed)";
}
@@ -608,7 +660,7 @@
* if it has been applied. Equipping an item does not tell full
* abilities, especially for artifact items.
*/
- if (QUERY_FLAG (op, FLAG_KNOWN_MAGICAL) && !QUERY_FLAG (op, FLAG_IDENTIFIED))
+ if (op->flag [FLAG_KNOWN_MAGICAL] && !op->flag [FLAG_IDENTIFIED])
buf << " (magic)";
#if 0
@@ -620,16 +672,15 @@
#endif
- if (QUERY_FLAG (op, FLAG_APPLIED))
+ if (op->flag [FLAG_APPLIED])
{
switch (op->type)
{
+ case RANGED:
case BOW:
case WAND:
case ROD:
case HORN:
- buf << " (applied)";
- break;
case WEAPON:
buf << " (applied)";
break;
@@ -673,7 +724,7 @@
break;
}
- if (QUERY_FLAG (op, FLAG_UNPAID))
+ if (op->flag [FLAG_UNPAID])
buf << " (unpaid)";
return buf;
@@ -712,7 +763,7 @@
buf << (plural ? op->name_pl : op->name);
- if (op->title && QUERY_FLAG (op, FLAG_IDENTIFIED))
+ if (op->title && op->flag [FLAG_IDENTIFIED])
buf << ' ' << op->title;
switch (op->type)
@@ -721,7 +772,7 @@
case SCROLL:
case WAND:
case ROD:
- if (QUERY_FLAG (op, FLAG_IDENTIFIED) || QUERY_FLAG (op, FLAG_BEEN_APPLIED))
+ if (op->flag [FLAG_IDENTIFIED] || op->flag [FLAG_BEEN_APPLIED])
{
if (!op->title)
buf << " of " << (op->inv ? &op->inv->name : "bug, please report");
@@ -754,7 +805,9 @@
break;
default:
- if (op->magic && ((QUERY_FLAG (op, FLAG_BEEN_APPLIED) && need_identify (op)) || QUERY_FLAG (op, FLAG_IDENTIFIED)))
+ if (op->magic
+ && ((op->flag [FLAG_BEEN_APPLIED] && op->need_identify ())
+ || op->flag [FLAG_IDENTIFIED]))
buf.printf (" %+d", op->magic);
}
@@ -807,20 +860,20 @@
break;
}
- if (QUERY_FLAG (op, FLAG_UNDEAD)) buf << "(undead)";
- if (QUERY_FLAG (op, FLAG_SEE_INVISIBLE)) buf << "(see invisible)";
- if (QUERY_FLAG (op, FLAG_USE_WEAPON)) buf << "(wield weapon)";
- if (QUERY_FLAG (op, FLAG_USE_BOW)) buf << "(archer)";
- if (QUERY_FLAG (op, FLAG_USE_ARMOUR)) buf << "(wear armour)";
- if (QUERY_FLAG (op, FLAG_USE_RING)) buf << "(wear ring)";
- if (QUERY_FLAG (op, FLAG_USE_SCROLL)) buf << "(read scroll)";
- if (QUERY_FLAG (op, FLAG_USE_RANGE)) buf << "(fires wand/rod/horn)";
- if (QUERY_FLAG (op, FLAG_CAN_USE_SKILL)) buf << "(skill user)";
- if (QUERY_FLAG (op, FLAG_CAST_SPELL)) buf << "(spellcaster)";
- if (QUERY_FLAG (op, FLAG_FRIENDLY)) buf << "(friendly)";
- if (QUERY_FLAG (op, FLAG_UNAGGRESSIVE)) buf << "(unaggressive)";
- if (QUERY_FLAG (op, FLAG_HITBACK)) buf << "(hitback)";
- if (QUERY_FLAG (op, FLAG_STEALTH)) buf << "(stealthy)";
+ if (op->flag [FLAG_UNDEAD]) buf << "(undead)";
+ if (op->flag [FLAG_SEE_INVISIBLE]) buf << "(see invisible)";
+ if (op->flag [FLAG_USE_WEAPON]) buf << "(wield weapon)";
+ if (op->flag [FLAG_USE_BOW]) buf << "(archer)";
+ if (op->flag [FLAG_USE_ARMOUR]) buf << "(wear armour)";
+ if (op->flag [FLAG_USE_RING]) buf << "(wear ring)";
+ if (op->flag [FLAG_USE_SCROLL]) buf << "(read scroll)";
+ if (op->flag [FLAG_USE_RANGE]) buf << "(fires wand/rod/horn)";
+ if (op->flag [FLAG_CAN_USE_SKILL]) buf << "(skill user)";
+ if (op->flag [FLAG_CAST_SPELL]) buf << "(spellcaster)";
+ if (op->flag [FLAG_FRIENDLY]) buf << "(friendly)";
+ if (op->flag [FLAG_UNAGGRESSIVE]) buf << "(unaggressive)";
+ if (op->flag [FLAG_HITBACK]) buf << "(hitback)";
+ if (op->flag [FLAG_STEALTH]) buf << "(stealthy)";
if (op->randomitems)
{
@@ -912,7 +965,7 @@
const char *
describe_item (const object *op, object *owner)
{
- if (QUERY_FLAG (op, FLAG_MONSTER) || op->type == PLAYER)
+ if (op->flag [FLAG_MONSTER] || op->type == PLAYER)
return describe_monster (op);
static dynbuf_text buf; buf.clear ();
@@ -921,12 +974,13 @@
/* figure this out once, instead of making multiple calls to need_identify.
* also makes the code easier to read.
*/
- identified = !need_identify (op) || QUERY_FLAG (op, FLAG_IDENTIFIED);
+ identified = !op->need_identify () || op->flag [FLAG_IDENTIFIED];
if (!identified)
buf << "(unidentified)";
switch (op->type)
{
+ case RANGED:
case BOW:
case ARROW:
case WAND:
@@ -1001,14 +1055,14 @@
case FOOD:
case FLESH:
case DRINK:
- if (identified || QUERY_FLAG (op, FLAG_BEEN_APPLIED))
+ if (identified || op->flag [FLAG_BEEN_APPLIED])
{
buf.printf ("(food+%d)", op->stats.food);
if (op->type == FLESH && op->last_eat > 0 && atnr_is_dragon_enabled (op->last_eat))
buf.printf ("(%s metabolism)", change_resist_msg[op->last_eat]);
- if (!QUERY_FLAG (op, FLAG_CURSED))
+ if (!op->flag [FLAG_CURSED])
{
if (op->stats.hp) buf << "(heals)";
if (op->stats.sp) buf << "(spellpoint regen)";
@@ -1039,12 +1093,10 @@
/* Down here, we more further describe equipment type items.
* only describe them if they have been identified or the like.
*/
- if (identified || QUERY_FLAG (op, FLAG_BEEN_APPLIED))
+ if (identified || op->flag [FLAG_BEEN_APPLIED])
{
- int attr, val;
-
- for (attr = 0; attr < NUM_STATS; attr++)
- if ((val = op->stats.stat (attr)))
+ for (int attr = 0; attr < NUM_STATS; attr++)
+ if (int val = op->stats.stat (attr))
buf.printf ("(%s%+d)", short_stat_name[attr], val);
if (op->stats.exp)
@@ -1052,6 +1104,7 @@
switch (op->type)
{
+ case RANGED:
case BOW:
case ARROW:
case GIRDLE:
@@ -1080,8 +1133,8 @@
break;
}
- if (QUERY_FLAG (op, FLAG_XRAYS)) buf << "(xray-vision)";
- if (QUERY_FLAG (op, FLAG_SEE_IN_DARK)) buf << "(infravision)";
+ if (op->flag [FLAG_XRAYS]) buf << "(xray-vision)";
+ if (op->flag [FLAG_SEE_IN_DARK]) buf << "(infravision)";
/* levitate was what is was before, so we'll keep it */
if (op->move_type & MOVE_FLY_LOW) buf << "(levitate)";
@@ -1104,6 +1157,7 @@
switch (op->type)
{
+ case RANGED:
case ROD: /* These use stats.sp for spell selection and stats.food */
case HORN: /* and stats.hp for spell-point regeneration... */
case BOW:
@@ -1153,10 +1207,10 @@
if (op->stats.luck)
buf.printf ("(luck%+d)", op->stats.luck);
- if (QUERY_FLAG (op, FLAG_LIFESAVE)) buf << "(lifesaving)";
- if (QUERY_FLAG (op, FLAG_REFL_SPELL)) buf << "(reflect spells)";
- if (QUERY_FLAG (op, FLAG_REFL_MISSILE)) buf << "(reflect missiles)";
- if (QUERY_FLAG (op, FLAG_STEALTH)) buf << "(stealth)";
+ if (op->flag [FLAG_LIFESAVE]) buf << "(lifesaving)";
+ if (op->flag [FLAG_REFL_SPELL]) buf << "(reflect spells)";
+ if (op->flag [FLAG_REFL_MISSILE]) buf << "(reflect missiles)";
+ if (op->flag [FLAG_STEALTH]) buf << "(stealth)";
if (op->slaying && op->type != FOOD)
buf.printf ("(slay %s)", &op->slaying);
@@ -1210,7 +1264,7 @@
{
case SPELLBOOK:
if (flag [FLAG_IDENTIFIED] && inv)
- buf.printf ("%s is a level %s %s spell.\r", &inv->name, get_levelnumber (inv->level), &inv->skill);
+ buf.printf ("%s is a %s level %s spell.\r", &inv->name, ordinal (inv->level), &inv->skill);
break;
case BOOK:
@@ -1289,20 +1343,18 @@
{
if (type != EXIT && type != BOOK && type != CORPSE && !move_on && !has_dialogue ())
{
- buf << '\r';
-
- /* This is just a hack so when identifying the items, we print
- * out the extra message
- */
- if (need_identify (this) && flag [FLAG_IDENTIFIED])
- buf << "The object has a story:\r";
-
- buf << msg << '\n';
+ if (!need_identify ())
+ buf << '\r' << msg << '\n';
+ else if (flag [FLAG_IDENTIFIED])
+ buf << '\r' << "The object has a story:\r" << msg;
}
}
- else if (inv && inv->type == SPELL && flag [FLAG_IDENTIFIED]
+ else if (inv
+ && inv->msg
+ && inv->type == SPELL
+ && flag [FLAG_IDENTIFIED]
&& (type == SPELLBOOK || type == ROD || type == WAND
- || type == ROD || type == POTION || type == SCROLL))
+ || type == POTION || type == SCROLL))
// for spellbooks and other stuff that contains spells, print the spell message,
// unless the object has a custom message handled above.
buf << '\r' << inv->msg << '\n';
@@ -1323,6 +1375,11 @@
TICK2TIME (change_ability_duration (spell, this)));
}
+ // some help text for skill tools
+ if (type == SKILL_TOOL)
+ buf << "\nH";
+
// Display a hint about inscribable items [empty books]
// This includes the amount of text they can hold.
if (type == INSCRIBABLE)
@@ -1371,9 +1428,9 @@
static dynbuf_text buf; buf.clear ();
for (object *tmp = inv; tmp; tmp = tmp->below)
- if (who && QUERY_FLAG (who, FLAG_WIZ))
+ if (who && who->flag [FLAG_WIZ])
buf.printf ("%s- %-28.28s %-8s (%9d) %s\n", indent, tmp->query_name (), tmp->query_weight (), tmp->count, tmp->uuid.c_str ());
- else if (!tmp->invisible && (type == CONTAINER || QUERY_FLAG (tmp, FLAG_APPLIED)))
+ else if (!tmp->invisible && (type == CONTAINER || tmp->flag [FLAG_APPLIED]))
buf.printf ("%s- %-36.36s %-8s\n", indent, tmp->query_name (), tmp->query_weight ());
if (buf.size ())
@@ -1396,7 +1453,7 @@
int i;
/* living creatures are considered non magical */
- if (QUERY_FLAG (op, FLAG_ALIVE))
+ if (op->flag [FLAG_ALIVE])
return 0;
/* This is a test for it being an artifact, as artifacts have titles */
@@ -1412,15 +1469,15 @@
/* Check for stealty, speed, flying, or just plain magic in the boots */
/* Presume any boots that hvae a move_type are special. */
- if (op->type == BOOTS && ((QUERY_FLAG (op, FLAG_STEALTH) || op->move_type || op->stats.exp)))
+ if (op->type == BOOTS && ((op->flag [FLAG_STEALTH] || op->move_type || op->stats.exp)))
return 1;
/* Take care of amulet/shield that reflects spells/missiles */
- if ((op->type == AMULET || op->type == SHIELD) && (QUERY_FLAG (op, FLAG_REFL_SPELL) || QUERY_FLAG (op, FLAG_REFL_MISSILE)))
+ if ((op->type == AMULET || op->type == SHIELD) && (op->flag [FLAG_REFL_SPELL] || op->flag [FLAG_REFL_MISSILE]))
return 1;
/* Take care of helmet of xrays */
- if (op->type == HELMET && QUERY_FLAG (op, FLAG_XRAYS))
+ if (op->type == HELMET && op->flag [FLAG_XRAYS])
return 1;
/* Potions & rods are always magical. Wands/staves are also magical,
@@ -1459,75 +1516,21 @@
return 0;
}
-/* need_identify returns true if the item should be identified. This
- * function really should not exist - by default, any item not identified
- * should need it.
- */
-
-int
-need_identify (const object *op)
-{
- switch (op->type)
- {
- case RING:
- case WAND:
- case ROD:
- case HORN:
- case SCROLL:
- case SKILL:
- case SKILLSCROLL:
- case SPELLBOOK:
- case FOOD:
- case POTION:
- case BOW:
- case ARROW:
- case WEAPON:
- case ARMOUR:
- case SHIELD:
- case HELMET:
- case AMULET:
- case BOOTS:
- case GLOVES:
- case BRACERS:
- case GIRDLE:
- case CONTAINER:
- case DRINK:
- case FLESH:
- case INORGANIC:
- case CLOSE_CON:
- case CLOAK:
- case GEM:
- case POWER_CRYSTAL:
- case POISON:
- case BOOK:
- case SKILL_TOOL:
- return 1;
- }
-
- /* Try to track down some stuff that may show up here. Thus, the
- * archetype file can be updated, and this function removed.
- */
-#if 0
- LOG (llevDebug, "need_identify: %s does not need to be id'd\n", op->name);
-#endif
- return 0;
-}
-
/*
* Supposed to fix face-values as well here, but later.
*/
void
identify (object *op)
{
- SET_FLAG (op, FLAG_IDENTIFIED);
- CLEAR_FLAG (op, FLAG_KNOWN_MAGICAL);
- CLEAR_FLAG (op, FLAG_NO_SKILL_IDENT);
+ op->set_flag (FLAG_IDENTIFIED);
+ op->clr_flag (FLAG_KNOWN_MAGICAL);
+ op->clr_flag (FLAG_NO_SKILL_IDENT);
/*
* We want autojoining of equal objects:
*/
- if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED))
- SET_FLAG (op, FLAG_KNOWN_CURSED);
+ if (op->flag [FLAG_CURSED] || op->flag [FLAG_DAMNED])
+ op->set_flag (FLAG_KNOWN_CURSED);
if (op->type == POTION)
{