--- deliantra/server/common/living.C 2007/07/21 14:37:25 1.71 +++ deliantra/server/common/living.C 2007/07/31 18:08:58 1.73 @@ -810,8 +810,6 @@ stats.luck = arch->stats.luck; speed = arch->speed; - sint16 digestion = 0; // a local var to add digestion - /* OK - we've reset most all the objects attributes to sane values. * now go through and make adjustments for what the player has equipped. */ @@ -893,7 +891,7 @@ tmp->type == DISEASE || tmp->type == FORCE || tmp->type == SKILL) { - digestion += tmp->stats.food; + contr->digestion = clamp (int (contr->digestion) + tmp->stats.food, MIN_DIGESTION, MAX_DIGESTION); contr->gen_hp += tmp->stats.hp; contr->gen_sp += tmp->stats.sp; contr->gen_grace += tmp->stats.grace; @@ -1137,9 +1135,6 @@ } /* item is equipped */ } /* for loop of items */ - // now clamp digestion to our limits - contr->digestion = clamp (digestion, MIN_DIGESTION, MAX_DIGESTION); - /* We've gone through all the objects the player has equipped. For many things, we * have generated intermediate values which we now need to assign. */ @@ -1606,12 +1601,15 @@ player_lvl_adj (object *who, object *op) { char buf[MAX_BUF]; + bool changed = false; if (!op) /* when rolling stats */ op = who; - if (op->level < settings.max_level && op->stats.exp >= level_exp (op->level + 1, who->expmul)) + while (op->level < settings.max_level && op->stats.exp >= level_exp (op->level + 1, who->expmul)) { + changed = true; + op->level++; if (op && op == who && op->stats.exp > 1 && is_dragon_pl (who)) @@ -1625,37 +1623,44 @@ who->contr->levgrace[who->level] = die_roll (2, 2, who, PREFER_HIGH) - 1; } - who->update_stats (); if (op->level > 1) { if (op->type != PLAYER) - sprintf (buf, "You are now level %d in the %s skill.", op->level, &op->name); + { + who->contr->play_sound (sound_find ("skill_up")); + sprintf (buf, "You are now level %d in the %s skill.", op->level, &op->name); + } else - sprintf (buf, "You are now level %d.", op->level); + { + who->contr->play_sound (sound_find ("level_up")); + sprintf (buf, "You are now level %d.", op->level); + } if (who) new_draw_info (NDI_UNIQUE | NDI_RED, 0, who, buf); } - - player_lvl_adj (who, op); /* To increase more levels */ } - else if (op->level > 1 && op->stats.exp < level_exp (op->level, who->expmul)) + + while (op->level > 1 && op->stats.exp < level_exp (op->level, who->expmul)) { + changed = true; + op->level--; - who->update_stats (); if (op->type != PLAYER) { sprintf (buf, "You are now level %d in the %s skill.", op->level, &op->name); new_draw_info (NDI_UNIQUE | NDI_RED, 0, who, buf); } - - player_lvl_adj (who, op); /* To decrease more levels */ } - /* check if the spell data has changed */ - esrv_update_stats (who->contr); - esrv_update_spells (who->contr); + if (changed) + { + who->update_stats (); + esrv_update_stats (who->contr); + /* check if the spell data has changed */ + esrv_update_spells (who->contr); + } } /*