Crossfire Server, Trunk  1.75.0
apply.cpp
Go to the documentation of this file.
1 /*
2  CrossFire, A Multiplayer game for X-windows
3 
4  Copyright (C) 2007 Mark Wedel & Crossfire Development Team
5  Copyright (C) 1992 Frank Tore Johansen
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21  The authors can be reached via e-mail to crossfire-devel@real-time.com
22 */
23 #include <global.h>
24 #include <ob_methods.h>
25 #include <ob_types.h>
26 #include <sounds.h>
27 #include <sproto.h>
28 
49 method_ret legacy_ob_apply(object *op, object *applier, int aflags) {
50  switch (op->type) {
51  /* Eneq(at)(csd.uu.se): Handle apply on containers. */
52  case WEAPON:
53  case ARMOUR:
54  case BOOTS:
55  case GLOVES:
56  case AMULET:
57  case GIRDLE:
58  case BRACERS:
59  case SHIELD:
60  case HELMET:
61  case RING:
62  case CLOAK:
63  case WAND:
64  case ROD:
65  case SKILL:
66  case BOW:
67  case BUILDER:
68  case SKILL_TOOL:
69  if (op->env != applier)
70  return METHOD_ERROR; /* not in inventory */
71  (void)apply_special(applier, op, aflags);
72  return METHOD_OK;
73 
74  default:
75  return METHOD_UNHANDLED;
76  }
77 }
global.h
BOW
@ BOW
Definition: object.h:123
BRACERS
@ BRACERS
Definition: object.h:222
WAND
@ WAND
Definition: object.h:225
GLOVES
@ GLOVES
Definition: object.h:218
GIRDLE
@ GIRDLE
Definition: object.h:228
legacy_ob_apply
method_ret legacy_ob_apply(object *op, object *applier, int aflags)
Main apply handler.
Definition: apply.cpp:49
apply_special
int apply_special(object *who, object *op, int aflags)
Apply an object.
Definition: apply.cpp:818
METHOD_OK
#define METHOD_OK
Definition: ob_methods.h:15
ARMOUR
@ ARMOUR
Definition: object.h:125
WEAPON
@ WEAPON
Definition: object.h:124
AMULET
@ AMULET
Definition: object.h:144
SKILL
@ SKILL
Also see SKILL_TOOL (74) below.
Definition: object.h:148
METHOD_UNHANDLED
#define METHOD_UNHANDLED
Definition: ob_methods.h:16
CLOAK
@ CLOAK
Definition: object.h:209
HELMET
@ HELMET
Definition: object.h:141
BUILDER
@ BUILDER
Generic item builder, see subtypes below.
Definition: object.h:251
ROD
@ ROD
Definition: object.h:114
object::type
uint8_t type
PLAYER, BULLET, etc.
Definition: object.h:348
sproto.h
RING
@ RING
Definition: object.h:190
method_ret
char method_ret
Define some standard return values for callbacks which don't need to return any other results.
Definition: ob_methods.h:14
ob_types.h
sounds.h
object::env
object * env
Pointer to the object which is the environment.
Definition: object.h:301
SKILL_TOOL
@ SKILL_TOOL
Allows the use of a skill.
Definition: object.h:194
METHOD_ERROR
#define METHOD_ERROR
Definition: ob_methods.h:17
ob_methods.h
BOOTS
@ BOOTS
Definition: object.h:217
SHIELD
@ SHIELD
Definition: object.h:140