Crossfire Server, Branch 1.12  R12190
ob_methods.c
Go to the documentation of this file.
00001 /*
00002  * static char *rcsid_ob_methods =
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_methods.h>
00035 #include <ob_types.h>
00036 
00037 #ifndef __CEXTRACT__
00038 #include <sproto.h>
00039 #endif
00040 
00041 static ob_methods base_type;
00042 
00043 static ob_methods legacy_type;
00044 
00049 void init_ob_methods(void) {
00050     /* Init legacy_type. Note, this is just used as a transitionary fallback
00051      * until refactoring of type-specific code is complete, and when it is this
00052      * ob_methods struct should be removed.
00053      */
00054     init_ob_method_struct(&legacy_type, NULL);
00055     legacy_type.apply = legacy_ob_apply;
00056     legacy_type.process = legacy_ob_process;
00057     legacy_type.describe = legacy_ob_describe;
00058     legacy_type.move_on = NULL;
00059 
00060     /* Init base_type, inheriting from legacy_type. The base_type is susposed to
00061      * be a base class of object that all other object types inherit methods
00062      * they don't handle individually. Things such as generic drop/pickup code
00063      * should go here, in addition some other things such as "I don't know how
00064      * to apply that." messages should be handled from here.
00065      */
00066     init_ob_method_struct(&base_type, &legacy_type);
00067     /* base_type.foobar = common_ob_foobar; */
00068 
00069     /* Init object types methods, inheriting from base_type. */
00070     init_ob_types(&base_type);
00071     register_all_ob_types();
00072 }