Crossfire Server  1.75.0
ob_types.cpp File Reference

Those functions deal with the object/type system. More...

#include <global.h>
#include <ob_types.h>
#include <ob_methods.h>
#include <sproto.h>

Go to the source code of this file.

Functions

void init_ob_method_struct (ob_methods *methods, ob_methods *fallback)
 Initializes a ob_methods struct. More...
 
void init_ob_types (ob_methods *base_type)
 Initializes the object system. More...
 
void register_apply (int ob_type, apply_func method)
 Registers the apply method for the given type. More...
 
void register_describe (int ob_type, describe_func method)
 Registers the describe method for the given type. More...
 
void register_examine (int ob_type, examine_func method)
 Registers the examine method for the given type. More...
 
void register_move_on (int ob_type, move_on_func method)
 Registers the move_on method for the given type. More...
 
void register_process (int ob_type, process_func method)
 Registers the process method for the given type. More...
 
void register_trigger (int ob_type, trigger_func method)
 Registers the trigger method for the given type. More...
 

Variables

ob_methods type_methods [OBJECT_TYPE_MAX]
 Registered method handlers. More...
 

Detailed Description

Those functions deal with the object/type system.

Definition in file ob_types.cpp.

Function Documentation

◆ init_ob_method_struct()

void init_ob_method_struct ( ob_methods methods,
ob_methods fallback 
)

Initializes a ob_methods struct.

Make sure this always matches ob_methods.h

Parameters
methodsob_method structure to initialize
fallbackDefault fallback for the ob_method

Definition at line 32 of file ob_types.cpp.

References ob_methods::apply, ob_methods::describe, ob_methods::fallback, ob_methods::move_on, ob_methods::process, and ob_methods::trigger.

Referenced by init_ob_methods(), and init_ob_types().

◆ init_ob_types()

void init_ob_types ( ob_methods base_type)

Initializes the object system.

Parameters
base_typebase type to use as a base for all types.
Todo:
when migration is complete, the parameter should go, and this function should be called from init_library() instead of init_ob_methods() in server/ob_methods.c.

Definition at line 49 of file ob_types.cpp.

References init_ob_method_struct(), and OBJECT_TYPE_MAX.

Referenced by init_ob_methods().

◆ register_apply()

◆ register_describe()

void register_describe ( int  ob_type,
describe_func  method 
)

Registers the describe method for the given type.

Parameters
ob_typeThe type of object to register this method to
methodThe method to link

Definition at line 80 of file ob_types.cpp.

References ob_methods::describe.

Referenced by init_type_container(), init_type_lamp(), init_type_power_crystal(), and init_type_spellbook().

◆ register_examine()

void register_examine ( int  ob_type,
examine_func  method 
)

Registers the examine method for the given type.

Parameters
ob_typeThe type of object to register this method to
methodThe method to link

Definition at line 89 of file ob_types.cpp.

References ob_methods::examine.

Referenced by init_type_container(), and init_type_lighter().

◆ register_move_on()

◆ register_process()

void register_process ( int  ob_type,
process_func  method 
)

◆ register_trigger()

void register_trigger ( int  ob_type,
trigger_func  method 
)

Registers the trigger method for the given type.

Parameters
ob_typeThe type of object to register this method to
methodThe method to link

Definition at line 107 of file ob_types.cpp.

References ob_methods::trigger.

Referenced by init_type_creator(), init_type_duplicator(), init_type_marker(), init_type_mood_floor(), and init_type_teleporter().

Variable Documentation

◆ type_methods

ob_methods type_methods[OBJECT_TYPE_MAX]

Registered method handlers.

Definition at line 25 of file ob_types.cpp.

Referenced by ob_apply(), ob_describe(), ob_examine(), ob_move_on(), ob_process(), and ob_trigger().