Crossfire Server, Branches 1.12  R18729
ob_methods.c
Go to the documentation of this file.
1 /*
2  * static char *rcsid_ob_methods =
3  * "$Id: build_map.c 5057 2006-10-29 07:50:09Z mwedel $";
4  */
5 /*
6  CrossFire, A Multiplayer game for X-windows
7 
8  Copyright (C) 2006 Mark Wedel & Crossfire Development Team
9  Copyright (C) 1992 Frank Tore Johansen
10 
11  This program is free software; you can redistribute it and/or modify
12  it under the terms of the GNU General Public License as published by
13  the Free Software Foundation; either version 2 of the License, or
14  (at your option) any later version.
15 
16  This program is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with this program; if not, write to the Free Software
23  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 
25  The authors can be reached via e-mail to crossfire-devel@real-time.com
26 */
27 
33 #include <global.h>
34 #include <ob_methods.h>
35 #include <ob_types.h>
36 
37 #ifndef __CEXTRACT__
38 #include <sproto.h>
39 #endif
40 
42 
44 
49 void init_ob_methods(void) {
50  /* Init legacy_type. Note, this is just used as a transitionary fallback
51  * until refactoring of type-specific code is complete, and when it is this
52  * ob_methods struct should be removed.
53  */
54  init_ob_method_struct(&legacy_type, NULL);
55  legacy_type.apply = legacy_ob_apply;
56  legacy_type.process = legacy_ob_process;
57  legacy_type.describe = legacy_ob_describe;
58  legacy_type.move_on = NULL;
59 
60  /* Init base_type, inheriting from legacy_type. The base_type is susposed to
61  * be a base class of object that all other object types inherit methods
62  * they don't handle individually. Things such as generic drop/pickup code
63  * should go here, in addition some other things such as "I don't know how
64  * to apply that." messages should be handled from here.
65  */
66  init_ob_method_struct(&base_type, &legacy_type);
67  /* base_type.foobar = common_ob_foobar; */
68 
69  /* Init object types methods, inheriting from base_type. */
70  init_ob_types(&base_type);
72 }
void init_ob_types(ob_methods *base_type)
Definition: ob_types.c:66
void init_ob_method_struct(ob_methods *methods, ob_methods *fallback)
Definition: ob_types.c:49
void register_all_ob_types(void)
Definition: ob_types.c:45
apply_func apply
Definition: ob_methods.h:73
method_ret legacy_ob_apply(ob_methods *context, object *op, object *applier, int aflags)
Definition: apply.c:49
static ob_methods legacy_type
Definition: ob_methods.c:43
move_on_func move_on
Definition: ob_methods.h:76
void init_ob_methods(void)
Definition: ob_methods.c:49
process_func process
Definition: ob_methods.h:74
void legacy_ob_describe(const ob_methods *context, const object *op, const object *observer, char *buf, size_t size)
describe_func describe
Definition: ob_methods.h:75
method_ret legacy_ob_process(ob_methods *context, object *op)
Definition: process.c:31
static ob_methods base_type
Definition: ob_methods.c:41