--- deliantra/server/server/apply.C 2010/04/03 02:27:24 1.234 +++ deliantra/server/server/apply.C 2010/04/03 02:46:19 1.235 @@ -2628,7 +2628,7 @@ * aflag is special (always apply/unapply) flags. Nothing is done with * them in this function - they are passed to apply_special */ -int +static int manual_apply (object *who, object *op, int aflag) { op = op->head_ (); @@ -3271,10 +3271,13 @@ // detect the slot, if this is a player if (contr && !(aflags & AP_NO_SLOT)) { + object *oslot; + switch (ob->type) { case WEAPON: slot = &contr->combat_ob; + oslot = contr->ranged_ob; break; case BOW: @@ -3285,6 +3288,7 @@ case HORN: case BUILDER: slot = &contr->ranged_ob; + oslot = contr->combat_ob; break; // oh, the humanity @@ -3296,20 +3300,34 @@ break; if (skill_flags [ob->subtype] & SF_COMBAT) - slot = &contr->combat_ob; + { + slot = &contr->combat_ob; + oslot = contr->ranged_ob; + } else if (skill_flags [ob->subtype] & SF_RANGED) - slot = &contr->ranged_ob; + { + slot = &contr->ranged_ob; + oslot = contr->combat_ob; + } break; } - // clear item from slot if applied - if (slot && *slot == ob && !want_apply) + // now handle slot exclusions + if (slot) { - *slot = 0; + // only one slot can be active + if (want_apply) + apply (oslot, AP_UNAPPLY); - if (current_weapon == ob) - current_weapon = 0; + // clear item from slot if applied + if (!want_apply && *slot == ob) + { + *slot = 0; + + if (current_weapon == ob) + current_weapon = 0; + } } }