Debian Codegraph @

server/ob_methods.c

raw symbols SCIP
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 <[email protected]>.
12 */
13
14 /**
15 * @file
16 * Those functions deal with the object/type system.
17 */
18
19 #include <global.h>
20 #include <ob_methods.h>
21 #include <ob_types.h>
22
23 #ifndef __CEXTRACT__
24 #include <sproto.h>
25 #endif
26
27 static ob_methods base_type;
28
29 static ob_methods legacy_type;
30
31 /**
32 * Initializes the ob_method system. This means initializing legacy_type,
33 * base_type, and also calling init_ob_types() from ob_types.c
34 */
35 void init_ob_methods(void) {
36 /* Init legacy_type. Note, this is just used as a transitionary fallback
37 * until refactoring of type-specific code is complete, and when it is this
38 * ob_methods struct should be removed.
39 */
40 init_ob_method_struct(&legacy_type, NULL);
41 legacy_type.apply = legacy_ob_apply;
42 legacy_type.process = legacy_ob_process;
43 legacy_type.describe = legacy_ob_describe;
44 legacy_type.move_on = NULL;
45
46 /* Init base_type, inheriting from legacy_type. The base_type is susposed to
47 * be a base class of object that all other object types inherit methods
48 * they don't handle individually. Things such as generic drop/pickup code
49 * should go here, in addition some other things such as "I don't know how
50 * to apply that." messages should be handled from here.
51 */
52 init_ob_method_struct(&base_type, &legacy_type);
53 /* base_type.foobar = common_ob_foobar; */
54
55 /* Init object types methods, inheriting from base_type. */
56 init_ob_types(&base_type);
57 register_all_ob_types();
58 }