--- deliantra/server/common/item.C 2009/01/01 11:41:17 1.52 +++ deliantra/server/common/item.C 2009/01/11 06:08:40 1.53 @@ -1,7 +1,7 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. * - * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team * Copyright (©) 1992,2007 Frank Tore Johansen * @@ -254,10 +254,7 @@ int get_power_from_ench (int ench) { - if (ench < 0) ench = 0; - if (ench > 20) ench = 20; - - return enc_to_item_power[ench]; + return enc_to_item_power [clamp (ench, 0, 20)]; } /* This takes an object 'op' and figures out what its item_power @@ -578,30 +575,30 @@ } break; - case ALTAR: - case TRIGGER_ALTAR: - case IDENTIFY_ALTAR: - case CONVERTER: - if (op->slaying == shstr_money) - { - bool wrap = !!buf.size (); + case ALTAR: + case TRIGGER_ALTAR: + case IDENTIFY_ALTAR: + case CONVERTER: + if (op->slaying == shstr_money) + { + bool wrap = !!buf.size (); - if (wrap) buf << " ["; + if (wrap) buf << " ["; - archetype *coin = 0; + archetype *coin = 0; - for (char const *const *c = coins; *coins; ++c) - if ((coin = archetype::find (*c))) - if (op->stats.food % coin->value == 0) - break; + for (char const *const *c = coins; *coins; ++c) + if ((coin = archetype::find (*c))) + if (op->stats.food % coin->value == 0) + break; - sint32 coins = op->stats.food / coin->value; + sint32 coins = op->stats.food / coin->value; - buf.printf ("drop %d %s (or equivalent)", coins, coins == 1 ? &coin->name : &coin->name_pl); + buf.printf ("drop %d %s (or equivalent)", coins, coins == 1 ? &coin->name : &coin->name_pl); - if (wrap) buf << ']'; - } - break; + if (wrap) buf << ']'; + } + break; case SKILL: case AMULET: @@ -1217,12 +1214,12 @@ for (object *tmp = inv; tmp; tmp = tmp->below) if (who && QUERY_FLAG (who, FLAG_WIZ)) - buf.printf ("%s- %-28.28s (%5d) %-8s\n", indent, query_name (tmp), tmp->count, query_weight (tmp)); + buf.printf ("%s- %-28.28s (%5d) %-8s\n", indent, tmp->query_name (), tmp->count, tmp->query_weight ()); else if (!tmp->invisible && (type == CONTAINER || QUERY_FLAG (tmp, FLAG_APPLIED))) - buf.printf ("%s- %-36.36s %-8s\n", indent, query_name (tmp), query_weight (tmp)); + buf.printf ("%s- %-36.36s %-8s\n", indent, tmp->query_name (), tmp->query_weight ()); if (buf.size ()) - buf.printf ("%s(total weight: %s)\n", indent, query_weight (this)); + buf.printf ("%s(total weight: %s)\n", indent, query_weight ()); else buf.printf ("%s(empty)\n", indent);