--- deliantra/server/common/living.C 2006/09/10 16:00:23 1.9 +++ deliantra/server/common/living.C 2006/12/20 10:31:00 1.18 @@ -1,9 +1,3 @@ - -/* - * static char *rcsid_living_c = - * "$Id: living.C,v 1.9 2006/09/10 16:00:23 root Exp $"; - */ - /* CrossFire, A Multiplayer game for X-windows @@ -24,7 +18,7 @@ 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 crossfire-devel@real-time.com + The authors can be reached via e-mail at */ #include @@ -166,11 +160,7 @@ #define MAX_EXP_IN_OBJ levels[settings.max_level]/(MAX_EXP_CAT - 1) -#ifndef WIN32 -extern uint64 *levels; -#else extern sint64 *levels; -#endif #define MAX_SAVE_LEVEL 110 @@ -253,27 +243,27 @@ { switch (attr) { - case STR: - stats->Str = value; - break; - case DEX: - stats->Dex = value; - break; - case CON: - stats->Con = value; - break; - case WIS: - stats->Wis = value; - break; - case POW: - stats->Pow = value; - break; - case CHA: - stats->Cha = value; - break; - case INT: - stats->Int = value; - break; + case STR: + stats->Str = value; + break; + case DEX: + stats->Dex = value; + break; + case CON: + stats->Con = value; + break; + case WIS: + stats->Wis = value; + break; + case POW: + stats->Pow = value; + break; + case CHA: + stats->Cha = value; + break; + case INT: + stats->Int = value; + break; } } @@ -289,29 +279,29 @@ return; switch (attr) { - case STR: - stats->Str += value; - break; - case DEX: - stats->Dex += value; - break; - case CON: - stats->Con += value; - break; - case WIS: - stats->Wis += value; - break; - case POW: - stats->Pow += value; - break; - case CHA: - stats->Cha += value; - break; - case INT: - stats->Int += value; - break; - default: - LOG (llevError, "Invalid attribute in change_attr_value: %d\n", attr); + case STR: + stats->Str += value; + break; + case DEX: + stats->Dex += value; + break; + case CON: + stats->Con += value; + break; + case WIS: + stats->Wis += value; + break; + case POW: + stats->Pow += value; + break; + case CHA: + stats->Cha += value; + break; + case INT: + stats->Int += value; + break; + default: + LOG (llevError, "Invalid attribute in change_attr_value: %d\n", attr); } } @@ -324,20 +314,20 @@ { switch (attr) { - case STR: - return (stats->Str); - case DEX: - return (stats->Dex); - case CON: - return (stats->Con); - case WIS: - return (stats->Wis); - case CHA: - return (stats->Cha); - case INT: - return (stats->Int); - case POW: - return (stats->Pow); + case STR: + return (stats->Str); + case DEX: + return (stats->Dex); + case CON: + return (stats->Con); + case WIS: + return (stats->Wis); + case CHA: + return (stats->Cha); + case INT: + return (stats->Int); + case POW: + return (stats->Pow); } return 0; } @@ -663,7 +653,7 @@ } } - if (tmp->type != EXPERIENCE && !potion_max) + if (!potion_max) { for (j = 0; j < NUM_STATS; j++) { @@ -694,7 +684,7 @@ object *tmp; archetype *at; - at = find_archetype (ARCH_DEPLETION); + at = archetype::find (ARCH_DEPLETION); if (!at) { LOG (llevError, "Couldn't find archetype depletion.\n"); @@ -728,7 +718,7 @@ archetype *at; int new_luck; - at = find_archetype ("luck"); + at = archetype::find ("luck"); if (!at) LOG (llevError, "Couldn't find archetype luck.\n"); else @@ -1002,19 +992,21 @@ * spell point recovery and mana point recovery. Seems sort of an arbitary * list, but other items store other info into stats array. */ - if ((tmp->type == EXPERIENCE) || (tmp->type == WEAPON) || - (tmp->type == ARMOUR) || (tmp->type == HELMET) || - (tmp->type == SHIELD) || (tmp->type == RING) || - (tmp->type == BOOTS) || (tmp->type == GLOVES) || - (tmp->type == AMULET) || (tmp->type == GIRDLE) || - (tmp->type == BRACERS) || (tmp->type == CLOAK) || (tmp->type == DISEASE) || (tmp->type == FORCE) || (tmp->type == SKILL)) + if ((tmp->type == WEAPON) || + (tmp->type == ARMOUR) || (tmp->type == HELMET) || + (tmp->type == SHIELD) || (tmp->type == RING) || + (tmp->type == BOOTS) || (tmp->type == GLOVES) || + (tmp->type == AMULET) || (tmp->type == GIRDLE) || + (tmp->type == BRACERS) || (tmp->type == CLOAK) || + (tmp->type == DISEASE) || (tmp->type == FORCE) || + (tmp->type == SKILL)) { - op->contr->digestion += tmp->stats.food; - op->contr->gen_hp += tmp->stats.hp; - op->contr->gen_sp += tmp->stats.sp; - op->contr->gen_grace += tmp->stats.grace; + op->contr->digestion += tmp->stats.food; + op->contr->gen_hp += tmp->stats.hp; + op->contr->gen_sp += tmp->stats.sp; + op->contr->gen_grace += tmp->stats.grace; op->contr->gen_sp_armour += tmp->gen_sp_armour; - op->contr->item_power += tmp->item_power; + op->contr->item_power += tmp->item_power; } } /* if this is a player */ @@ -1105,127 +1097,128 @@ switch (tmp->type) { - /* skills modifying the character -b.t. */ - /* for all skills and skill granting objects */ - case SKILL: - if (!QUERY_FLAG (tmp, FLAG_APPLIED)) - break; + /* skills modifying the character -b.t. */ + /* for all skills and skill granting objects */ + case SKILL: + if (!QUERY_FLAG (tmp, FLAG_APPLIED)) + break; - if (IS_COMBAT_SKILL (tmp->subtype)) - wc_obj = tmp; + if (IS_COMBAT_SKILL (tmp->subtype)) + wc_obj = tmp; - if (op->chosen_skill) - { - LOG (llevDebug, "fix_player, op %s has multiple skills applied\n", &op->name); - } - op->chosen_skill = tmp; - if (tmp->stats.dam > 0) - { /* skill is a 'weapon' */ - if (!QUERY_FLAG (op, FLAG_READY_WEAPON)) - weapon_speed = (int) WEAPON_SPEED (tmp); - if (weapon_speed < 0) - weapon_speed = 0; - weapon_weight = tmp->weight; - op->stats.dam += tmp->stats.dam * (1 + (op->chosen_skill->level / 9)); - if (tmp->magic) - op->stats.dam += tmp->magic; - } - if (tmp->stats.wc) - wc -= (tmp->stats.wc + tmp->magic); + if (op->chosen_skill) + LOG (llevDebug, "fix_player, op %s has multiple skills applied\n", &op->name); - if (tmp->slaying != NULL) - op->slaying = tmp->slaying; + op->chosen_skill = tmp; - if (tmp->stats.ac) - ac -= (tmp->stats.ac + tmp->magic); - if (settings.spell_encumbrance == TRUE && op->type == PLAYER) - op->contr->encumbrance += (int) 3 *tmp->weight / 1000; + if (tmp->stats.dam > 0) + { /* skill is a 'weapon' */ + if (!QUERY_FLAG (op, FLAG_READY_WEAPON)) + weapon_speed = (int) WEAPON_SPEED (tmp); + if (weapon_speed < 0) + weapon_speed = 0; + weapon_weight = tmp->weight; + op->stats.dam += tmp->stats.dam * (1 + (op->chosen_skill->level / 9)); + if (tmp->magic) + op->stats.dam += tmp->magic; + } - if (op->type == PLAYER) - op->contr->ranges[range_skill] = op; - break; + if (tmp->stats.wc) + wc -= (tmp->stats.wc + tmp->magic); - case SKILL_TOOL: - if (op->chosen_skill) - { - LOG (llevDebug, "fix_player, op %s has multiple skills applied\n", &op->name); - } - op->chosen_skill = tmp; - if (op->type == PLAYER) - op->contr->ranges[range_skill] = op; - break; + if (tmp->slaying != NULL) + op->slaying = tmp->slaying; - case SHIELD: - if (settings.spell_encumbrance == TRUE && op->type == PLAYER) - op->contr->encumbrance += (int) tmp->weight / 2000; - case RING: - case AMULET: - case GIRDLE: - case HELMET: - case BOOTS: - case GLOVES: - case CLOAK: - if (tmp->stats.wc) - wc -= (tmp->stats.wc + tmp->magic); - if (tmp->stats.dam) - op->stats.dam += (tmp->stats.dam + tmp->magic); - if (tmp->stats.ac) - ac -= (tmp->stats.ac + tmp->magic); - break; + if (tmp->stats.ac) + ac -= (tmp->stats.ac + tmp->magic); + if (settings.spell_encumbrance == TRUE && op->type == PLAYER) + op->contr->encumbrance += (int) 3 *tmp->weight / 1000; + + if (op->type == PLAYER) + op->contr->ranges[range_skill] = op; + break; + + case SKILL_TOOL: + if (op->chosen_skill) + { + LOG (llevDebug, "fix_player, op %s has multiple skills applied\n", &op->name); + } + op->chosen_skill = tmp; + if (op->type == PLAYER) + op->contr->ranges[range_skill] = op; + break; - case WEAPON: + case SHIELD: + if (settings.spell_encumbrance == TRUE && op->type == PLAYER) + op->contr->encumbrance += (int) tmp->weight / 2000; + case RING: + case AMULET: + case GIRDLE: + case HELMET: + case BOOTS: + case GLOVES: + case CLOAK: + if (tmp->stats.wc) wc -= (tmp->stats.wc + tmp->magic); - if (tmp->stats.ac && tmp->stats.ac + tmp->magic > 0) - ac -= tmp->stats.ac + tmp->magic; + if (tmp->stats.dam) op->stats.dam += (tmp->stats.dam + tmp->magic); - weapon_weight = tmp->weight; - weapon_speed = ((int) WEAPON_SPEED (tmp) * 2 - tmp->magic) / 2; - if (weapon_speed < 0) - weapon_speed = 0; - op->slaying = tmp->slaying; - /* If there is desire that two handed weapons should do - * extra strength damage, this is where the code should - * go. - */ - op->current_weapon = tmp; - if (settings.spell_encumbrance == TRUE && op->type == PLAYER) - op->contr->encumbrance += (int) 3 *tmp->weight / 1000; + if (tmp->stats.ac) + ac -= (tmp->stats.ac + tmp->magic); + break; - break; + case WEAPON: + wc -= (tmp->stats.wc + tmp->magic); + if (tmp->stats.ac && tmp->stats.ac + tmp->magic > 0) + ac -= tmp->stats.ac + tmp->magic; + op->stats.dam += (tmp->stats.dam + tmp->magic); + weapon_weight = tmp->weight; + weapon_speed = ((int) WEAPON_SPEED (tmp) * 2 - tmp->magic) / 2; + if (weapon_speed < 0) + weapon_speed = 0; + op->slaying = tmp->slaying; + /* If there is desire that two handed weapons should do + * extra strength damage, this is where the code should + * go. + */ + op->current_weapon = tmp; + if (settings.spell_encumbrance == TRUE && op->type == PLAYER) + op->contr->encumbrance += (int) 3 *tmp->weight / 1000; - case ARMOUR: /* Only the best of these three are used: */ - if (settings.spell_encumbrance == TRUE && op->type == PLAYER) - op->contr->encumbrance += (int) tmp->weight / 1000; - - case BRACERS: - case FORCE: - if (tmp->stats.wc) - { - if (best_wc < tmp->stats.wc + tmp->magic) - { - wc += best_wc; - best_wc = tmp->stats.wc + tmp->magic; - } - else - wc += tmp->stats.wc + tmp->magic; - } - if (tmp->stats.ac) - { - if (best_ac < tmp->stats.ac + tmp->magic) - { - ac += best_ac; /* Remove last bonus */ - best_ac = tmp->stats.ac + tmp->magic; - } - else /* To nullify the below effect */ - ac += tmp->stats.ac + tmp->magic; - } - if (tmp->stats.wc) - wc -= (tmp->stats.wc + tmp->magic); - if (tmp->stats.ac) - ac -= (tmp->stats.ac + tmp->magic); - if (ARMOUR_SPEED (tmp) && ARMOUR_SPEED (tmp) / 10.0 < max) - max = ARMOUR_SPEED (tmp) / 10.0; - break; + break; + + case ARMOUR: /* Only the best of these three are used: */ + if (settings.spell_encumbrance == TRUE && op->type == PLAYER) + op->contr->encumbrance += (int) tmp->weight / 1000; + + case BRACERS: + case FORCE: + if (tmp->stats.wc) + { + if (best_wc < tmp->stats.wc + tmp->magic) + { + wc += best_wc; + best_wc = tmp->stats.wc + tmp->magic; + } + else + wc += tmp->stats.wc + tmp->magic; + } + if (tmp->stats.ac) + { + if (best_ac < tmp->stats.ac + tmp->magic) + { + ac += best_ac; /* Remove last bonus */ + best_ac = tmp->stats.ac + tmp->magic; + } + else /* To nullify the below effect */ + ac += tmp->stats.ac + tmp->magic; + } + if (tmp->stats.wc) + wc -= (tmp->stats.wc + tmp->magic); + if (tmp->stats.ac) + ac -= (tmp->stats.ac + tmp->magic); + if (ARMOUR_SPEED (tmp) && ARMOUR_SPEED (tmp) / 10.0 < max) + max = ARMOUR_SPEED (tmp) / 10.0; + break; } /* switch tmp->type */ } /* item is equipped */ } /* for loop of items */ @@ -1966,11 +1959,7 @@ { #ifdef EXP_DEBUG -# ifndef WIN32 - LOG (llevDebug, "change_exp() called for %s, exp = %lld\n", query_name (op), exp); -# else - LOG (llevDebug, "change_exp() called for %s, exp = %I64d\n", query_name (op), exp); -# endif + LOG (llevDebug, "change_exp() called for %s, exp = %" PRId64 "\n", query_name (op), exp); #endif /* safety */