Go to the documentation of this file.
34 #define CONV_FROM(xyz) xyz->slaying
35 #define CONV_TO(xyz) xyz->other_arch
36 #define CONV_NR(xyz) (unsigned char)xyz->stats.sp
37 #define CONV_LIMIT(xyz) ((xyz->stats.wc > 0) ? ((unsigned long)xyz->stats.wc) : INT32_MAX)
38 #define CONV_NEED(xyz) (unsigned long)xyz->stats.food
39 #define CONV_FROM_MATCH(xyz,_match) (CONV_FROM(xyz) == (_match) || ((strchr(CONV_FROM(xyz),'*')) && wildcard_match(CONV_FROM(xyz),(_match))))
53 if (
string[0]==
'*' &&
string[1]==0 )
return 1;
54 if (
string[0] ==
'*' ) head=
TRUE;
55 if (
string[strlen(
string)-1] ==
'*' ) tail=
TRUE;
56 str=strdup(&
string[head?1:0]);
58 if ( tail )
str[strlen(
str)-1]=0;
62 m=strstr(
str,candidate);
65 if ( strncmp(
str,candidate,strlen(
str)) == 0 ) ret=
TRUE;
67 if ( strlen(candidate) >= strlen(
str) &&
68 strcmp(&candidate[strlen(candidate)-strlen(
str)],
str) == 0 ) ret=
TRUE;
104 int32_t max_conv = weight_diff > 0 && weight_rem > 0 ? weight_rem / weight_diff : -1;
117 if (!strcmp(
CONV_FROM(converter),
"money")) {
159 nr =
MIN(nr, max_conv);
163 price_in =
item->value;
169 if (converter->
inv != NULL) {
174 ob_to_copy = converter->
inv;
186 LOG(
llevError,
"move_creator: Converter doesn't have other arch set: %s (%s, %d, %d)\n", converter->
name ? converter->
name :
"(null)", converter->
map->
path, converter->
x, converter->
y);
201 LOG(
llevError,
"Broken converter %s at %s (%d, %d) in value %d, out value %d for %s\n", converter->
name, converter->
map->
path, converter->
x, converter->
y, price_in,
item->nrof*
item->value,
item->name);
244 "The %s seems to be broken!",
name);
268 if (conv_src != NULL) {
273 if (conv_res != NULL) {
void LOG(LogLevel logLevel, const char *format,...)
int allow_broken_converters
#define QUERY_FLAG(xyz, p)
void register_apply(int ob_type, apply_func method)
#define FOR_BELOW_PREPARE(op_, it_)
void register_move_on(int ob_type, move_on_func method)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
void fix_generated_item(object *op, object *creator, int difficulty, int max_magic, int flags)
void fix_object(object *op)
static method_ret converter_type_move_on(object *trap, object *victim, object *originator)
int rndm(int min, int max)
object * object_insert_in_ob(object *op, object *where)
#define FOR_BELOW_FINISH()
#define FLAG_IS_A_TEMPLATE
static event_registration m
void object_free_drop_inventory(object *ob)
void query_name(const object *op, char *buf, size_t size)
method_ret common_pre_ob_move_on(object *trap, object *victim, object *originator)
#define CONV_FROM_MATCH(xyz, _match)
object * object_create_arch(archetype *at)
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
struct archetype * other_arch
object * object_create_clone(object *asrc)
static object * do_item_conversion(object *converter, object *item, int weight_rem, int *status)
object * create_archetype(const char *name)
uint32_t get_weight_limit(int stat)
object * object_decrease_nrof(object *op, uint32_t i)
object * object_find_by_arch_name(const object *who, const char *name)
void object_unset_flag_inv(object *op, int flag)
#define CLEAR_FLAG(xyz, p)
#define MSG_TYPE_APPLY_FAILURE
static int wildcard_match(const char *string, const char *candidate)
void object_remove(object *op)
void init_type_converter(void)
static int convert_item(object *item, object *converter)
bool shop_contains(object *ob)
void common_post_ob_move_on(object *trap, object *victim, object *originator)
static method_ret converter_type_apply(object *converter, object *applier, int aflags)