Atrinik Server  4.0
Data Fields
object_methods Struct Reference

Data Fields

void(* init_func )(object *op)
 
void(* deinit_func )(object *op)
 
int(* apply_func )(object *op, object *applier, int aflags)
 
void(* process_func )(object *op)
 
void(* describe_func )(object *op, object *observer, char *buf, size_t size)
 
int(* move_on_func )(object *op, object *victim, object *originator, int state)
 
int(* trigger_func )(object *op, object *cause, int state)
 
int(* trigger_button_func )(object *op, object *cause, int state)
 
void(* insert_map_func )(object *op)
 
void(* remove_map_func )(object *op)
 
void(* remove_inv_func )(object *op)
 
object *(* projectile_fire_func )(object *op, object *shooter, int dir)
 
object *(* projectile_move_func )(object *op)
 
int(* projectile_hit_func )(object *op, object *victim)
 
object *(* projectile_stop_func )(object *op, int reason)
 
int(* ranged_fire_func )(object *op, object *shooter, int dir, double *delay)
 
void(* auto_apply_func )(object *op)
 
int(* process_treasure_func )(object *op, object **ret, int difficulty, treasure_affinity_t *affinity, int flags)
 
bool override_treasure_processing:1
 
struct object_methodsfallback
 

Detailed Description

Definition at line 35 of file object_methods.h.

Field Documentation

int(* object_methods::apply_func)(object *op, object *applier, int aflags)

Applies an object.

Parameters
opThe object to apply.
applierThe object that executes the apply action.
aflagsSpecial (always apply/unapply) flags.

Definition at line 62 of file object_methods.h.

void(* object_methods::auto_apply_func)(object *op)

Processes an object with FLAG_AUTO_APPLY.

Parameters
opThe object to process.

Definition at line 250 of file object_methods.h.

void(* object_methods::deinit_func)(object *op)

De-initializes an object.

Parameters
opThe object to de-initialize.

Definition at line 50 of file object_methods.h.

void(* object_methods::describe_func)(object *op, object *observer, char *buf, size_t size)

Returns the description of an object, as seen by the given observer.

Parameters
opThe object to describe.
observerThe object to which the description is made.
bufBuffer that will contain the description.
sizeSize of 'buf'.

Definition at line 86 of file object_methods.h.

struct object_methods* object_methods::fallback

Fallback methods.

Definition at line 290 of file object_methods.h.

void(* object_methods::init_func)(object *op)

Initializes an object.

Parameters
opThe object to initialize.

Definition at line 42 of file object_methods.h.

void(* object_methods::insert_map_func)(object *op)

Called when an object is inserted on a map.

Parameters
opThe object being inserted.

Definition at line 144 of file object_methods.h.

int(* object_methods::move_on_func)(object *op, object *victim, object *originator, int state)

Triggered when an object moves moves off a square and when object moves onto a square.

Parameters
opThe object that wants to catch this event.
victimThe object moving.
originatorThe object that is the cause of the move.
state1 if the object is moving onto a square, 0 if moving off a square.

Definition at line 105 of file object_methods.h.

bool object_methods::override_treasure_processing

If true, will override the standard treasure processing such as setting a magic bonus, generating artifacts, etc.

Definition at line 285 of file object_methods.h.

void(* object_methods::process_func)(object *op)

Processes an object, giving it the opportunity to move or react.

Parameters
opThe object to process.

Definition at line 72 of file object_methods.h.

int(* object_methods::process_treasure_func)(object *op, object **ret, int difficulty, treasure_affinity_t *affinity, int flags)

Process generated treasure.

Parameters
opObject to process.
[out]retIf the function returns OBJECT_METHOD_OK, this variable will contain the processed treasure object, which may be different from 'op' (which may be destroyed). Indeterminate on any other return value.
difficultyDifficulty level.
affinityTreasure affinity.
flagsA combination of GT_xxx flags.
Returns
One of Object method return values.
Warning
If OBJECT_METHOD_ERROR is returned from this function, it is possible that the original object has been destroyed and thus any further processing should stop.

Definition at line 275 of file object_methods.h.

object*(* object_methods::projectile_fire_func)(object *op, object *shooter, int dir)

Function to handle firing a projectile, eg, an arrow being fired from a bow, or a potion being thrown.

Parameters
opWhat is being fired.
shooterWho is doing the firing.
dirDirection to fire into.
Returns
The fired object on success, NULL on failure.

Definition at line 175 of file object_methods.h.

int(* object_methods::projectile_hit_func)(object *op, object *victim)

Called when a fired object finds an alive object on the square it just moved to.

Parameters
opThe fired object.
victimThe found alive object. Note that this just means that the object is on the LAYER_LIVING layer, which may or may not imply that the object is actually alive.
Return values
OBJECT_METHOD_OKSuccessfully processed and should stop the fired arch.
OBJECT_METHOD_UNHANDLEDDid not handle the event, should continue trying to look for another alive object.
OBJECT_METHOD_ERROR'op' was destroyed.

Definition at line 208 of file object_methods.h.

object*(* object_methods::projectile_move_func)(object *op)

Function to handle a fired object moving, eg, arrow moving to the next square along its path.

Parameters
opThe fired object.
Returns
The fired object, NULL if it was destroyed for some reason.

Definition at line 188 of file object_methods.h.

object*(* object_methods::projectile_stop_func)(object *op, int reason)

Called to stop a fired object.

Parameters
opThe fired object.
reasonReason for stopping, one of Projectile stop reasons.
Returns
The fired object if it still exists, NULL otherwise.

Definition at line 221 of file object_methods.h.

int(* object_methods::ranged_fire_func)(object *op, object *shooter, int dir, double *delay)

Used to fire a ranged weapon, eg, a bow firing arrows, throwing weapons/potions, firing wands/rods, etc.

Parameters
opThe weapon being fired (bow, wand, throwing object).
shooterWho is doing the firing.
dirDirection to fire into.
[out]delayIf non-NULL, will contain delay caused by this action.
Returns
One of Object method return values.

Definition at line 239 of file object_methods.h.

void(* object_methods::remove_inv_func)(object *op)

Called when an object is removed from inventory.

Parameters
opThe object being removed.

Definition at line 160 of file object_methods.h.

void(* object_methods::remove_map_func)(object *op)

Called when an object is removed from map.

Parameters
opThe object being removed.

Definition at line 152 of file object_methods.h.

int(* object_methods::trigger_button_func)(object *op, object *cause, int state)

An object is triggered by a button.

Parameters
opThe object being triggered.
causeThe object that is the cause of the trigger; the button.
stateTrigger state.

Definition at line 134 of file object_methods.h.

int(* object_methods::trigger_func)(object *op, object *cause, int state)

An object is triggered by another one.

Parameters
opThe object being triggered.
causeThe object that is the cause of the trigger.
stateTrigger state.

Definition at line 120 of file object_methods.h.


The documentation for this struct was generated from the following file: