Crossfire Server, Trunk
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 CLOSE_CON:
53  if (applier->type == PLAYER)
54  (void)apply_container(applier, op->env, aflags);
55  return METHOD_OK;
56 
57  case CONTAINER:
58  if (applier->type == PLAYER)
59  (void)apply_container(applier, op, aflags);
60  return METHOD_OK;
61 
62  case WEAPON:
63  case ARMOUR:
64  case BOOTS:
65  case GLOVES:
66  case AMULET:
67  case GIRDLE:
68  case BRACERS:
69  case SHIELD:
70  case HELMET:
71  case RING:
72  case CLOAK:
73  case WAND:
74  case ROD:
75  case SKILL:
76  case BOW:
77  case BUILDER:
78  case SKILL_TOOL:
79  if (op->env != applier)
80  return METHOD_ERROR; /* not in inventory */
81  (void)apply_special(applier, op, aflags);
82  return METHOD_OK;
83 
84  default:
85  return METHOD_UNHANDLED;
86  }
87 }
PLAYER
@ PLAYER
Definition: object.h:110
global.h
BOW
@ BOW
Definition: object.h:121
BRACERS
@ BRACERS
Definition: object.h:220
CLOSE_CON
@ CLOSE_CON
Definition: object.h:232
WAND
@ WAND
Definition: object.h:223
GLOVES
@ GLOVES
Definition: object.h:216
GIRDLE
@ GIRDLE
Definition: object.h:226
legacy_ob_apply
method_ret legacy_ob_apply(object *op, object *applier, int aflags)
Definition: apply.cpp:49
apply_special
int apply_special(object *who, object *op, int aflags)
Definition: apply.cpp:1156
METHOD_OK
#define METHOD_OK
Definition: ob_methods.h:15
ARMOUR
@ ARMOUR
Definition: object.h:123
WEAPON
@ WEAPON
Definition: object.h:122
AMULET
@ AMULET
Definition: object.h:142
SKILL
@ SKILL
Definition: object.h:146
METHOD_UNHANDLED
#define METHOD_UNHANDLED
Definition: ob_methods.h:16
CLOAK
@ CLOAK
Definition: object.h:207
HELMET
@ HELMET
Definition: object.h:139
BUILDER
@ BUILDER
Definition: object.h:249
ROD
@ ROD
Definition: object.h:112
CONTAINER
@ CONTAINER
Definition: object.h:234
object::type
uint8_t type
Definition: object.h:346
sproto.h
RING
@ RING
Definition: object.h:188
nlohmann::detail::void
j template void())
Definition: json.hpp:4099
apply_container
int apply_container(object *op, object *sack, int aflags)
Definition: apply.cpp:222
method_ret
char method_ret
Definition: ob_methods.h:14
ob_types.h
sounds.h
give.op
op
Definition: give.py:33
SKILL_TOOL
@ SKILL_TOOL
Definition: object.h:192
METHOD_ERROR
#define METHOD_ERROR
Definition: ob_methods.h:17
ob_methods.h
BOOTS
@ BOOTS
Definition: object.h:215
SHIELD
@ SHIELD
Definition: object.h:138