--- deliantra/server/common/item.C 2007/05/07 07:47:32 1.31 +++ deliantra/server/common/item.C 2007/07/01 05:00:17 1.38 @@ -1,25 +1,24 @@ /* - * CrossFire, A Multiplayer game + * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. * - * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team - * Copyright (C) 2002 Mark Wedel & Crossfire Development Team - * Copyright (C) 1992 Frank Tore Johansen + * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team + * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team + * Copyright (©) 1992,2007 Frank Tore Johansen * - * This program is free software; you can redistribute it and/or modify + * Crossfire TRT is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * 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 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * The authors can be reached via e-mail at + * along with this program. If not, see . + * + * The authors can be reached via e-mail to */ #include @@ -49,20 +48,20 @@ * "This item goes %s\n", with the use/nonuse values filling in the %s */ Body_Locations body_locations[NUM_BODY_LOCATIONS] = { - {"body_range" , "You can use it as your range weapon" , "It is used as a range weapon"}, - {"body_shield" , "You can wield it as a shield" , "It is used as a shield"}, - {"body_combat" , "You can wield it as your weapon" , "It is used as a combat weapon"}, - {"body_arm" , "You can put it on your arm" , "It goes on a human's arm"}, - {"body_torso" , "You can wear it on your body" , "It goes on a human's torso"}, - {"body_head" , "You can wear it on your head" , "It goes on a human's head"}, - {"body_neck" , "You can wear it around your neck" , "It goes around a human's neck"}, - {"body_skill" , "You can have it in your skill slot" , "It goes in a human's skill slot"}, - {"body_finger" , "You can wear it on your finger" , "It goes on a human's finger"} , - {"body_shoulder", "You can wear it around your shoulders", "It goes around a human's shoulders"}, - {"body_foot" , "You can put your feets into it" , "It goes on a human's feet"}, - {"body_hand" , "You can put it on your hands" , "It goes on a human's hands"}, - {"body_wrist" , "You can wear it around your wrists" , "It goes around a human's wrist"}, - {"body_waist" , "You can wear it around your waist" , "It goes around a human's waist"}, + {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"} */ }; @@ -274,7 +273,7 @@ enc = 0; for (i = 0; i < NUM_STATS; i++) - enc += get_attr_value (&op->stats, i); + enc += op->stats.stat (i); /* This protection logic is pretty flawed. 20% fire resistance * is much more valuable than 20% confusion, or 20% slow, or @@ -504,10 +503,8 @@ for (attr = 0; attr < NUM_STATS; attr++) { - if ((val = get_attr_value (&(op->stats), attr)) != 0) - { - sprintf (buf + strlen (buf), "(%s%+d)", short_stat_name[attr], val); - } + if ((val = op->stats.stat (attr))) + sprintf (buf + strlen (buf), "(%s%+d)", short_stat_name[attr], val); } if (op->stats.exp) @@ -775,7 +772,7 @@ #ifdef NEW_MATERIAL_CODE if ((op->is_armor () || op->is_weapon ()) && op->materialname && mt && - op->arch->clone.materialname != mt->name && !(op->material & M_SPECIAL)) + op->arch->materialname != mt->name && !(op->material & M_SPECIAL)) { strcpy (buf, mt->description); len = strlen (buf); @@ -938,7 +935,7 @@ int first = 1; for (t = op->randomitems->items; t != NULL; t = t->next) - if (t->item && t->item->clone.type == SPELL) + if (t->item && t->item->type == SPELL) { if (first) { @@ -946,7 +943,7 @@ strcat (retbuf, "(Spell abilities:)"); } strcat (retbuf, "("); - strcat (retbuf, t->item->clone.name); + strcat (retbuf, t->item->object::name); strcat (retbuf, ")"); } } @@ -1086,14 +1083,16 @@ case POWER_CRYSTAL: if (op->stats.maxsp > 1000) { /*higher capacity crystals */ - i = (op->stats.maxsp % 100) / 10; + i = (op->stats.maxsp % 1000) / 100; + if (i) - snprintf (buf, MAX_BUF, "(capacity %d.%dk). It is ", op->stats.maxsp / 100, i); + snprintf (buf, MAX_BUF, "(capacity %d.%dk). It is ", op->stats.maxsp / 1000, i); else - snprintf (buf, MAX_BUF, "(capacity %dk). It is ", op->stats.maxsp / 100); + snprintf (buf, MAX_BUF, "(capacity %dk). It is ", op->stats.maxsp / 1000); } else snprintf (buf, MAX_BUF, "(capacity %d). It is ", op->stats.maxsp); + strcat (retbuf, buf); i = (op->stats.sp * 10) / op->stats.maxsp; if (op->stats.sp == 0) @@ -1168,7 +1167,7 @@ for (attr = 0; attr < NUM_STATS; attr++) { - if ((val = get_attr_value (&(op->stats), attr)) != 0) + if ((val = op->stats.stat (attr))) { sprintf (buf, "(%s%+d)", short_stat_name[attr], val); strcat (retbuf, buf); @@ -1435,7 +1434,7 @@ /* Check to see if it increases/decreases any stats */ for (i = 0; i < NUM_STATS; i++) - if (get_attr_value (&(op->stats), i) != 0) + if (op->stats.stat (i)) return 1; /* If it doesn't fall into any of the above categories, must @@ -1454,40 +1453,41 @@ { 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; + 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. */ @@ -1521,8 +1521,8 @@ op->title = op->inv->name; else if (op->arch) { - op->name = op->arch->clone.name; - op->name_pl = op->arch->clone.name_pl; + op->name = op->arch->object::name; + op->name_pl = op->arch->object::name_pl; } }