Crossfire Server, Branch 1.12  R12190
apply.c
Go to the documentation of this file.
00001 /*
00002     CrossFire, A Multiplayer game for X-windows
00003 
00004     Copyright (C) 2007 Mark Wedel & Crossfire Development Team
00005     Copyright (C) 1992 Frank Tore Johansen
00006 
00007     This program is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or
00010     (at your option) any later version.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program; if not, write to the Free Software
00019     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020 
00021     The authors can be reached via e-mail to crossfire-devel@real-time.com
00022 */
00023 #include <global.h>
00024 #include <ob_methods.h>
00025 #include <ob_types.h>
00026 #include <sounds.h>
00027 #include <sproto.h>
00028 
00049 method_ret legacy_ob_apply(ob_methods *context, object *op, object *applier, int aflags) {
00050     switch (op->type) {
00051         /* Eneq(at)(csd.uu.se): Handle apply on containers. */
00052     case CLOSE_CON:
00053         if (applier->type == PLAYER)
00054             legacy_apply_container(applier, op->env);
00055         return METHOD_OK;
00056 
00057     case CONTAINER:
00058         if (applier->type == PLAYER)
00059             legacy_apply_container(applier, op);
00060         return METHOD_OK;
00061 
00062     case WEAPON:
00063     case ARMOUR:
00064     case BOOTS:
00065     case GLOVES:
00066     case AMULET:
00067     case GIRDLE:
00068     case BRACERS:
00069     case SHIELD:
00070     case HELMET:
00071     case RING:
00072     case CLOAK:
00073     case WAND:
00074     case ROD:
00075     case HORN:
00076     case SKILL:
00077     case BOW:
00078     case BUILDER:
00079     case SKILL_TOOL:
00080         if (op->env != applier)
00081             return METHOD_ERROR;   /* not in inventory */
00082         (void)apply_special(applier, op, aflags);
00083         return METHOD_OK;
00084 
00085     default:
00086         return METHOD_UNHANDLED;
00087     }
00088 }