Crossfire Server, Trunk  R20708
converter.c File Reference
#include "global.h"
#include <string.h>
#include "ob_methods.h"
#include "ob_types.h"
#include "shop.h"
#include "sounds.h"
#include "sproto.h"
+ Include dependency graph for converter.c:

Go to the source code of this file.


#define CONV_FROM(xyz)   xyz->slaying
#define CONV_NEED(xyz)   (unsigned long)xyz->
#define CONV_NR(xyz)   (unsigned char)xyz->stats.sp
#define CONV_TO(xyz)   xyz->other_arch


static int convert_item (object *item, object *converter)
static method_ret converter_type_move_on (ob_methods *context, object *trap, object *victim, object *originator)
void init_type_converter (void)

Detailed Description

The implementation of the Converter class of objects.

Definition in file converter.c.

Macro Definition Documentation

#define CONV_FROM (   xyz)    xyz->slaying

Definition at line 32 of file converter.c.

Referenced by convert_item().

#define CONV_NEED (   xyz)    (unsigned long)xyz->

Definition at line 35 of file converter.c.

Referenced by convert_item().

#define CONV_NR (   xyz)    (unsigned char)xyz->stats.sp

Definition at line 34 of file converter.c.

Referenced by convert_item().

#define CONV_TO (   xyz)    xyz->other_arch

Definition at line 33 of file converter.c.

Function Documentation

static int convert_item ( object item,
object converter 

Transforms an item into another item.

itemThe object that triggered the converter - if it isn't of a type accepted by the converter, nothing will happen
converterThe object that is doing the conversion
Return values
-1If something went wrong when attempting the conversion
0If the item was not converted
1If the item got converted

Definition at line 57 of file converter.c.

References Settings::allow_broken_converters, obj::arch, CLEAR_FLAG, CONV_FROM, CONV_NEED, CONV_NR, create_archetype(), FALSE, fix_generated_item(), FLAG_IS_A_TEMPLATE, FLAG_UNPAID, FOR_BELOW_FINISH, FOR_BELOW_PREPARE, GT_MINIMAL, obj::inv, llevError, LOG(), obj::map, MONEY, obj::name, archt::name, obj::nrof, object_create_arch(), object_create_clone(), object_decrease_nrof(), object_free_drop_inventory(), object_insert_in_map_at(), object_remove(), object_unset_flag_inv(), obj::other_arch, mapdef::path, PLAYER, QUERY_FLAG, rndm(), SET_FLAG, settings, shop_contains(), obj::type, obj::value, obj::x, and obj::y.

Referenced by converter_type_move_on().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static method_ret converter_type_move_on ( ob_methods context,
object trap,
object victim,
object originator 

Move on this Converter object.

contextThe method context
trapThe Converter we're moving on
victimThe object moving over this one
originatorThe object that caused the move_on event

Definition at line 156 of file converter.c.

References common_post_ob_move_on(), common_pre_ob_move_on(), convert_item(), create_archetype(), draw_ext_info_format(), obj::map, MAX_BUF, METHOD_ERROR, METHOD_OK, MSG_TYPE_APPLY, MSG_TYPE_APPLY_FAILURE, treasureliststruct::name, NDI_UNIQUE, object_insert_in_map_at(), query_name(), obj::x, and obj::y.

Referenced by init_type_converter().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void init_type_converter ( void  )

Initializer for the CONVERTER object type.

Definition at line 44 of file converter.c.

References CONVERTER, converter_type_move_on(), and register_move_on().

Referenced by register_all_ob_types().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: