Crossfire Server  1.75.0
libproto.h
Go to the documentation of this file.
1 #include "bufferreader.h"
2 /* anim.cpp */
3 extern Animations *find_animation(const char *name);
4 extern Animations *try_find_animation(const char *name);
5 extern void animate_object(object *op, int dir);
6 extern void apply_anim_suffix(object *who, const char *suffix);
7 extern void dump_animations(void);
8 extern void animation_load_block(FILE *file, const char *full_path, const char *animation_name);
9 /* arch.cpp */
10 archetype *find_archetype_by_object_name(const char *name);
11 archetype *find_archetype_by_object_type_name(int type, const char *name);
12 archetype *get_archetype_by_skill_name(const char *skill, int type);
13 archetype *get_archetype_by_type_subtype(int type, int subtype);
14 object *create_archetype_by_object_name(const char *name);
15 void dump_arch(archetype *at, StringBuffer *sb);
16 void dump_all_archetypes(void);
17 void free_arch(archetype *at);
19 object *arch_to_object(archetype *at);
20 object *create_singularity(const char *name);
21 object *create_archetype(const char *name);
22 archetype *try_find_archetype(const char *name);
23 archetype *find_archetype(const char *name);
24 object *object_create_arch(archetype *at);
26 void first_arch_pass(FILE *fp, const char *filename);
27 /* arch_types_valid.cpp */
28 extern int is_type_valid(uint8_t type);
29 /* artifact.cpp */
31 extern artifact *get_empty_artifact(void);
32 extern void free_all_artifacts(void);
33 extern void generate_artifact(object *op, int difficulty);
34 extern void artifact_compute_chance_for_item(const object *op, const artifact *art, int *numerator, int *denominator);
35 extern void give_artifact_abilities(object *op, const object *artifact);
36 extern int legal_artifact_combination(const object *op, const artifact *art);
37 extern void add_abilities(object *op, const object *change);
38 extern artifactlist *find_artifactlist(int type);
39 extern const artifact *find_artifact(const object *op, const char *name);
40 extern void dump_artifacts(void);
41 extern uint16_t artifact_get_face(const artifact *art);
42 /* button.cpp */
43 extern void trigger_connected(objectlink *ol, object *cause, const int state);
44 extern void push_button(object *op);
45 extern void update_button(object *op);
46 extern void update_buttons(mapstruct *m);
47 extern void use_trigger(object *op);
48 extern void animate_turning(object *op);
49 extern int check_altar_sacrifice(const object *altar, const object *sacrifice, int remove_others, int *toremove);
50 extern int operate_altar(object *altar, object **sacrifice);
51 extern int check_trigger(object *op, object *cause);
52 extern void add_button_link(object *button, mapstruct *map, int connected);
53 extern void remove_button_link(object *op);
54 extern int get_button_value(const object *button);
55 extern object *check_inv_recursive(object *op, const object *trig);
56 extern void check_inv(object *op, object *trig);
57 /* dialog.cpp */
58 extern void free_dialog_information(object *op);
59 extern int get_dialog_message(object *op, const char *text, struct_dialog_message **message, struct_dialog_reply **reply);
60 /* exp.cpp */
61 extern int64_t new_exp(const object *ob);
62 extern int has_ability(const object *ob);
63 extern void init_experience(void);
64 extern void dump_experience(void);
65 extern void free_experience(void);
66 /* friend.cpp */
67 extern void add_friendly_object(object *op);
68 extern void remove_friendly_object(object *op);
69 extern void dump_friendly_objects(void);
70 extern void clean_friendly_list(void);
71 extern int is_friendly(const object *op);
72 extern objectlink *get_friends_of(const object *owner);
73 extern void clear_friendly_list(void);
74 extern object *get_next_friend(object *current);
75 /* glue.cpp */
76 extern void fatal(enum fatal_error err) __attribute__ ((noreturn));
77 /* holy.cpp */
78 extern void init_gods(void);
79 extern const object *get_rand_god(void);
80 extern int describe_god(const object *god, int what, StringBuffer *buf, size_t maxlen);
81 extern void free_all_god(void);
82 extern void dump_gods(void);
83 extern const object *find_god(const char *name);
84 extern const char *get_god_for_race(const char *race);
85 /* info.cpp */
86 extern void dump_abilities(void);
87 extern void print_monsters(void);
88 /* image.cpp */
89 extern int find_smooth(const Face *face, const Face **smoothed);
90 extern int is_valid_faceset(int fsn);
91 extern int get_face_fallback(int faceset, uint16_t imageno);
92 extern size_t get_faces_count(void);
93 extern const Face *get_face_by_id(uint16_t id);
94 extern int load_face_file(FILE *file, const char *full_path);
95 extern int load_png_file(FILE *file, const char *full_path);
96 extern void load_image_info(FILE *file, const char *filename);
97 extern const Face *find_face(const char *name);
98 extern const Face *try_find_face(const char *name, const Face *error);
99 extern uint8_t find_color(const char *name);
100 extern const char *get_colorname(uint8_t index);
101 extern void dump_faces(void);
102 /* init.cpp */
103 extern void init_library(void);
104 extern void init_globals(void);
105 extern void free_globals(void);
106 extern void init_objects(void);
107 extern void write_todclock(void);
108 extern void init_attackmess(BufferReader *reader, const char *filename);
109 /* item.cpp */
110 extern int get_power_from_ench(int ench);
111 extern int calc_item_enhancement(const object *op);
112 extern int calc_item_power(const object *op);
113 extern const typedata *get_typedata(int itemtype);
114 extern const typedata *get_typedata_by_name(const char *name);
115 extern StringBuffer *describe_resistance(const object *op, int newline, int use_media_tags, StringBuffer *buf);
116 extern void query_weight(const object *op, char *buf, size_t size);
117 extern void get_levelnumber(int i, char *buf, size_t size);
118 extern void query_short_name(const object *op, char *buf, size_t size);
119 extern void query_name(const object *op, char *buf, size_t size);
120 extern void query_base_name(const object *op, int plural, char *buf, size_t size);
121 extern StringBuffer *describe_monster(const object *op, int use_media_tags, StringBuffer *buf);
122 extern StringBuffer *describe_item(const object *op, const object *owner, int use_media_tags, StringBuffer *buf);
123 extern int is_magical(const object *op);
124 extern int is_identifiable_type(const object *op);
125 extern int is_identified(const object *op);
126 extern void object_give_identified_properties(object *op);
127 extern object *identify(object *op);
135 extern uint64_t price_base(const object *obj);
136 /* languages.cpp */
137 extern const char *i18n(const object *who, const char *code);
138 extern language_t i18n_find_language_by_code(const char *code);
139 extern language_t i18n_get_language_by_code(const char *code);
140 extern sstring i18n_get_language_code(language_t language);
141 extern void i18n_list_languages(object *who);
142 extern void i18n_init(void);
143 extern void i18n_free(void);
144 /* links.cpp */
145 extern objectlink *get_objectlink(void);
146 extern oblinkpt *get_objectlinkpt(void);
147 extern void free_objectlink(objectlink *ol);
148 extern void free_objectlinkpt(oblinkpt *obp);
149 /* living.cpp */
150 extern void set_attr_value(living *stats, int attr, int8_t value);
151 extern void change_attr_value(living *stats, int attr, int8_t value);
152 extern int8_t get_attr_value(const living *stats, int attr);
153 extern void check_stat_bounds(living *stats, int8_t min_stat, int8_t max_stat);
154 extern int change_abil(object *op, object *tmp);
155 extern void drain_stat(object *op);
156 extern void drain_specific_stat(object *op, int deplete_stats);
157 extern int remove_depletion(object *op, int level);
158 extern void change_luck(object *op, int value);
159 extern void remove_statbonus(object *op);
160 extern void add_statbonus(object *op);
161 extern void fix_object(object *op);
162 extern int allowed_class(const object *op);
163 extern void set_dragon_name(object *pl, const object *abil, const object *skin);
164 extern object *give_skill_by_name(object *op, const char *skill_name);
165 extern void player_lvl_adj(object *who, object *op);
166 extern int64_t level_exp(int level, double expmul);
167 extern int exp_level(int64_t exp);
168 extern void calc_perm_exp(object *op);
169 extern int64_t check_exp_loss(const object *op, int64_t exp);
170 extern int64_t check_exp_adjust(const object *op, int64_t exp);
171 extern void change_exp(object *op, int64_t exp, const char *skill_name, int flag);
172 extern void apply_death_exp_penalty(object *op);
173 extern int did_make_save(const object *op, int level, int bonus);
174 extern void share_exp(object *op, int64_t exp, const char *skill, int flag);
175 extern int get_cha_bonus(int stat);
176 extern int get_dex_bonus(int stat);
177 extern int get_thaco_bonus(int stat);
178 extern uint32_t get_weight_limit(int stat);
179 extern int get_learn_spell(int stat);
180 extern int get_cleric_chance(int stat);
181 extern int get_turn_bonus(int stat);
182 extern int get_dam_bonus(int stat);
183 extern float get_speed_bonus(int stat);
184 extern int get_fear_bonus(int stat);
185 extern void init_stats();
186 extern void dump_stat_bonuses();
187 /* logger.cpp */
188 extern void LOG(LogLevel logLevel, const char *format, ...) PRINTF_ARGS(2, 3);
189 /* los.cpp */
190 extern void init_block(void);
191 extern void clear_los(player *pl);
192 extern int has_carried_lights(const object *op);
193 extern void update_los(object *op);
194 extern void update_all_map_los(mapstruct *map);
195 extern void update_all_los(const mapstruct *map, int x, int y);
196 extern void print_los(object *op);
197 extern void make_sure_seen(const object *op);
198 extern void make_sure_not_seen(const object *op);
199 /* map.cpp */
200 extern mapstruct *has_been_loaded(const char *name);
201 extern char *create_pathname(const char *name, char *buf, size_t size);
202 extern void create_overlay_pathname(const char *name, char *buf, size_t size);
203 extern void create_template_pathname(const char *name, char *buf, size_t size);
204 extern int check_path(const char *name, int prepend_dir);
205 extern void dump_map(const mapstruct *m);
206 extern void dump_all_maps(void);
207 extern int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny);
208 extern int blocked_link(object *ob, mapstruct *m, int16_t sx, int16_t sy);
209 extern int ob_blocked(const object *ob, mapstruct *m, int16_t x, int16_t y);
210 extern mapstruct *get_linked_map(void);
211 extern mapstruct *get_empty_map(int sizex, int sizey);
212 extern mapstruct *mapfile_load(const char *map, int flags);
213 extern int save_map(mapstruct *m, int flag);
214 extern void clean_object(object *op);
215 extern void free_map(mapstruct *m);
216 extern void delete_map(mapstruct *m);
217 extern mapstruct *ready_map_name(const char *name, int flags);
218 extern int calculate_difficulty(mapstruct *m);
219 extern void clean_tmp_map(mapstruct *m);
220 extern void free_all_maps(void);
221 extern int change_map_light(mapstruct *m, int change);
222 extern void update_position(mapstruct *m, int x, int y);
223 extern void set_map_reset_time(mapstruct *map);
224 extern int out_of_map(mapstruct *m, int x, int y);
225 extern mapstruct *get_map_from_coord(mapstruct *m, int16_t *x, int16_t *y);
226 extern int get_rangevector(object *op1, const object *op2, rv_vector *retval, int flags);
227 extern int get_rangevector_from_mapcoord(const mapstruct *m, int x, int y, const object *op2, rv_vector *retval);
228 extern int on_same_map(const object *op1, const object *op2);
229 extern object *map_find_by_flag(mapstruct *map, int x, int y, int flag);
230 extern void map_remove_unique_files(const mapstruct *map);
231 extern const char *map_get_path(const object *item);
232 /* ob_methods.cpp */
233 extern method_ret ob_apply(object *op, object *applier, int aflags);
234 extern method_ret ob_process(object *op);
235 extern char *ob_describe(const object *op, const object *observer, int use_media_tags, char *buf, size_t size);
236 extern method_ret ob_examine(const object *op, const object *observer, int use_media_tags, char *buf, size_t size);
237 extern method_ret ob_move_on(object *op, object *victim, object *originator);
238 extern method_ret ob_trigger(object *op, object *cause, int state);
239 /* ob_types.cpp */
240 extern void init_ob_method_struct(ob_methods *methods, ob_methods *fallback);
241 extern void init_ob_types(ob_methods *base_type);
242 extern void register_apply(int ob_type, apply_func method);
243 extern void register_process(int ob_type, process_func method);
244 extern void register_describe(int ob_type, describe_func method);
245 extern void register_examine(int ob_type, examine_func method);
246 extern void register_move_on(int ob_type, move_on_func method);
247 extern void register_trigger(int ob_type, trigger_func method);
248 /* object.cpp */
249 extern int object_can_merge(object *ob1, object *ob2);
250 extern signed long object_sum_weight(object *op);
251 extern object *object_get_env_recursive(object *op);
252 extern object *object_get_player_container(object *op);
253 extern void object_dump(const object *op, StringBuffer *sb);
254 extern void object_dump_all(void);
255 extern object *object_find_by_tag_global(tag_t i);
256 extern object *object_find_by_name_global(const char *str);
257 extern void object_free_all_data(void);
258 extern object *object_get_owner(object *op);
259 extern void object_clear_owner(object *op);
260 extern void object_set_owner(object *op, object *owner);
261 extern void object_copy_owner(object *op, object *clone);
262 extern void object_set_enemy(object *op, object *enemy);
263 extern void object_reset(object *op);
264 extern void object_free_key_values(object *op);
265 extern void object_clear(object *op);
266 extern void object_copy_no_speed(const object *src_ob, object *dest_ob);
267 extern void object_copy(const object *src_ob, object *dest_ob);
268 extern void object_copy_with_inv(const object *src_ob, object *dest_ob, bool update_speed);
269 extern object *object_new(void);
270 extern void object_update_turn_face(object *op);
271 extern void object_update_speed(object *op);
272 extern void object_remove_from_active_list(object *op);
273 extern void object_update(object *op, int action);
274 extern void object_free_drop_inventory(object *ob);
275 extern void object_free_inventory(object *ob);
276 extern void object_free(object *ob, int flags);
277 extern int object_count_free(void);
278 extern int object_count_used(void);
279 extern int object_count_active(void);
280 extern void object_sub_weight(object *op, signed long weight);
281 extern void object_remove(object *op);
282 extern object *object_merge(object *op, object *top);
283 extern object *object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y);
284 extern void object_merge_spell(object *op, int16_t x, int16_t y);
285 extern object *object_insert_in_map(object *op, mapstruct *m, object *originator, int flag);
286 extern void object_replace_insert_in_map(const char *arch_string, object *op);
287 extern object *object_split(object *orig_ob, uint32_t nr, char *err, size_t size);
288 extern object *object_decrease_nrof(object *op, uint32_t i);
289 extern void object_add_weight(object *op, signed long weight);
290 extern object *object_insert_in_ob(object *op, object *where);
291 extern int object_check_move_on(object *op, object *originator);
292 extern object *map_find_by_archetype(mapstruct *m, int x, int y, const archetype *at);
293 extern object *map_find_by_type(mapstruct *m, int x, int y, uint8_t type);
294 extern object *object_present_in_ob(uint8_t type, const object *op);
295 extern object *object_present_in_ob_by_name(int type, const char *str, const object *op);
296 extern object *arch_present_in_ob(const archetype *at, const object *op);
297 extern void object_set_flag_inv(object *op, int flag);
298 extern void object_unset_flag_inv(object *op, int flag);
299 extern void object_set_cheat(object *op);
300 extern int object_find_multi_free_spot_around(const object *ob, const object *gen, int16_t *hx, int16_t *hy);
301 extern int object_find_multi_free_spot_within_radius(const object *ob, const object *gen, int *hx, int *hy);
302 extern int object_find_free_spot(const object *ob, mapstruct *m, int x, int y, int start, int stop);
303 extern int object_find_first_free_spot(const object *ob, mapstruct *m, int x, int y);
304 extern void get_search_arr(int *search_arr);
305 extern int object_distance(const object *ob1, const object *ob2);
306 extern int find_dir_2(int x, int y);
307 extern int absdir(int d);
308 extern int dirdiff(int dir1, int dir2);
309 extern int can_see_monsterP(mapstruct *m, int x, int y, int dir);
310 extern int object_can_pick(const object *who, const object *item);
311 extern object *object_create_clone(object *asrc);
312 extern object *object_find_by_name(const object *who, const char *name);
313 extern object *object_find_by_type(const object *who, int type);
314 extern object *object_find_by_type_without_flags(const object *who, int type, int *flags, int num_flags);
315 extern object *object_find_by_type2(const object *who, int type1, int type2);
316 extern object *object_find_by_tag(const object *who, tag_t tag);
317 extern object *object_find_by_type_applied(const object *who, int type);
318 extern object *object_find_by_type_and_name(const object *who, int type, const char *name);
319 extern object *object_find_by_type_and_race(const object *who, int type, const char *race);
320 extern object *object_find_by_type_and_slaying(const object *who, int type, const char *slaying);
321 extern object *object_find_by_type_and_skill(const object *who, int type, const char *skill);
322 extern object *object_find_by_flag(const object *who, int flag);
323 extern object *object_find_by_flag_applied(const object *who, int flag);
324 extern object *object_find_by_arch_name(const object *who, const char *name);
325 extern object *object_find_by_type_and_arch_name(const object *who, int type, const char *name);
326 extern object *object_find_by_type_subtype(const object *who, int type, int subtype);
327 extern key_value *object_get_key_value(const object *ob, const char *key);
328 extern sstring object_get_value(const object *op, const char *const key);
329 extern bool object_value_set(const object *op, const char *const key);
330 extern bool object_value_set_shared(const object *op, sstring key);
331 extern int object_set_value(object *op, const char *key, const char *value, int add_key);
332 extern int object_matches_string(object *pl, object *op, const char *name);
333 extern void object_fix_multipart(object *tmp);
334 extern void object_get_multi_size(const object *ob, int *sx, int *sy, int *hx, int *hy);
335 extern void object_insert_to_free_spot_or_free(object *op, mapstruct *map, int x, int y, int start, int stop, object *originator);
336 extern void object_set_msg(object *op, const char *msg);
337 extern void get_ob_diff(StringBuffer *sb, const object *op, const object *op2);
338 extern int save_object(FILE *fp, object *op, int flag);
339 extern void save_object_in_sb(StringBuffer *sb, object *op, const int flag);
340 extern void object_handle_death_animation(object *op);
341 extern int object_matches_pickup_mode(const object *item, int mode);
342 /* path.cpp */
343 extern char *path_combine(const char *src, const char *dst, char *path, size_t size);
344 extern void path_normalize(char *path);
345 extern char *path_combine_and_normalize(const char *src, const char *dst, char *path, size_t size);
346 /* porting.cpp */
347 extern FILE *tempnam_secure(const char *dir, const char *pfx, char **filename);
348 extern void remove_directory(const char *path);
349 extern int ihypot(int a, int b);
350 extern int isqrt(int n);
351 extern void make_path_to_file(const char *filename);
352 /* player.cpp */
353 extern void clear_player(player *pl);
354 extern void free_player(player *pl);
355 extern int atnr_is_dragon_enabled(int attacknr);
356 extern int is_dragon_pl(const object *op);
357 extern client_spell *get_client_spell_state(player *pl, object *spell);
358 extern int is_wraith_pl(object *op);
359 extern int is_old_wraith_pl(object *op);
360 extern void player_set_dragon_title(struct player *pl, int level, const char *attack, int skin_resist);
361 extern void player_get_title(const struct player *pl, char *buf, size_t bufsize);
362 extern int player_has_own_title(const struct player *pl);
363 extern const char *player_get_own_title(const struct player *pl);
364 extern void player_set_own_title(struct player *pl, const char *title);
365 extern void link_player_skills(object *op);
366 /* re-cmp.cpp */
367 extern const char *re_cmp(const char *str, const char *regexp);
368 /* readable.cpp */
369 extern int nstrtok(const char *buf1, const char *buf2);
370 extern char *strtoktolin(const char *buf1, const char *buf2, char *retbuf, size_t size);
371 extern int book_overflow(const char *buf1, const char *buf2, size_t booksize);
372 extern void init_readable(void);
373 extern object *get_random_mon(int level);
374 extern void tailor_readable_ob(object *book, int msg_type);
375 extern void free_all_readable(void);
376 extern void write_book_archive(void);
377 extern const readable_message_type *get_readable_message_type(object *readable);
378 extern const GeneralMessage *get_message_from_identifier(const char *identifier);
379 extern sstring get_message_title(const GeneralMessage *message);
380 extern sstring get_message_body(const GeneralMessage *message);
381 extern const Face *get_message_face(const GeneralMessage *message);
382 extern void init_msgfile(FILE *file, const char *filename);
383 extern void formula_knowledge_code(const recipe *r, char *buf, size_t len);
384 /* recipe.cpp */
385 extern recipelist *get_formulalist(int i);
386 extern void init_formulae(BufferReader *reader, const char *filename);
387 extern void dump_alchemy(void);
388 extern archetype *find_treasure_by_name(const treasure *t, const char *name, int depth);
389 extern void dump_alchemy_costs(void);
390 extern int strtoint(const char *buf);
391 extern const artifact *locate_recipe_artifact(const recipe *rp, size_t idx);
392 extern recipe *get_random_recipe(recipelist *rpl);
393 extern void free_all_recipes(void);
394 extern recipe *find_recipe_for_tool(const char *tool, recipe *from);
395 extern bool check_formulae(void);
396 extern const Face *recipe_get_face(const recipe *rp);
397 extern bool check_recipes();
398 extern const char *recipe_get_difficulty_string(int difficulty);
399 /* region.cpp */
400 extern region *get_region_by_name(const char *region_name);
402 extern const char *get_name_of_region_for_map(const mapstruct *m);
403 extern region *get_region_from_string(const char *name);
404 extern int region_is_child_of_region(const region *child, const region *r);
405 extern const char *get_region_longname(const region *r);
406 extern const char *get_region_msg(const region *r);
407 extern object *get_jail_exit(object *op);
408 extern void init_regions(BufferReader *reader, const char *filename);
409 extern region *get_region_struct(void);
410 /* stringbuffer.cpp */
411 extern StringBuffer *stringbuffer_new(void);
412 extern void stringbuffer_delete(StringBuffer *sb);
413 extern char *stringbuffer_finish(StringBuffer *sb);
415 extern void stringbuffer_append_string(StringBuffer *sb, const char *str);
416 extern void stringbuffer_append_printf(StringBuffer *sb, const char *format, ...);
417 extern void stringbuffer_append_stringbuffer(StringBuffer *sb, const StringBuffer *sb2);
418 extern void stringbuffer_append_multiline_block(StringBuffer *sb, const char *start, const char *content, const char *end);
419 extern size_t stringbuffer_length(StringBuffer *sb);
420 /* time.cpp */
421 extern const char *get_periodofday(const int index);
422 extern const char *get_month_name(const int index);
423 extern const char *get_weekday(const int index);
424 extern const char *get_season_name(const int index);
425 extern void reset_sleep(void);
426 extern long usec_elapsed(struct timespec first, struct timespec second);
427 extern void tick_game_time(void);
428 extern long get_sleep_remaining(void);
429 extern void jump_time(void);
430 extern void set_tick_duration(long t);
431 extern void get_tod(timeofday_t *tod);
432 extern void time_info(object *op);
433 extern long seconds(void);
434 extern const char *time_format_time(const timeofday_t *tod, char *buf, size_t bufsize);
435 extern long timespec_diff(struct timespec *end, struct timespec *start);
436 extern unsigned int tick_length(float seconds);
437 extern float ticks_to_seconds(int ticks);
438 /* treasure.cpp */
439 extern void init_archetype_pointers(void);
440 extern void load_treasures(void);
441 extern treasurelist *find_treasurelist(const char *name);
442 extern void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries);
443 extern object *generate_treasure(treasurelist *t, int difficulty);
444 extern void set_abs_magic(object *op, int magic);
445 extern void fix_generated_item(object *op, object *creator, int difficulty, int max_magic, int flags);
446 extern void dump_monster_treasure(const char *name);
447 extern treasure *get_empty_treasure();
448 extern void treasure_free(treasure *t);
449 extern treasure *treasure_insert(treasurelist *list, int position);
450 extern void treasure_remove_item(treasurelist *list, int position);
451 /* utils.cpp */
452 extern int random_roll(int min, int max, const object *op, int goodbad);
453 extern int64_t random_roll64(int64_t min, int64_t max, const object *op, int goodbad);
454 extern int die_roll(int num, int size, const object *op, int goodbad);
455 extern int rndm(int min, int max);
456 extern void decay_objects(mapstruct *m);
457 extern materialtype_t *name_to_material(const char *name);
458 extern void transmute_materialname(object *op, const object *change);
459 extern void set_materialname(object *op);
460 extern void strip_endline(char *buf);
461 extern void replace(const char *src, const char *key, const char *replacement, char *result, size_t resultsize);
462 extern void make_list_like(char *input);
463 extern int get_random_dir(void);
464 extern int get_randomized_dir(int dir);
465 extern int adjust_dir(int dir, int destination_dir);
466 extern void replace_unprintable_chars(char *buf);
467 extern size_t split_string(char *str, char *array[], size_t array_size, char sep);
468 extern StringBuffer *describe_spellpath_attenuation(const char *attenuation, int value, StringBuffer *buf);
469 extern StringBuffer *describe_attacktype(const char *attack, int value, StringBuffer *buf);
470 extern void free_charlinks(linked_char *lc);
471 /* loader.cpp */
472 extern void yyrestart(FILE *input_file);
473 extern void yypop_buffer_state(void);
474 extern int yyget_lineno(void);
475 extern FILE *yyget_in(void);
476 extern FILE *yyget_out(void);
477 extern char *yyget_text(void);
478 extern void yyset_lineno(int line_number);
479 extern void yyset_in(FILE *in_str);
480 extern void yyset_out(FILE *out_str);
481 extern int yyget_debug(void);
482 extern void yyset_debug(int bdebug);
483 extern int yylex_destroy(void);
484 extern void yyfree(void *ptr);
485 extern int load_object(FILE *fp, object *op, int bufstate, int map_flags, bool artifact_init);
486 extern int load_object_from_reader(BufferReader *reader, object *op, int map_flags, bool arch_init, bool artifact_init);
487 extern int set_variable(object *op, const char *buf);
488 extern void free_loader(void);
char * ob_describe(const object *op, const object *observer, int use_media_tags, char *buf, size_t size)
Returns the description (short item name) of an object, as seen by the given observer.
Definition: ob_methods.cpp:92
void init_objects(void)
Sets up and initialises the linked list of free and used objects.
Definition: object.cpp:327
void object_set_owner(object *op, object *owner)
Sets the owner and sets the skill and exp pointers to owner's current skill and experience objects...
Definition: object.cpp:825
void object_reset(object *op)
Totally resets the specified object, without freeing associated memory.
Definition: object.cpp:919
int object_count_free(void)
Objects statistics.
Definition: object.cpp:1736
method_ret(* apply_func)(object *, object *, int)
Typedefs for ob_methods.
Definition: ob_methods.h:30
object * create_archetype_by_object_name(const char *name)
Creates an object given the name that appears during the game (for example, "writing pen" instead of ...
Definition: arch.cpp:114
int yyget_debug(void)
void dump_map(const mapstruct *m)
Prints out debug-information about a map.
Definition: map.cpp:245
void free_all_recipes(void)
Frees all memory allocated to recipes and recipes lists.
Definition: recipe.cpp:814
mapstruct * ready_map_name(const char *name, int flags)
Makes sure the given map is loaded and swapped in.
Definition: map.cpp:1777
object * object_find_by_tag_global(tag_t i)
Returns the object which has the count-variable equal to the argument.
Definition: object.cpp:712
archetype * find_archetype_by_object_name(const char *name)
This function retrieves an archetype given the name that appears during the game (for example...
Definition: arch.cpp:51
char * yyget_text(void)
char * path_combine_and_normalize(const char *src, const char *dst, char *path, size_t size)
Combines the 2 paths.
Definition: path.cpp:172
int is_type_valid(uint8_t type)
oblinkpt * get_objectlinkpt(void)
Allocates a new oblinkpt structure, initialises it, and returns a pointer to it.
Definition: links.cpp:51
int check_altar_sacrifice(const object *altar, const object *sacrifice, int remove_others, int *toremove)
Checks whether the altar has enough to sacrifice.
Definition: button.cpp:347
method_ret ob_examine(const object *op, const object *observer, int use_media_tags, char *buf, size_t size)
Get examine text for OP as seen by OBSERVER.
Definition: ob_methods.cpp:113
int on_same_map(const object *op1, const object *op2)
Checks whether 2 objects are on the same map or not.
Definition: map.cpp:2628
void make_sure_not_seen(const object *op)
The object which is supposed to be visible through walls has just been removed from the map...
Definition: los.cpp:718
Implements a buffer reader.
int object_matches_string(object *pl, object *op, const char *name)
This is a subset of the parse_id command.
Definition: object.cpp:4559
This is used by get_rangevector to determine where the other creature is.
Definition: map.h:375
int object_find_multi_free_spot_around(const object *ob, const object *gen, int16_t *hx, int16_t *hy)
Sets hx and hy to the coords to insert a possibly multi-tile ob at, around gen.
Definition: object.cpp:3281
This represents one animation.
Definition: face.h:25
void dump_faces(void)
Dump all faces to stderr, for debugging purposes.
Definition: image.cpp:159
void free_map(mapstruct *m)
Frees everything allocated by the given mapstructure.
Definition: map.cpp:1659
void void init_block(void)
initialises the array used by the LOS routines.
Definition: los.cpp:106
void object_merge_spell(object *op, int16_t x, int16_t y)
This sees if there are any objects on the space that can merge with op.
Definition: object.cpp:2114
void tick_game_time(void)
Definition: time.cpp:184
void object_copy_owner(object *op, object *clone)
Set the owner to clone's current owner and set the skill and experience objects to clone's objects (t...
Definition: object.cpp:878
void free_arch(archetype *at)
Frees archetype.
Definition: arch.cpp:167
void add_abilities(object *op, const object *change)
Apply artifact properties to an object.
Definition: artifact.cpp:320
sstring stringbuffer_finish_shared(StringBuffer *sb)
const char * get_month_name(const int index)
give access to month names
Definition: time.cpp:113
FILE * yyget_in(void)
const object * get_rand_god(void)
Returns a random god.
Definition: holy.cpp:73
object * map_find_by_archetype(mapstruct *m, int x, int y, const archetype *at)
Searches for any objects with a matching archetype at the given map and coordinates.
Definition: object.cpp:3103
void replace_unprintable_chars(char *buf)
Replaces any unprintable character in the given buffer with a space.
Definition: utils.cpp:447
StringBuffer * describe_resistance(const object *op, int newline, int use_media_tags, StringBuffer *buf)
Generates the visible naming for resistances.
Definition: item.cpp:377
object * object_find_by_type_and_skill(const object *who, int type, const char *skill)
Find object in inventory by type and skill.
Definition: object.cpp:4168
sstring object_get_value(const object *op, const char *const key)
Get an extra value by key.
Definition: object.cpp:4331
This struct stores function pointers for actions that can be done to objects.
Definition: ob_methods.h:44
int adjust_dir(int dir, int destination_dir)
Adjusts a given direction by +/-1 towards a destination direction.
Definition: utils.cpp:426
void register_apply(int ob_type, apply_func method)
Registers the apply method for the given type.
Definition: ob_types.cpp:62
int load_object(FILE *fp, object *op, int bufstate, int map_flags, bool artifact_init)
int is_old_wraith_pl(object *op)
Checks if player is a wraith without the 'wraith feed' skill.
Definition: player.cpp:186
objectlink * get_objectlink(void)
Allocates a new objectlink structure, initialises it, and returns a pointer to it.
Definition: links.cpp:33
void dump_abilities(void)
Dump to standard out the abilities of all monsters.
Definition: info.cpp:52
void decay_objects(mapstruct *m)
Decay and destroy persihable items in a map.
Definition: utils.cpp:175
void print_los(object *op)
Debug-routine which dumps the array which specifies the visible area of a player. ...
Definition: los.cpp:665
int get_dex_bonus(int stat)
Definition: living.cpp:2365
int random_roll(int min, int max, const object *op, int goodbad)
Roll a random number between min and max.
Definition: utils.cpp:42
void update_all_map_los(mapstruct *map)
update all_map_los is like update_all_los() below, but updates everyone on the map, no matter where they are.
Definition: los.cpp:567
void dump_experience(void)
Dump the experience table, then calls exit() - useful in terms of debugging to make sure the format o...
Definition: exp.cpp:251
void * language_t
Strings that should be manipulated through add_string() and free_string().
Definition: global.h:69
int load_face_file(FILE *file, const char *full_path)
void dump_all_archetypes(void)
Dumps all archetypes to debug-level output.
Definition: arch.cpp:148
artifact * get_empty_artifact(void)
Allocate and return the pointer to an empty artifact structure.
Definition: artifact.cpp:55
object * object_find_by_type_subtype(const object *who, int type, int subtype)
Find object in inventory.
Definition: object.cpp:4286
int describe_god(const object *god, int what, StringBuffer *buf, size_t maxlen)
Describe a god.
Definition: holy.cpp:109
int change_abil(object *op, object *tmp)
Permanently alters an object's stats/flags based on another object.
Definition: living.cpp:394
void object_insert_to_free_spot_or_free(object *op, mapstruct *map, int x, int y, int start, int stop, object *originator)
Inserts an object into its map.
Definition: object.cpp:4776
int exp_level(int64_t exp)
Returns the level for a given exp.
Definition: living.cpp:1897
region * get_region_by_map(mapstruct *m)
Gets a region from a map.
Definition: region.cpp:71
size_t booksize
Definition: readable.cpp:1562
void object_replace_insert_in_map(const char *arch_string, object *op)
This function inserts an object of a specified archetype in the map, but if it finds objects of its o...
Definition: object.cpp:2582
void clean_friendly_list(void)
It traverses the friendly list removing objects that should not be here (ie, do not have friendly fla...
Definition: friend.cpp:80
int can_see_monsterP(mapstruct *m, int x, int y, int dir)
Recursive routine to see if we can find a path to a certain point.
Definition: object.cpp:3807
object * create_singularity(const char *name)
Creates a dummy object.
Definition: arch.cpp:253
void object_copy_no_speed(const object *src_ob, object *dest_ob)
Copy object first frees everything allocated by the second object, and then copies the contents of th...
Definition: object.cpp:1046
int ihypot(int a, int b)
Rough estimate of hypot(a, b).
Definition: utils.cpp:570
void object_dump(const object *op, StringBuffer *sb)
Dumps an object.
Definition: object.cpp:630
New face structure - this enforces the notion that data is face by face only - you can not change the...
Definition: face.h:14
void object_dump_all(void)
Dumps all objects to console.
Definition: object.cpp:689
int level
Definition: readable.cpp:1561
const Face * recipe_get_face(const recipe *rp)
Return the best face associated with a recipe.
Definition: recipe.cpp:923
unsigned int tick_length(float seconds)
Calculate the number of ticks that correspond to real time.
Definition: time.cpp:382
void change_luck(object *op, int value)
Alter the object's luck.
Definition: living.cpp:796
int get_power_from_ench(int ench)
Definition: item.cpp:213
void map_remove_unique_files(const mapstruct *map)
Remove files containing the map's unique items.
Definition: map.cpp:2668
uint16_t artifact_get_face(const artifact *art)
Get a suitable face number for representing an artifact.
Definition: artifact.cpp:634
void init_gods(void)
This takes a look at all of the archetypes to find the objects which correspond to the GODS (type GOD...
Definition: holy.cpp:59
void stringbuffer_append_stringbuffer(StringBuffer *sb, const StringBuffer *sb2)
archetype * find_archetype(const char *name)
Definition: assets.cpp:270
void delete_map(mapstruct *m)
Frees the map, including the mapstruct.
Definition: map.cpp:1705
void yypop_buffer_state(void)
int calc_item_enhancement(const object *op)
Definition: item.cpp:226
method_ret(* trigger_func)(object *, object *, int)
Definition: ob_methods.h:35
int get_thaco_bonus(int stat)
Definition: living.cpp:2369
Each object (this also means archetypes!) could have a few of these "dangling" from it; this could al...
Definition: object.h:42
void object_free(object *ob, int flags)
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
Definition: object.cpp:1577
void init_msgfile(FILE *file, const char *filename)
int load_object_from_reader(BufferReader *reader, object *op, int map_flags, bool arch_init, bool artifact_init)
void init_archetype_pointers(void)
Initialize global archtype pointers:
Definition: treasure.cpp:62
void player_set_own_title(struct player *pl, const char *title)
Sets the custom title.
Definition: player.cpp:273
void yyfree(void *ptr)
void yyset_out(FILE *out_str)
object * generate_treasure(treasurelist *t, int difficulty)
Generate a treasure from a list generating a single item.
Definition: treasure.cpp:319
void update_button(object *op)
Updates everything connected with the button op.
Definition: button.cpp:162
void use_trigger(object *op)
Toggles the state of specified button.
Definition: button.cpp:254
archetype * find_archetype_by_object_type_name(int type, const char *name)
This function retrieves an archetype by type and name that appears during the game.
Definition: arch.cpp:64
int object_set_value(object *op, const char *key, const char *value, int add_key)
Updates the key in op to value.
Definition: object.cpp:4484
int is_identifiable_type(const object *op)
Return true if this item's type is one that cares about whether or not it's been identified – e...
Definition: item.cpp:1333
int8_t get_attr_value(const living *stats, int attr)
Gets the value of a stat.
Definition: living.cpp:313
int yylex_destroy(void)
int operate_altar(object *altar, object **sacrifice)
Checks if sacrifice was accepted and removes sacrificed objects.
Definition: button.cpp:463
treasure * treasure_insert(treasurelist *list, int position)
Insert a new treasure in the treasure list, at a specific position in the children list...
Definition: treasure.cpp:1462
object * give_skill_by_name(object *op, const char *skill_name)
Given the skill name skill_name, we find the skill archetype/object, set appropriate values...
Definition: living.cpp:1788
void object_set_msg(object *op, const char *msg)
Set the message field of an object.
Definition: object.cpp:4796
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
Definition: object.cpp:2842
void query_short_name(const object *op, char *buf, size_t size)
query_short_name(object) is similar to query_name(), but doesn't contain any information about object...
Definition: item.cpp:518
void dump_gods(void)
Prints all gods to stderr.
Definition: holy.cpp:367
bool object_value_set(const object *op, const char *const key)
Determine if an extra value is set.
Definition: object.cpp:4361
Represents the ingame time.
Definition: tod.h:38
size_t split_string(char *str, char *array[], size_t array_size, char sep)
Splits a string delimited by passed in sep value into characters into an array of strings...
Definition: utils.cpp:473
int die_roll(int num, int size, const object *op, int goodbad)
Roll a number of dice (2d3, 4d6).
Definition: utils.cpp:122
int find_smooth(const Face *face, const Face **smoothed)
Find the smooth face for a given face.
Definition: image.cpp:102
region * get_region_by_name(const char *region_name)
Gets a region by name.
Definition: region.cpp:45
region * get_region_from_string(const char *name)
Tries to find a region that 'name' corresponds to.
Definition: region.cpp:116
This stores, for a spell a player knows, the last sp/gr/dam information sent to client.
Definition: player.h:87
void clear_los(player *pl)
Clears/initialises the los-array associated to the player controlling the object. ...
Definition: los.cpp:270
object * object_find_by_type_and_arch_name(const object *who, int type, const char *name)
Find object in inventory by type and archetype name.
Definition: object.cpp:4262
void dump_alchemy_costs(void)
Dumps to output all costs of recipes.
Definition: recipe.cpp:591
uint8_t find_color(const char *name)
Finds a color by name.
Definition: image.cpp:75
void dump_friendly_objects(void)
Dumps all friendly objects.
Definition: friend.cpp:70
void object_update_turn_face(object *op)
If an object with the IS_TURNABLE() flag needs to be turned due to the closest player being on the ot...
Definition: object.cpp:1317
const Face * try_find_face(const char *name, const Face *error)
Definition: assets.cpp:290
const typedata * get_typedata(int itemtype)
Definition: item.cpp:328
int object_find_multi_free_spot_within_radius(const object *ob, const object *gen, int *hx, int *hy)
Sets hx and hy to the coords to insert a possibly multi-tile ob at, within radius of generator...
Definition: object.cpp:3397
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
int object_can_pick(const object *who, const object *item)
Finds out if an object can be picked up.
Definition: object.cpp:3852
treasurelist * find_treasurelist(const char *name)
Search for the given treasurelist by name.
Definition: assets.cpp:253
archetype * get_next_archetype(archetype *current)
Definition: assets.cpp:266
region * get_region_struct(void)
Allocates and zeros a region struct, this isn't free()'d anywhere, so might be a memory leak...
Definition: region.cpp:293
int get_fear_bonus(int stat)
Definition: living.cpp:2397
void init_experience(void)
This loads the experience table from the exp_table file.
Definition: exp.cpp:167
Link an object type with skill needed to identify, and general name.
Definition: define.h:89
object * object_merge(object *op, object *top)
This function goes through all objects below and including top, and merges op to the first matching o...
Definition: object.cpp:2036
void generate_artifact(object *op, int difficulty)
Decides randomly which artifact the object should be turned into.
Definition: artifact.cpp:177
int object_find_free_spot(const object *ob, mapstruct *m, int x, int y, int start, int stop)
object_find_free_spot(object, map, x, y, start, stop) will search for a spot at the given map and coo...
Definition: object.cpp:3544
void player_get_title(const struct player *pl, char *buf, size_t bufsize)
method_ret(* process_func)(object *)
Definition: ob_methods.h:31
void free_objectlinkpt(oblinkpt *obp)
Recursively frees all linked list of objectlink pointers.
Definition: links.cpp:79
signed long object_sum_weight(object *op)
object_sum_weight() is a recursive function which calculates the weight an object is carrying...
Definition: object.cpp:553
int object_matches_pickup_mode(const object *item, int mode)
Checks if an item matches a specific pickup mode.
Definition: c_object.cpp:608
int get_dialog_message(object *op, const char *text, struct_dialog_message **message, struct_dialog_reply **reply)
Tries to find a message matching the said text.
Definition: dialog.cpp:233
void write_todclock(void)
Write out the current time to the file so time does not reset every time the server reboots...
Definition: init.cpp:510
#define PRINTF_ARGS(x, y)
Used for printf-like functions, mostly LOG and draw_ext_info_format.
Definition: global.h:46
int yyget_lineno(void)
mapstruct * mapfile_load(const char *map, int flags)
Opens the file "filename" and reads information about the map from the given file, and stores it in a newly allocated mapstruct.
Definition: map.cpp:1225
int get_cha_bonus(int stat)
Definition: living.cpp:2361
void load_treasures(void)
int64_t check_exp_loss(const object *op, int64_t exp)
This function checks to make sure that object 'op' can lose 'exp' experience.
Definition: living.cpp:2077
int find_dir_2(int x, int y)
Computes a direction which you should travel to move of x and y.
Definition: object.cpp:3662
Used to link together several object links.
Definition: object.h:469
void query_base_name(const object *op, int plural, char *buf, size_t size)
Query a short name for the item.
Definition: item.cpp:692
int is_identified(const object *op)
Return true if the item is identified, either because it is of a type that doesn't ever need identifi...
Definition: item.cpp:1357
object * object_find_by_type_and_slaying(const object *who, int type, const char *slaying)
Find object in inventory by type and slaying.
Definition: object.cpp:4143
void yyset_in(FILE *in_str)
int get_cleric_chance(int stat)
Definition: living.cpp:2381
void path_normalize(char *path)
Cleans specified path.
Definition: path.cpp:85
One reply a NPC can expect.
Definition: dialog.h:16
char * strtoktolin(const char *buf1, const char *buf2, char *retbuf, size_t size)
Takes a string in buf1 and separates it into a list of strings delimited by buf2. ...
Definition: readable.cpp:684
void object_remove_from_active_list(object *op)
This function removes object 'op' from the list of active objects.
Definition: object.cpp:1377
void fatal(enum fatal_error err) __attribute__((noreturn))
fatal() is meant to be called whenever a fatal signal is intercepted.
Definition: utils.cpp:590
int check_trigger(object *op, object *cause)
Definition: button.cpp:518
char method_ret
Define some standard return values for callbacks which don't need to return any other results...
Definition: ob_methods.h:14
void init_readable(void)
Initialize linked lists utilized by message functions in tailor_readable_ob()
Definition: readable.cpp:904
object * get_next_friend(object *current)
Get the next object on the friendly list.
Definition: friend.cpp:143
void object_fix_multipart(object *tmp)
Ensures specified object has its more parts correctly inserted in map.
Definition: object.cpp:4670
object * map_find_by_type(mapstruct *m, int x, int y, uint8_t type)
Searches for any objects with a matching type variable at the given map and coordinates.
Definition: object.cpp:3130
void push_button(object *op)
Push the specified object.
Definition: button.cpp:149
int set_variable(object *op, const char *buf)
bool check_formulae(void)
Check if formula don't have the same index.
Definition: recipe.cpp:292
One alchemy recipe.
Definition: recipe.h:10
int object_can_merge(object *ob1, object *ob2)
Examines the 2 objects given to it, and returns true if they can be merged together, including inventory.
Definition: object.cpp:433
FILE * yyget_out(void)
int absdir(int d)
Computes an absolute direction.
Definition: object.cpp:3699
void free_loader(void)
object * map_find_by_flag(mapstruct *map, int x, int y, int flag)
Finds an object in a map tile by flag number.
Definition: map.cpp:2651
StringBuffer * describe_spellpath_attenuation(const char *attenuation, int value, StringBuffer *buf)
Describe the specified path attenuation.
Definition: utils.cpp:507
objectlink * get_friends_of(const object *owner)
Get a list of friendly objects for the specified owner.
Definition: friend.cpp:117
void(* describe_func)(const object *, const object *, int use_media_tags, char *buf, size_t size)
Definition: ob_methods.h:32
sstring get_message_body(const GeneralMessage *message)
Get a message's body.
Definition: readable.cpp:2084
void artifact_compute_chance_for_item(const object *op, const artifact *art, int *numerator, int *denominator)
Compute the chance for a specified item to become the specified artifact.
Definition: artifact.cpp:133
void link_player_skills(object *op)
This function goes through the player inventory and sets up the last_skills[] array in the player obj...
Definition: player.cpp:288
void query_name(const object *op, char *buf, size_t size)
Describes an item.
Definition: item.cpp:594
void object_clear_owner(object *op)
Clears the owner of specified object.
Definition: object.cpp:808
void object_unset_flag_inv(object *op, int flag)
Desactivate recursively a flag on an object inventory.
Definition: object.cpp:3241
void object_add_weight(object *op, signed long weight)
object_add_weight(object, weight) adds the specified weight to an object, and also updates how much t...
Definition: object.cpp:2818
void i18n_free(void)
Clears all i18n-related data.
Definition: languages.cpp:210
int atnr_is_dragon_enabled(int attacknr)
Determine if the attacktype represented by the specified attack-number is enabled for dragon players...
Definition: player.cpp:104
size_t get_faces_count(void)
Definition: assets.cpp:297
object * arch_present_in_ob(const archetype *at, const object *op)
Searches for any objects with a matching archetype in the inventory of the given object.
Definition: object.cpp:3207
void free_dialog_information(object *op)
Frees obj::dialog_information.
Definition: dialog.cpp:34
long timespec_diff(struct timespec *end, struct timespec *start)
Return the difference between two timespec's in microseconds.
Definition: time.cpp:166
archetype * get_archetype_struct(void)
Allocates, initialises and returns the pointer to an archetype structure.
Definition: arch.cpp:193
const char * get_periodofday(const int index)
give access to weekday names
Definition: time.cpp:106
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
Definition: object.h:483
void create_template_pathname(const char *name, char *buf, size_t size)
same as create_pathname(), but for the template maps.
Definition: map.cpp:145
const char * get_weekday(const int index)
give access to weekday names
Definition: time.cpp:120
object * create_archetype(const char *name)
Finds which archetype matches the given name, and returns a new object containing a copy of the arche...
Definition: arch.cpp:276
void register_examine(int ob_type, examine_func method)
Registers the examine method for the given type.
Definition: ob_types.cpp:89
archetype * get_archetype_by_type_subtype(int type, int subtype)
Retrieves an archetype by type and subtype.
Definition: arch.cpp:97
object * object_present_in_ob(uint8_t type, const object *op)
Searches for any objects with a matching type variable in the inventory of the given object...
Definition: object.cpp:3153
void stringbuffer_append_multiline_block(StringBuffer *sb, const char *start, const char *content, const char *end)
sstring i18n_get_language_code(language_t language)
Return the code of a specified language.
Definition: languages.cpp:86
const char * destination_dir
Root destination dir.
int get_rangevector(object *op1, const object *op2, rv_vector *retval, int flags)
From map.c This is used by get_player to determine where the other creature is.
Definition: map.cpp:2522
void object_clear(object *op)
Frees everything allocated by an object, and also clears all variables and flags to default settings...
Definition: object.cpp:968
object * object_find_by_type_and_race(const object *who, int type, const char *race)
Find object in inventory by type and race.
Definition: object.cpp:4118
void free_experience(void)
Frees experience-related memory.
Definition: exp.cpp:263
int save_map(mapstruct *m, int flag)
Saves a map to file.
Definition: map.cpp:1404
void fix_generated_item(object *op, object *creator, int difficulty, int max_magic, int flags)
fix_generated_item(): This is called after an item is generated, in order to set it up right...
Definition: treasure.cpp:927
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
Definition: object.cpp:1545
Information on one title.
Definition: readable.cpp:108
int object_find_first_free_spot(const object *ob, mapstruct *m, int x, int y)
object_find_first_free_spot(archetype, mapstruct, x, y) works like object_find_free_spot(), but it will search max number of squares.
Definition: object.cpp:3584
StringBuffer * describe_monster(const object *op, int use_media_tags, StringBuffer *buf)
Describes a monster.
Definition: item.cpp:781
void remove_statbonus(object *op)
Subtracts stat-bonuses given by the class which the player has chosen.
Definition: living.cpp:845
void init_regions(BufferReader *reader, const char *filename)
Reads/parses the region file, and copies into a linked list of region structs.
Definition: region.cpp:310
void object_copy(const object *src_ob, object *dest_ob)
Copy object first frees everything allocated by the second object, and then copies the contents of th...
Definition: object.cpp:1177
void object_update_speed(object *op)
Updates the speed of an object.
Definition: object.cpp:1334
void change_exp(object *op, int64_t exp, const char *skill_name, int flag)
Changes experience to a player/monster.
Definition: living.cpp:2179
bool object_value_set_shared(const object *op, sstring key)
Determine if an extra value is set to a non empty or 0 value.
Definition: object.cpp:4375
client_spell * get_client_spell_state(player *pl, object *spell)
Gets the (client-side) spell state for specified spell.
Definition: player.cpp:145
uint32_t get_weight_limit(int stat)
Definition: living.cpp:2373
const char * get_region_msg(const region *r)
Gets a message for a region.
Definition: region.cpp:230
object * object_find_by_tag(const object *who, tag_t tag)
Find object in inventory.
Definition: object.cpp:4045
void clean_object(object *op)
Remove and free all objects in the inventory of the given object.
Definition: map.cpp:1596
const Face * get_message_face(const GeneralMessage *message)
Get a message's face.
Definition: readable.cpp:2093
void clear_friendly_list(void)
Totally clear the friendly list.
Definition: friend.cpp:134
materialtype_t * name_to_material(const char *name)
Convert materialname to materialtype_t.
Definition: utils.cpp:248
This is a game-map.
Definition: map.h:320
void update_los(object *op)
Recalculates the array which specifies what is visible for the given player-object.
Definition: los.cpp:509
void tailor_readable_ob(object *book, int msg_type)
The main routine.
Definition: readable.cpp:1899
void transmute_materialname(object *op, const object *change)
When doing transmutation of objects, we have to recheck the resistances, as some that did not apply p...
Definition: utils.cpp:263
List of recipes with a certain number of ingredients.
Definition: recipe.h:37
void free_globals(void)
Cleans all memory allocated for global variables.
Definition: init.cpp:431
int object_distance(const object *ob1, const object *ob2)
Return the square of the distance between the two given objects.
Definition: object.cpp:3646
void update_buttons(mapstruct *m)
Updates every button on the map (by calling update_button() for them).
Definition: button.cpp:227
treasure * get_empty_treasure()
Allocate and return the pointer to an empty treasure structure.
Definition: treasure.cpp:1420
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
This calls the appropriate treasure creation function.
Definition: treasure.cpp:287
void drain_stat(object *op)
Drains a random stat from op.
Definition: living.cpp:716
void yyrestart(FILE *input_file)
archetype * find_treasure_by_name(const treasure *t, const char *name, int depth)
Find a treasure with a matching name.
Definition: recipe.cpp:425
mapstruct * get_empty_map(int sizex, int sizey)
Creates and returns a map of the specific size.
Definition: map.cpp:852
void treasure_remove_item(treasurelist *list, int position)
Remove the treasure at the specified position from the list.
Definition: treasure.cpp:1485
int64_t new_exp(const object *ob)
Alternative way to calculate experience based on the ability of a monster.
Definition: exp.cpp:100
artifactlist * find_artifactlist(int type)
Finds the artifact list for a certain item type.
Definition: artifact.cpp:570
const readable_message_type * get_readable_message_type(object *readable)
Get the readable type for an object (hopefully book).
Definition: readable.cpp:2062
void formula_knowledge_code(const recipe *r, char *buf, size_t len)
Store the textual knowledge marker code for recipe R in BUF.
Definition: readable.cpp:1638
const char * get_region_longname(const region *r)
Gets the longname of a region.
Definition: region.cpp:209
object * object_find_by_type_and_name(const object *who, int type, const char *name)
Find object in inventory by type and name.
Definition: object.cpp:4093
void dump_animations(void)
Dump all animations to stderr, for debugging purposes.
Definition: anim.cpp:180
int object_count_active(void)
Objects statistics.
Definition: object.cpp:1768
void register_trigger(int ob_type, trigger_func method)
Registers the trigger method for the given type.
Definition: ob_types.cpp:107
int out_of_map(mapstruct *m, int x, int y)
Return 1 if coordinates X and Y are out of the map M, taking into account tiling. ...
Definition: map.cpp:2323
int blocked_link(object *ob, mapstruct *m, int16_t sx, int16_t sy)
Returns true if the given coordinate is blocked except by the object passed is not blocking...
Definition: map.cpp:354
int get_learn_spell(int stat)
Definition: living.cpp:2377
int has_ability(const object *ob)
Checks whether object has innate abilities (spell/spellbook in inventory).
Definition: exp.cpp:153
int is_friendly(const object *op)
Checks if the given object is already in the friendly list or not.
Definition: friend.cpp:108
void init_library(void)
It is vital that init_library() is called by any functions using this library.
Definition: init.cpp:315
StringBuffer * stringbuffer_new(void)
float get_speed_bonus(int stat)
Definition: living.cpp:2393
Struct to store the message_type and message_subtype for signs and books used by the player...
Definition: book.h:36
int check_path(const char *name, int prepend_dir)
This function checks if a file with the given path exists.
Definition: map.cpp:201
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
This rolls up wall, blocks_magic, blocks_view, etc, all into one function that just returns a P_...
Definition: map.cpp:300
void load_image_info(FILE *file, const char *filename)
This represents all archetypes for one particular object type.
Definition: artifact.h:24
object * object_find_by_type_without_flags(const object *who, int type, int *flags, int num_flags)
Find an object in inventory that does not have any of the provided flags set.
Definition: object.cpp:3989
void free_all_god(void)
Frees all god information.
Definition: holy.cpp:327
char * create_pathname(const char *name, char *buf, size_t size)
Get the full path to a map file.
Definition: map.cpp:104
void animate_turning(object *op)
Animates one step of object.
Definition: button.cpp:270
int has_carried_lights(const object *op)
Checks if op has a light source.
Definition: los.cpp:346
void make_path_to_file(const char *filename)
Checks if any directories in the given path doesn't exist, and creates if necessary.
Definition: porting.cpp:164
void dump_artifacts(void)
For debugging purposes.
Definition: artifact.cpp:610
void player_set_dragon_title(struct player *pl, int level, const char *attack, int skin_resist)
Updates the title of a dragon player to reflect the current level, attack type, and resistances...
Definition: player.cpp:203
void add_friendly_object(object *op)
Add a new friendly object to the list of friendly objects.
Definition: friend.cpp:32
char * size
Human-readable set size.
Definition: image.h:22
char * stringbuffer_finish(StringBuffer *sb)
int get_rangevector_from_mapcoord(const mapstruct *m, int x, int y, const object *op2, rv_vector *retval)
This is basically the same as get_rangevector() above, but instead of the first parameter being an ob...
Definition: map.cpp:2590
object * object_insert_in_map(object *op, mapstruct *m, object *originator, int flag)
This function inserts the object in the two-way linked list which represents what is on a map...
Definition: object.cpp:2346
object * object_present_in_ob_by_name(int type, const char *str, const object *op)
Searches for any objects with a matching type & name variable in the inventory of the given object...
Definition: object.cpp:3188
object * object_find_by_type_applied(const object *who, int type)
Find applied object in inventory.
Definition: object.cpp:4068
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
object_split(ob,nr) splits up ob into two parts.
Definition: object.cpp:2622
void object_update(object *op, int action)
object_update() updates the array which represents the map.
Definition: object.cpp:1419
uint32_t tag_t
Object tag, unique during the whole game.
Definition: object.h:14
void object_get_multi_size(const object *ob, int *sx, int *sy, int *hx, int *hy)
Computes the size of a multitile object.
Definition: object.cpp:4729
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
Definition: arch.cpp:227
void stringbuffer_append_string(StringBuffer *sb, const char *str)
static ob_methods base_type
Definition: ob_methods.cpp:27
void free_all_artifacts(void)
Free all artifact-related information.
Definition: artifact.cpp:117
void set_map_reset_time(mapstruct *map)
Updates the map's timeout.
Definition: map.cpp:2262
int nstrtok(const char *buf1, const char *buf2)
Simple routine to return the number of list items in buf1 as separated by the value of buf2...
Definition: readable.cpp:642
int allowed_class(const object *op)
Returns true if the given player is a legal class.
Definition: living.cpp:1661
method_ret ob_process(object *op)
Processes an object, giving it the opportunity to move or react.
Definition: ob_methods.cpp:67
mapstruct * has_been_loaded(const char *name)
Checks whether map has been loaded.
Definition: map.cpp:79
void yyset_lineno(int line_number)
object * object_find_by_type2(const object *who, int type1, int type2)
Find object in inventory.
Definition: object.cpp:4022
void yyset_debug(int bdebug)
void init_ob_method_struct(ob_methods *methods, ob_methods *fallback)
Initializes a ob_methods struct.
Definition: ob_types.cpp:32
int get_face_fallback(int faceset, uint16_t imageno)
This returns the set we will actually use when sending a face.
Definition: image.cpp:133
language_t i18n_get_language_by_code(const char *code)
Find the identifier of a language from its code.
Definition: languages.cpp:74
void set_attr_value(living *stats, int attr, int8_t value)
Sets Str/Dex/con/Wis/Cha/Int/Pow in stats to value, depending on what attr is (STR to POW)...
Definition: living.cpp:218
void jump_time(void)
Definition: time.cpp:198
int calculate_difficulty(mapstruct *m)
This routine is supposed to find out the difficulty of the map.
Definition: map.cpp:1925
int dirdiff(int dir1, int dir2)
Computes a direction difference.
Definition: object.cpp:3717
void i18n_list_languages(object *who)
List all languages for who.
Definition: languages.cpp:96
int get_button_value(const object *button)
Returns the first value linked to this button.
Definition: button.cpp:749
LogLevel
Log levels for the LOG() function.
Definition: logger.h:10
const char * time_format_time(const timeofday_t *tod, char *buf, size_t bufsize)
Formats a timestamp in Crossfire time.
Definition: time.cpp:369
int save_object(FILE *fp, object *op, int flag)
Dumps all variables in an object to a file.
Definition: object.cpp:5382
FILE * tempnam_secure(const char *dir, const char *pfx, char **filename)
A replacement for the tempnam_local() function since that one is not very secure. ...
Definition: porting.cpp:71
int calc_item_power(const object *op)
This takes an object 'op' and figures out what its item_power rating should be.
Definition: item.cpp:318
object * get_random_mon(int level)
Returns a random monster selected from linked list of all monsters in the current game...
Definition: readable.cpp:1269
int player_has_own_title(const struct player *pl)
Returns whether the player has a custom title.
Definition: player.cpp:248
const char * recipe_get_difficulty_string(int difficulty)
A method to produce a difficulty adjective to describe alchemy projects.
Definition: recipe.cpp:965
method_ret(* examine_func)(const object *, const object *, int use_media_tags, char *buf, size_t size)
Definition: ob_methods.h:33
key_value * object_get_key_value(const object *ob, const char *key)
Search for a field by key.
Definition: object.cpp:4306
void make_list_like(char *input)
Taking a string as an argument, mutate it into a string that looks like a list.
Definition: utils.cpp:368
void trigger_connected(objectlink *ol, object *cause, const int state)
Trigger every object in an objectlink.
Definition: button.cpp:41
int get_randomized_dir(int dir)
Returns a random direction (1..8) similar to a given direction.
Definition: utils.cpp:412
mapstruct * get_map_from_coord(mapstruct *m, int16_t *x, int16_t *y)
This is basically the same as out_of_map above(), but instead we return NULL if no map is valid (coor...
Definition: map.cpp:2351
int book_overflow(const char *buf1, const char *buf2, size_t booksize)
Checks if buf1 and buf2 can be combined.
Definition: readable.cpp:719
void free_player(player *pl)
Frees player structure, including pointed object (through object_free_drop_inventory()).
Definition: player.cpp:69
void init_stats()
This loads statistic bonus/penalties from the stat_bonus file.
Definition: living.cpp:2520
int strtoint(const char *buf)
Convert buf into an integer equal to the coadded sum of the (lowercase) character.
Definition: recipe.cpp:712
void remove_button_link(object *op)
Remove the object from the linked lists of buttons in the map.
Definition: button.cpp:693
void remove_directory(const char *path)
This function removes everything in the directory, and the directory itself.
Definition: porting.cpp:117
void object_sub_weight(object *op, signed long weight)
Recursively (outwards) subtracts a number from the weight of an object (and what is carried by it's e...
Definition: object.cpp:1792
Various statistics of objects.
Definition: living.h:35
object * check_inv_recursive(object *op, const object *trig)
Checks object and its inventory for specific item.
Definition: button.cpp:782
void object_set_enemy(object *op, object *enemy)
Sets the enemy of an object.
Definition: object.cpp:900
static const flag_definition flags[]
Flag mapping.
const char * get_season_name(const int index)
give access to season names
Definition: time.cpp:127
void object_free_all_data(void)
Destroys all allocated objects.
Definition: object.cpp:752
treasurelist represents one logical group of items to be generated together.
Definition: treasure.h:85
void object_copy_with_inv(const object *src_ob, object *dest_ob, bool update_speed)
Copy an object with an inventory, duplicate the inv too.
Definition: object.cpp:1193
const artifact * find_artifact(const object *op, const char *name)
Searches and returns a specific artifact compatible with an object, NULL if not found.
Definition: artifact.cpp:585
int is_magical(const object *op)
Checks whether object is magical.
Definition: item.cpp:1236
object * object_find_by_type(const object *who, int type)
Find object in inventory.
Definition: object.cpp:3965
recipe * find_recipe_for_tool(const char *tool, recipe *from)
Find a recipe for a specified tool.
Definition: recipe.cpp:897
int get_random_dir(void)
Returns a random direction (1..8).
Definition: utils.cpp:400
const Face * get_face_by_id(uint16_t id)
Get a face from its unique identifier.
Definition: assets.cpp:319
void object_give_identified_properties(object *op)
Ensure op has all its "identified" properties set.
Definition: item.cpp:1365
Animations * try_find_animation(const char *name)
Definition: assets.cpp:282
uint64_t price_base(const object *obj)
Determine the base (intrinsic) value of an item.
Definition: item.cpp:1507
const char * player_get_own_title(const struct player *pl)
Returns the player's own title.
Definition: player.cpp:261
method_ret ob_apply(object *op, object *applier, int aflags)
Apply an object by running an event hook or an object method.
Definition: ob_methods.cpp:44
size_t stringbuffer_length(StringBuffer *sb)
object * object_get_player_container(object *op)
Finds the player carrying an object.
Definition: object.cpp:592
void create_overlay_pathname(const char *name, char *buf, size_t size)
Same as create_pathname(), but for the overlay maps.
Definition: map.cpp:125
void free_charlinks(linked_char *lc)
Frees a link structure and its next items.
Definition: utils.cpp:616
void update_all_los(const mapstruct *map, int x, int y)
This function makes sure that update_los() will be called for all players on the given map within the...
Definition: los.cpp:595
const char * re_cmp(const char *str, const char *regexp)
re-cmp - get regular expression match.
Definition: re-cmp.cpp:68
recipelist * get_formulalist(int i)
Gets a formula list by ingredients count.
Definition: recipe.cpp:98
archetype * try_find_archetype(const char *name)
Definition: assets.cpp:274
int get_dam_bonus(int stat)
Definition: living.cpp:2389
language_t i18n_find_language_by_code(const char *code)
Attempt to find the identifier of a language from its code.
Definition: languages.cpp:60
const artifact * locate_recipe_artifact(const recipe *rp, size_t idx)
Finds an artifact for a recipe.
Definition: recipe.cpp:733
void free_objectlink(objectlink *ol)
Recursively frees all objectlinks.
Definition: links.cpp:67
int64_t check_exp_adjust(const object *op, int64_t exp)
Returns the maximum experience the object can gain or lose.
Definition: living.cpp:2102
void change_attr_value(living *stats, int attr, int8_t value)
Like set_attr_value(), but instead the value (which can be negative) is added to the specified stat...
Definition: living.cpp:264
void set_tick_duration(long t)
Sets the tick duration.
Definition: time.cpp:209
static event_registration m
Definition: citylife.cpp:424
archetype * get_archetype_by_skill_name(const char *skill, int type)
Retrieves an archetype by skill name and type.
Definition: arch.cpp:78
int is_dragon_pl(const object *op)
Checks if player is a dragon.
Definition: player.cpp:123
int load_png_file(FILE *file, const char *full_path)
void register_describe(int ob_type, describe_func method)
Registers the describe method for the given type.
Definition: ob_types.cpp:80
int region_is_child_of_region(const region *child, const region *r)
Checks if a region is a child of another.
Definition: region.cpp:182
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to...
Definition: object.cpp:1818
mapstruct * get_linked_map(void)
Allocates, initialises, and returns a pointer to a mapstruct, linked through first_map.
Definition: map.cpp:786
Animations * find_animation(const char *name)
Definition: assets.cpp:278
void init_ob_types(ob_methods *base_type)
Initializes the object system.
Definition: ob_types.cpp:49
void drain_specific_stat(object *op, int deplete_stats)
Drain a specified stat from op.
Definition: living.cpp:728
void replace(const char *src, const char *key, const char *replacement, char *result, size_t resultsize)
Replace in string src all occurrences of key by replacement.
Definition: utils.cpp:327
struct face_sets * fallback
Faceset to use when an image is not found in this faceset.
Definition: image.h:21
method_ret ob_trigger(object *op, object *cause, int state)
An object is triggered by another one.
Definition: ob_methods.cpp:156
int get_turn_bonus(int stat)
Definition: living.cpp:2385
void treasure_free(treasure *t)
Frees a treasure, including its yes, no and next items.
Definition: treasure.cpp:1441
long usec_elapsed(struct timespec first, struct timespec second)
Return the number of microseconds between two timespec structures.
Definition: cfanim.cpp:1149
object * object_create_clone(object *asrc)
Create clone from object to another.
Definition: object.cpp:3894
void free_all_maps(void)
Frees all allocated maps.
Definition: map.cpp:1991
One message a NPC can react to.
Definition: dialog.h:26
object * object_new(void)
Grabs an object from the list of unused objects, makes sure it is initialised, and returns it...
Definition: object.cpp:1258
int change_map_light(mapstruct *m, int change)
Used to change map light level (darkness) up or down.
Definition: map.cpp:2023
float ticks_to_seconds(int ticks)
Definition: time.cpp:386
void player_lvl_adj(object *who, object *op)
For the new exp system.
Definition: living.cpp:1830
const char * map_get_path(const object *item)
Return the map path on which the specified item is.
Definition: map.cpp:2693
const char * get_colorname(uint8_t index)
Definition: image.cpp:86
int64_t level_exp(int level, double expmul)
Returns how much experience is needed for a player to become the given level.
Definition: living.cpp:1885
void dump_stat_bonuses()
Definition: living.cpp:2651
int did_make_save(const object *op, int level, int bonus)
This function takes an object (monster/player, op), and determines if it makes a basic save throw by ...
Definition: living.cpp:2293
void object_handle_death_animation(object *op)
Definition: object.cpp:5395
const Face * find_face(const char *name)
Definition: assets.cpp:286
void add_statbonus(object *op)
Adds stat-bonuses given by the class which the player has chosen.
Definition: living.cpp:868
void init_formulae(BufferReader *reader, const char *filename)
Builds up the lists of formula from the file in the libdir.
Definition: recipe.cpp:166
void first_arch_pass(FILE *fp, const char *filename)
recipe * get_random_recipe(recipelist *rpl)
Gets a random recipe from a list, based on chance.
Definition: recipe.cpp:790
void get_search_arr(int *search_arr)
New function to make monster searching more efficient, and effective! This basically returns a random...
Definition: object.cpp:3627
void get_levelnumber(int i, char *buf, size_t size)
object * get_jail_exit(object *op)
Returns an object which is an exit through which the player represented by op should be sent in order...
Definition: region.cpp:252
const char * get_name_of_region_for_map(const mapstruct *m)
Gets the name of a region for a map.
Definition: region.cpp:89
void object_free_key_values(object *op)
Zero the key_values on op, decrementing the shared-string refcounts and freeing the links...
Definition: object.cpp:939
treasure is one element in a linked list, which together consist of a complete treasure-list.
Definition: treasure.h:63
void animate_object(object *op, int dir)
Updates the face-variable of an object.
Definition: anim.cpp:44
void save_object_in_sb(StringBuffer *sb, object *op, const int flag)
Store a string representation of op in sb.
Definition: object.cpp:5296
int remove_depletion(object *op, int level)
Remove depletion from op, if present, and warn player of such restorations.
Definition: living.cpp:755
void check_stat_bounds(living *stats, int8_t min_stat, int8_t max_stat)
Ensures that all stats (str/dex/con/wis/cha/int) are within the passed in range of min_stat and max_s...
Definition: living.cpp:354
int object_count_used(void)
Object statistics.
Definition: object.cpp:1752
void calc_perm_exp(object *op)
Ensure that the permanent experience requirements in an exp object are met.
Definition: living.cpp:1914
void object_free_inventory(object *ob)
Frees the inventory of an object, without any callback.
Definition: object.cpp:1553
int is_valid_faceset(int fsn)
Checks specified faceset is valid.
Definition: image.cpp:117
void apply_anim_suffix(object *who, const char *suffix)
Applies a compound animation to an object.
Definition: anim.cpp:150
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing mul...
Definition: object.cpp:2085
char * path_combine(const char *src, const char *dst, char *path, size_t size)
Combines 2 paths, which can be relative.
Definition: path.cpp:51
long seconds(void)
Return wall clock time in seconds.
Definition: time.cpp:348
void dump_monster_treasure(const char *name)
For debugging purposes.
Definition: treasure.cpp:1284
bool check_recipes()
Ensure that all recipes have a valid artifact, and that archetypes are correct.
Definition: recipe.cpp:147
artifactlist * get_empty_artifactlist(void)
Allocate and return the pointer to an empty artifactlist structure.
Definition: artifact.cpp:37
int isqrt(int n)
Compute the square root.
Definition: utils.cpp:562
int rndm(int min, int max)
Returns a number between min and max.
Definition: utils.cpp:162
object * object_find_by_name_global(const char *str)
Finds an object by name.
Definition: object.cpp:732
object * object_find_by_flag(const object *who, int flag)
Find object in inventory by flag.
Definition: object.cpp:4191
One player.
Definition: player.h:107
object * identify(object *op)
Identifies an item.
Definition: item.cpp:1446
void update_position(mapstruct *m, int x, int y)
This function updates various attributes about a specific space on the map (what it looks like...
Definition: map.cpp:2147
const char * get_god_for_race(const char *race)
Returns a string that is the name of the god that should be natively worshipped by a creature of who ...
Definition: holy.cpp:90
void check_inv(object *op, object *trig)
Function to search the inventory, of a player and then based on a set of conditions, the square will activate connected items.
Definition: button.cpp:825
void set_dragon_name(object *pl, const object *abil, const object *skin)
Set the new dragon name after gaining levels or changing ability focus (later this can be extended to...
Definition: living.cpp:1688
const typedata * get_typedata_by_name(const char *name)
Definition: item.cpp:348
void print_monsters(void)
As dump_abilities(), but with an alternative way of output.
Definition: info.cpp:87
One material type.
Definition: material.h:33
sstring get_message_title(const GeneralMessage *message)
Get a message's title.
Definition: readable.cpp:2075
StringBuffer * buf
Definition: readable.cpp:1563
void LOG(LogLevel logLevel, const char *format,...) PRINTF_ARGS(2
void make_sure_seen(const object *op)
The object is supposed to be visible through walls, thus check if any players are nearby...
Definition: los.cpp:695
One general message, from the lib/messages file.
Definition: book.h:44
void register_move_on(int ob_type, move_on_func method)
Registers the move_on method for the given type.
Definition: ob_types.cpp:98
void register_process(int ob_type, process_func method)
Registers the process method for the given type.
Definition: ob_types.cpp:71
const GeneralMessage * get_message_from_identifier(const char *identifier)
Find the message from its identifier.
Definition: assets.cpp:328
void set_materialname(object *op)
Set the material name and type for an item, if not set.
Definition: utils.cpp:297
void object_set_flag_inv(object *op, int flag)
Activate recursively a flag on an object's inventory.
Definition: object.cpp:3224
method_ret(* move_on_func)(object *, object *, object *)
Definition: ob_methods.h:34
void i18n_init(void)
Initializes the i18n subsystem.
Definition: languages.cpp:131
void dump_arch(archetype *at, StringBuffer *sb)
Dumps an archetype to buffer.
Definition: arch.cpp:139
int is_wraith_pl(object *op)
Tests if a player is a wraith.
Definition: player.cpp:174
A buffer that will be expanded as content is added to it.
int64_t random_roll64(int64_t min, int64_t max, const object *op, int goodbad)
This is a 64 bit version of random_roll() above.
Definition: utils.cpp:77
void get_tod(timeofday_t *tod)
Computes the ingame time of the day.
Definition: time.cpp:219
void free_all_readable(void)
Free all readable-related information.
Definition: readable.cpp:1981
void write_book_archive(void)
Write out the updated book archive to bookarch file.
Definition: readable.cpp:2012
void apply_death_exp_penalty(object *op)
Applies a death penalty experience, the size of this is defined by the settings death_penalty_percent...
Definition: living.cpp:2244
void add_button_link(object *button, mapstruct *map, int connected)
Links specified object in the map.
Definition: button.cpp:656
object * object_find_by_arch_name(const object *who, const char *name)
Find object in inventory by archetype name.
Definition: object.cpp:4237
const char * sstring
Definition: sstring.h:2
StringBuffer * describe_item(const object *op, const object *owner, int use_media_tags, StringBuffer *buf)
Describes an item, in all its details.
Definition: item.cpp:955
long get_sleep_remaining(void)
Definition: time.cpp:189
This is a game region.
Definition: map.h:279
void stringbuffer_delete(StringBuffer *sb)
void clear_player(player *pl)
Clears data in player structure.
Definition: player.cpp:33
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
Definition: living.cpp:1132
const object * find_god(const char *name)
Returns a god's object from its name.
Definition: holy.cpp:317
void share_exp(object *op, int64_t exp, const char *skill, int flag)
Gives experience to a player/monster, sharing it with party if applicable.
Definition: living.cpp:2323
This is one artifact, ie one special item.
Definition: artifact.h:14
void strip_endline(char *buf)
Removes endline from buffer (modified in place).
Definition: utils.cpp:314
void time_info(object *op)
Players wants to know the time.
Definition: time.cpp:298
object * object_decrease_nrof(object *op, uint32_t i)
Decreases a specified number from the amount of an object.
Definition: object.cpp:2661
object * object_create_arch(archetype *at)
Create a full object using the given archetype.
Definition: arch.cpp:296
object * object_get_owner(object *op)
Returns the object which this object marks as being the owner.
Definition: object.cpp:789
void query_weight(const object *op, char *buf, size_t size)
Formats the item's weight.
Definition: item.cpp:420
fatal_error
Fatal variables; used as arguments to fatal().
Definition: define.h:47
void object_set_cheat(object *op)
object_set_cheat(object) sets the cheat flag (WAS_WIZ) in the object and in all it's inventory (recur...
Definition: object.cpp:3259
void init_globals(void)
Initialises all global variables.
Definition: init.cpp:387
void animation_load_block(FILE *file, const char *full_path, const char *animation_name)
void init_attackmess(BufferReader *reader, const char *filename)
Initializes the attack messages.
Definition: init.cpp:563
int ob_blocked(const object *ob, mapstruct *m, int16_t x, int16_t y)
Returns true if the given object can't fit in the given spot.
Definition: map.cpp:489
object * object_get_env_recursive(object *op)
Utility function.
Definition: object.cpp:575
method_ret ob_move_on(object *op, object *victim, object *originator)
Makes an object move on top of another one.
Definition: ob_methods.cpp:134
void clean_tmp_map(mapstruct *m)
Removse the temporary file used by the map.
Definition: map.cpp:1982
void reset_sleep(void)
Initialise all variables used in the timing routines.
Definition: time.cpp:134
void give_artifact_abilities(object *op, const object *artifact)
Fixes the given object, giving it the abilities and titles it should have due to the second artifact-...
Definition: artifact.cpp:230
void set_abs_magic(object *op, int magic)
Sets magical bonus in an object, and recalculates the effect on the armour variable, and the effect on speed of armour.
Definition: treasure.cpp:642
StringBuffer * describe_attacktype(const char *attack, int value, StringBuffer *buf)
Describe the specified attack type.
Definition: utils.cpp:538
void get_ob_diff(StringBuffer *sb, const object *op, const object *op2)
Returns a pointer to a static string which contains all variables which are different in the two give...
Definition: object.cpp:4971
int object_check_move_on(object *op, object *originator)
Checks if any objects has a move_type that matches objects that effect this object on this space...
Definition: object.cpp:2997
int legal_artifact_combination(const object *op, const artifact *art)
Checks if op can be combined with art.
Definition: artifact.cpp:252
object * object_find_by_name(const object *who, const char *name)
Finds an object in inventory name.
Definition: object.cpp:3941
void dump_alchemy(void)
Dumps alchemy recipes to output.
Definition: recipe.cpp:352
object * object_find_by_flag_applied(const object *who, int flag)
Find applied object in inventory by flag.
Definition: object.cpp:4214
void dump_all_maps(void)
Prints out debug-information about all maps.
Definition: map.cpp:268
void remove_friendly_object(object *op)
Removes the specified object from the linked list of friendly objects.
Definition: friend.cpp:52
const char * i18n(const object *who, const char *code)
Translate a message in the appropriate language.
Definition: languages.cpp:42