Crossfire Server, Trunk
ob_types.c
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 1999-2014 Mark Wedel and the Crossfire Development Team
5  * Copyright (c) 1992 Frank Tore Johansen
6  *
7  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
8  * welcome to redistribute it under certain conditions. For details, please
9  * see COPYING and LICENSE.
10  *
11  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
12  */
13 
19 #include <global.h>
20 #include <ob_types.h>
21 #include <ob_methods.h>
22 #include <sproto.h>
23 
26 
32 void init_ob_method_struct(ob_methods *methods, ob_methods *fallback) {
33  methods->fallback = fallback;
34  methods->apply = NULL;
35  methods->process = NULL;
36  methods->describe = NULL;
37  methods->move_on = NULL;
38  methods->trigger = NULL;
39 }
40 
50  int tmp;
51 
52  for (tmp = 0; tmp < OBJECT_TYPE_MAX; tmp++)
54 }
55 
56 /* Functions for registering methods for types */
62 void register_apply(int ob_type, apply_func method) {
63  type_methods[ob_type].apply = method;
64 }
65 
71 void register_process(int ob_type, process_func method) {
72  type_methods[ob_type].process = method;
73 }
74 
80 void register_describe(int ob_type, describe_func method) {
81  type_methods[ob_type].describe = method;
82 }
83 
89 void register_move_on(int ob_type, move_on_func method) {
90  type_methods[ob_type].move_on = method;
91 }
92 
98 void register_trigger(int ob_type, trigger_func method) {
99  type_methods[ob_type].trigger = method;
100 }
global.h
trigger_func
method_ret(* trigger_func)(object *, object *, int)
Definition: ob_methods.h:43
register_process
void register_process(int ob_type, process_func method)
Definition: ob_types.c:71
init_ob_method_struct
void init_ob_method_struct(ob_methods *methods, ob_methods *fallback)
Definition: ob_types.c:32
ob_methods::move_on
move_on_func move_on
Definition: ob_methods.h:49
process_func
method_ret(* process_func)(object *)
Definition: ob_methods.h:40
Ice.tmp
int tmp
Definition: Ice.py:207
base_type
static ob_methods base_type
Definition: ob_methods.c:27
describe_func
void(* describe_func)(const object *, const object *, int use_media_tags, char *buf, size_t size)
Definition: ob_methods.h:41
ob_methods::apply
apply_func apply
Definition: ob_methods.h:46
ob_methods
Definition: ob_methods.h:45
register_move_on
void register_move_on(int ob_type, move_on_func method)
Definition: ob_types.c:89
init_ob_types
void init_ob_types(ob_methods *base_type)
Definition: ob_types.c:49
sproto.h
register_trigger
void register_trigger(int ob_type, trigger_func method)
Definition: ob_types.c:98
move_on_func
method_ret(* move_on_func)(object *, object *, object *)
Definition: ob_methods.h:42
ob_methods::describe
describe_func describe
Definition: ob_methods.h:48
register_describe
void register_describe(int ob_type, describe_func method)
Definition: ob_types.c:80
register_apply
void register_apply(int ob_type, apply_func method)
Definition: ob_types.c:62
ob_types.h
ob_methods::process
process_func process
Definition: ob_methods.h:47
ob_methods::trigger
trigger_func trigger
Definition: ob_methods.h:50
OBJECT_TYPE_MAX
@ OBJECT_TYPE_MAX
Definition: object.h:251
ob_methods.h
ob_methods::fallback
struct ob_methods * fallback
Definition: ob_methods.h:51
type_methods
ob_methods type_methods[OBJECT_TYPE_MAX]
Definition: ob_types.c:25
apply_func
method_ret(* apply_func)(object *, object *, int)
Definition: ob_methods.h:39