Atrinik Server  4.0
object_methods.h
Go to the documentation of this file.
1 /*************************************************************************
2  * Atrinik, a Multiplayer Online Role Playing Game *
3  * *
4  * Copyright (C) 2009-2014 Alex Tokar and Atrinik Development Team *
5  * *
6  * Fork from Crossfire (Multiplayer game for X-windows). *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the Free Software *
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
21  * *
22  * The author can be reached at admin@atrinik.org *
23  ************************************************************************/
24 
30 #ifndef OBJECT_METHODS_H
31 #define OBJECT_METHODS_H
32 
33 #include <decls.h>
34 
35 typedef struct object_methods {
42  void (*init_func)(object *op);
43 
50  void (*deinit_func)(object *op);
51 
62  int (*apply_func)(object *op,
63  object *applier,
64  int aflags);
65 
72  void (*process_func)(object *op);
73 
86  void (*describe_func)(object *op,
87  object *observer,
88  char *buf,
89  size_t size);
90 
105  int (*move_on_func)(object *op,
106  object *victim,
107  object *originator,
108  int state);
109 
120  int (*trigger_func)(object *op,
121  object *cause,
122  int state);
123 
134  int (*trigger_button_func)(object *op,
135  object *cause,
136  int state);
137 
144  void (*insert_map_func)(object *op);
145 
152  void (*remove_map_func)(object *op);
153 
160  void (*remove_inv_func)(object *op);
161 
175  object *(*projectile_fire_func)(object *op,
176  object *shooter,
177  int dir);
178 
188  object *(*projectile_move_func)(object *op);
189 
208  int (*projectile_hit_func)(object *op,
209  object *victim);
210 
221  object *(*projectile_stop_func)(object *op,
222  int reason);
223 
239  int (*ranged_fire_func)(object *op,
240  object *shooter,
241  int dir,
242  double *delay);
243 
250  void (*auto_apply_func)(object *op);
251 
275  int (*process_treasure_func)(object *op,
276  object **ret,
277  int difficulty,
278  treasure_affinity_t *affinity,
279  int flags);
280 
286 
292 
298 #define OBJECT_METHOD_UNHANDLED 0
299 
300 #define OBJECT_METHOD_OK 1
301 
302 #define OBJECT_METHOD_ERROR 2
303 
310 #define OBJECT_PROJECTILE_STOP_EOL 1
311 
312 #define OBJECT_PROJECTILE_STOP_HIT 2
313 
314 #define OBJECT_PROJECTILE_STOP_WALL 3
315 
316 #define OBJECT_PROJECTILE_PICKUP 4
317 
325 #define OBJECT_TYPE_INIT_DEFINE(what) \
326  void CONCAT(object_type_init_, what)(void); \
327  void CONCAT(object_type_init_, what)(void)
328 
335 #define OBJECT_METHODS(type) (object_methods_get(type))
336 
337 /* Prototypes */
338 
339 void
340 object_methods_init(void);
343 void
344 object_cb_init(object *op);
345 void
346 object_cb_deinit(object *op);
347 int
348 object_apply(object *op, object *applier, int aflags);
349 void
350 object_process(object *op);
351 char *
352 object_describe(object *op, object *observer, char *buf, size_t size);
353 int
354 object_move_on(object *op, object *victim, object *originator, int state);
355 int
356 object_trigger(object *op, object *cause, int state);
357 int
358 object_trigger_button(object *op, object *cause, int state);
359 void
360 object_cb_insert_map(object *op);
361 void
362 object_cb_remove_map(object *op);
363 void
364 object_cb_remove_inv(object *op);
365 object *
366 object_projectile_fire(object *op, object *shooter, int dir);
367 object *
368 object_projectile_move(object *op);
369 int
370 object_projectile_hit(object *op, object *victim);
371 object *
372 object_projectile_stop(object *op, int reason);
373 int
374 object_ranged_fire(object *op, object *shooter, int dir, double *delay);
375 void
376 object_auto_apply(object *op);
377 int
378 object_process_treasure(object *op,
379  object **ret,
380  int difficulty,
381  treasure_affinity_t *affinity,
382  int flags);
383 
384 #endif
object_methods_t * object_methods_get(int type)
object * object_projectile_move(object *op)
void object_cb_init(object *op)
uint8_t type
One of operation types.
Definition: sound_ambient.c:45
int(* move_on_func)(object *op, object *victim, object *originator, int state)
int object_projectile_hit(object *op, object *victim)
object * object_projectile_stop(object *op, int reason)
bool override_treasure_processing
void(* describe_func)(object *op, object *observer, char *buf, size_t size)
int(* apply_func)(object *op, object *applier, int aflags)
int(* ranged_fire_func)(object *op, object *shooter, int dir, double *delay)
void object_process(object *op)
void(* remove_inv_func)(object *op)
int(* trigger_func)(object *op, object *cause, int state)
void(* auto_apply_func)(object *op)
int object_apply(object *op, object *applier, int aflags)
int object_move_on(object *op, object *victim, object *originator, int state)
int object_ranged_fire(object *op, object *shooter, int dir, double *delay)
void(* deinit_func)(object *op)
void object_auto_apply(object *op)
int(* process_treasure_func)(object *op, object **ret, int difficulty, treasure_affinity_t *affinity, int flags)
void object_cb_deinit(object *op)
char * object_describe(object *op, object *observer, char *buf, size_t size)
void object_cb_remove_map(object *op)
object * object_projectile_fire(object *op, object *shooter, int dir)
void object_cb_insert_map(object *op)
void(* remove_map_func)(object *op)
void(* process_func)(object *op)
int object_trigger_button(object *op, object *cause, int state)
int object_process_treasure(object *op, object **ret, int difficulty, treasure_affinity_t *affinity, int flags)
int(* trigger_button_func)(object *op, object *cause, int state)
void(* init_func)(object *op)
int(* projectile_hit_func)(object *op, object *victim)
int object_trigger(object *op, object *cause, int state)
struct object_methods * fallback
void object_cb_remove_inv(object *op)
void(* insert_map_func)(object *op)
void object_methods_init(void)