--- deliantra/server/common/item.C 2009/01/12 00:17:22 1.54 +++ deliantra/server/common/item.C 2009/09/16 22:50:50 1.55 @@ -329,20 +329,13 @@ enc--; } - if (QUERY_FLAG (op, FLAG_LIFESAVE)) - enc += 5; - if (QUERY_FLAG (op, FLAG_REFL_SPELL)) - enc += 3; - if (QUERY_FLAG (op, FLAG_REFL_MISSILE)) - enc += 2; - if (QUERY_FLAG (op, FLAG_STEALTH)) - enc += 1; - if (QUERY_FLAG (op, FLAG_XRAYS)) - enc += 2; - if (QUERY_FLAG (op, FLAG_SEE_IN_DARK)) - enc += 1; - if (QUERY_FLAG (op, FLAG_MAKE_INVIS)) - enc += 1; + if (op->flag [FLAG_LIFESAVE ]) enc += 5; + if (op->flag [FLAG_REFL_SPELL ]) enc += 3; + if (op->flag [FLAG_REFL_MISSILE]) enc += 2; + if (op->flag [FLAG_XRAYS ]) enc += 2; + if (op->flag [FLAG_STEALTH ]) enc += 1; + if (op->flag [FLAG_SEE_IN_DARK ]) enc += 1; + if (op->flag [FLAG_MAKE_INVIS ]) enc += 1; return get_power_from_ench (enc); } @@ -352,9 +345,7 @@ const typedata * get_typedata (int itemtype) { - int i; - - for (i = 0; i < item_types_size; i++) + for (int i = 0; i < item_types_size; i++) if (item_types[i].number == itemtype) return &item_types[i]; @@ -367,13 +358,11 @@ const typedata * get_typedata_by_name (const char *name) { - int i; - - for (i = 0; i < item_types_size; i++) + for (int i = 0; i < item_types_size; i++) if (!strcmp (item_types[i].name, name)) return &item_types[i]; - for (i = 0; i < item_types_size; i++) + for (int i = 0; i < item_types_size; i++) if (!strcmp (item_types[i].name_pl, name)) { LOG (llevInfo, @@ -381,7 +370,7 @@ return &item_types[i]; } - return NULL; + return 0; } /* describe_resistance generates the visible naming for resistances. @@ -410,6 +399,7 @@ strcat (buf, buf1); } } + return buf; } @@ -418,6 +408,8 @@ * query_weight(object) returns a character pointer to a static buffer * containing the text-representation of the weight of the given object. * The buffer will be overwritten by the next call to query_weight(). + * + * Seems to be used only by unimportant stuff. Remove? */ const char * query_weight (const object *op) @@ -453,6 +445,7 @@ if (i < 21) return levelnumbers[i]; + if (!(i % 10)) return levelnumbers_10[i / 10]; @@ -538,6 +531,8 @@ /* * query_short_name(object) is similar to query_name, but doesn't * contain any information about object status (worn/cursed/etc.) + * + * It is sometimes used when printing messages, so should fit well into a sentence. */ const char * query_short_name (const object *op) @@ -631,6 +626,8 @@ * returned is good forever.) However, it makes printing statements that * use several names much easier (don't need to store them to temp variables.) * + * It is used extensively within messages, so should return only a prose + * and short description of the item. */ const char * query_name (const object *op) @@ -677,7 +674,7 @@ buf << " (magic)"; #if 0 - /* item_power will be returned in desribe_item - it shouldn't really + /* item_power will be returned in describe_item - it shouldn't really * be returned in the name. */ if (op->item_power) @@ -752,6 +749,9 @@ * don't include the item count or item status. Used for inventory sorting * and sending to client. * If plural is set, we generate the plural name of this. + * + * It is sometimes used to display messages, and usually only used to match stuff, + * so maybe this function should be removed. */ const char * query_base_name (const object *op, int plural) @@ -956,11 +956,6 @@ * a dwarven axe, in which the full abilities are only known to * dwarves, etc. * - * This function is really much more complicated than it should - * be, because different objects have different meanings - * for the same field (eg, wands use 'food' for charges). This - * means these special cases need to be worked out. - * * Add 'owner' who is the person examining this object. * owner can be null if no one is being associated with this * item (eg, debug dump or the like) @@ -1240,6 +1235,7 @@ examine (object *op, object *tmp) { std::string info = tmp->describe (op); + op->contr->infobox (MSG_CHANNEL ("examine"), info.c_str ()); }