--- deliantra/server/server/apply.C 2006/12/21 23:37:05 1.50 +++ deliantra/server/server/apply.C 2006/12/22 16:34:00 1.51 @@ -27,9 +27,7 @@ #include #include -#ifndef __CEXTRACT__ -# include -#endif +#include /* Want this regardless of rplay. */ #include @@ -221,27 +219,27 @@ if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) { - drain_stat (op); - fix_player (op); + op->drain_stat (); + op->update_stats (); decrease_ob (tmp); return 1; } - if ((at = archetype::find (ARCH_DEPLETION)) == NULL) + if (!(at = archetype::find (ARCH_DEPLETION))) { LOG (llevError, "Could not find archetype depletion\n"); return 0; } depl = present_arch_in_ob (at, op); - if (depl != NULL) + if (depl) { for (i = 0; i < NUM_STATS; i++) if (get_attr_value (&depl->stats, i)) new_draw_info (NDI_UNIQUE, 0, op, restore_msg[i]); depl->destroy (); - fix_player (op); + op->update_stats (); } else new_draw_info (NDI_UNIQUE, 0, op, "You potion had no effect."); @@ -301,7 +299,7 @@ { if (got_one) { - fix_player (op); + op->update_stats (); new_draw_info (NDI_UNIQUE, 0, op, "The Gods smile upon you and remake you"); new_draw_info (NDI_UNIQUE, 0, op, "a little more in their image."); new_draw_info (NDI_UNIQUE, 0, op, "You feel a little more perfect."); @@ -313,7 +311,7 @@ { /* cursed potion */ if (got_one) { - fix_player (op); + op->update_stats (); new_draw_info (NDI_UNIQUE, 0, op, "The Gods are angry and punish you."); } else @@ -351,7 +349,7 @@ decrease_ob (tmp); /* if youre dead, no point in doing this... */ if (!QUERY_FLAG (op, FLAG_REMOVED)) - fix_player (op); + op->update_stats (); return 1; } @@ -405,7 +403,7 @@ * up all the stats. */ CLEAR_FLAG (tmp, FLAG_APPLIED); - fix_player (op); + op->update_stats (); decrease_ob (tmp); return 1; } @@ -572,7 +570,7 @@ decrease_ob (improver); /* So it updates the players stats and the window */ - fix_player (op); + op->update_stats (); return 1; } @@ -885,7 +883,7 @@ { esrv_send_item (op, armour); if (QUERY_FLAG (armour, FLAG_APPLIED)) - fix_player (op); + op->update_stats (); } decrease_ob (improver); if (tmp) @@ -2330,7 +2328,7 @@ { /* resistance increased! */ skin->resist[i]++; - fix_player (op); + op->update_stats (); sprintf (buf, "Your skin is now more resistant to %s!", change_resist_msg[i]); new_draw_info (NDI_UNIQUE | NDI_RED, 0, op, buf); @@ -2359,40 +2357,6 @@ return 1; } -static void -apply_savebed (object *pl) -{ -#ifndef COZY_SERVER - if (!pl->contr->name_changed || !pl->stats.exp) - { - new_draw_info (NDI_UNIQUE, 0, pl, "You don't deserve to save your character yet."); - return; - } -#endif - INVOKE_PLAYER (LOGOUT, pl->contr); - /* Need to call terminate_all_pets() before we remove the player ob */ - terminate_all_pets (pl); - pl->remove (); - pl->direction = 0; - new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, pl, "%s leaves the game.", &pl->name); - - /* update respawn position */ - strcpy (pl->contr->savebed_map, pl->map->path); - pl->contr->bed_x = pl->x; - pl->contr->bed_y = pl->y; - - strcpy (pl->contr->killer, "left"); - check_score (pl); /* Always check score */ - (void) save_player (pl, 0); - pl->map->players--; -#if MAP_MAXTIMEOUT - MAP_SWAP_TIME (pl->map) = MAP_TIMEOUT (pl->map); -#endif - play_again (pl); - pl->speed = 0; - update_ob_speed (pl); -} - /** * Handles applying an improve armor scroll. * Does some sanity checks, then calls improve_armour. @@ -2407,12 +2371,15 @@ new_draw_info (NDI_UNIQUE, 0, op, "Something blocks the magic of the scroll."); return; } + armor = find_marked_object (op); + if (!armor) { new_draw_info (NDI_UNIQUE, 0, op, "You need to mark an armor object."); return; } + if (armor->type != ARMOUR && armor->type != CLOAK && armor->type != BOOTS && armor->type != GLOVES && armor->type != BRACERS && armor->type != SHIELD && armor->type != HELMET) @@ -2425,7 +2392,6 @@ improve_armour (op, tmp, armor); } - extern void apply_poison (object *op, object *tmp) { @@ -2555,9 +2521,7 @@ return 1; } else - { - return 0; /* monsters just skip unpaid items */ - } + return 0; /* monsters just skip unpaid items */ } if (INVOKE_OBJECT (APPLY, tmp, ARG_OBJECT (op))) @@ -2565,7 +2529,6 @@ switch (tmp->type) { - case CF_HANDLE: new_draw_info (NDI_UNIQUE, 0, op, "You turn the handle."); play_sound_map (op->map, op->x, op->y, SOUND_TURN_HANDLE); @@ -2703,15 +2666,7 @@ return 1; case SAVEBED: - if (op->type == PLAYER) - { - apply_savebed (op); - return 1; - } - else - { - return 0; - } + return 1; case ARMOUR_IMPROVER: if (op->type == PLAYER) @@ -2720,9 +2675,7 @@ return 1; } else - { - return 0; - } + return 0; case WEAPON_IMPROVER: (void) check_improve_weapon (op, tmp); @@ -2957,7 +2910,7 @@ op->destroy (); insert_ob_in_ob (tmp2, who); - fix_player (who); + who->update_stats (); if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) { if (who->type == PLAYER) @@ -3000,7 +2953,7 @@ break; } - fix_player (who); + who->update_stats (); if (!(aflags & AP_NO_MERGE)) { @@ -3499,7 +3452,7 @@ if (who->type == PLAYER) esrv_send_item (who, tmp); } - fix_player (who); + who->update_stats (); if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) { if (who->type == PLAYER) @@ -3606,7 +3559,7 @@ if (tmp != NULL) tmp = insert_ob_in_ob (tmp, who); - fix_player (who); + who->update_stats (); /* We exclude spell casting objects. The fire code will set the * been applied flag when they are used - until that point, @@ -3900,7 +3853,7 @@ /* place limit on max sp from food? */ } } - fix_player (who); + who->update_stats (); } /** @@ -3958,7 +3911,7 @@ * gets changed. */ if (is_player_env) - fix_player (who); + who->update_stats (); } else new_draw_info_format (NDI_UNIQUE, 0, who, "You attempt to light the %s with the %s and fail.", &item->name, &lighter->name);