Crossfire Server, Branch 1.12
R12190
|
00001 /* 00002 * static char *rcsid_ob_types = 00003 * "$Id: build_map.c 5057 2006-10-29 07:50:09Z mwedel $"; 00004 */ 00005 /* 00006 CrossFire, A Multiplayer game for X-windows 00007 00008 Copyright (C) 2006 Mark Wedel & Crossfire Development Team 00009 Copyright (C) 1992 Frank Tore Johansen 00010 00011 This program is free software; you can redistribute it and/or modify 00012 it under the terms of the GNU General Public License as published by 00013 the Free Software Foundation; either version 2 of the License, or 00014 (at your option) any later version. 00015 00016 This program is distributed in the hope that it will be useful, 00017 but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 GNU General Public License for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with this program; if not, write to the Free Software 00023 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00024 00025 The authors can be reached via e-mail to crossfire-devel@real-time.com 00026 */ 00027 00033 #include <global.h> 00034 #include <ob_types.h> 00035 #include <ob_methods.h> 00036 00037 #ifndef __CEXTRACT__ 00038 #include <sproto.h> 00039 #endif 00040 00042 ob_methods type_methods[OBJECT_TYPE_MAX]; 00043 00049 void init_ob_method_struct(ob_methods *methods, ob_methods *fallback) { 00050 methods->fallback = fallback; 00051 methods->apply = NULL; 00052 methods->process = NULL; 00053 methods->describe = NULL; 00054 methods->move_on = NULL; 00055 methods->trigger = NULL; 00056 } 00057 00066 void init_ob_types(ob_methods *base_type) { 00067 int tmp; 00068 00069 for (tmp = 0; tmp < OBJECT_TYPE_MAX; tmp++) 00070 init_ob_method_struct(&type_methods[tmp], base_type); 00071 } 00072 00073 /* Functions for registering methods for types */ 00079 void register_apply(int ob_type, apply_func method) { 00080 type_methods[ob_type].apply = method; 00081 } 00082 00088 void register_process(int ob_type, process_func method) { 00089 type_methods[ob_type].process = method; 00090 } 00091 00097 void register_describe(int ob_type, describe_func method) { 00098 type_methods[ob_type].describe = method; 00099 } 00100 00106 void register_move_on(int ob_type, move_on_func method) { 00107 type_methods[ob_type].move_on = method; 00108 } 00109 00115 void register_trigger(int ob_type, trigger_func method) { 00116 type_methods[ob_type].trigger = method; 00117 }