Angband
Macros | Typedefs
h-basic.h File Reference

The lowest level header. More...

#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <time.h>
#include <wchar.h>
#include <wctype.h>
#include <pwd.h>
#include <sys/stat.h>
#include <unistd.h>

Go to the source code of this file.

Macros

#define HAVE_FCNTL_H
 Include autoconf autodetections, otherwise try to autodetect ourselves.
#define HAVE_STAT
#define UNIX
 Extract the "WINDOWS" flag from the compiler.
#define HAVE_DIRENT_H
#define PATH_SEP   "/"
 Define SETGID if we are running as a central install on a multiuser system that has setgid support.
#define PATH_SEPC   '/'
#define _GNU_SOURCE
 

Include the library header files


#define TRUE   1
#define FALSE   0
#define MAX_UCHAR   UCHAR_MAX
#define MAX_SHORT   32767
#define DSTRINGIFY(x)   #x
 Debugging macros.
#define DSTRING(x)   DSTRINGIFY(x)
#define DHERE   __FILE__ ":" DSTRING(__LINE__) ": "
#define MIN(a, b)   (((a) > (b)) ? (b) : (a))
 

Basic math macros


#define MAX(a, b)   (((a) < (b)) ? (b) : (a))
#define ABS(a)   (((a) < 0) ? (-(a)) : (a))
#define SGN(a)   (((a) < 0) ? (-1) : ((a) != 0))
#define CMP(a, b)   ((a) < (b) ? -1 : ((b) < (a) ? 1 : 0))
#define N_ELEMENTS(a)   (sizeof(a) / sizeof((a)[0]))
 

Useful fairly generic macros


#define A2I(X)   ((X) - 'a')
 

Some hackish character manipulation


#define I2A(X)   ((X) + 'a')
#define D2I(X)   ((X) - '0')
#define I2D(X)   ((X) + '0')

Typedefs

typedef int errr
 ANSI C headers.
typedef char bool
 Use a real bool type where possible.
typedef unsigned char byte
 Use guaranteed-size ints where possible.
typedef signed short s16b
typedef unsigned short u16b
typedef signed long s32b
typedef unsigned long u32b

Detailed Description

The lowest level header.

Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke

This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Macro Definition Documentation

#define _GNU_SOURCE


Include the library header files

#define A2I (   X)    ((X) - 'a')


Some hackish character manipulation

Note that all "index" values must be "lowercase letters", while all "digits" must be "digits".

Referenced by build_prob(), dehex(), label_to_equip(), label_to_inven(), label_to_quiver(), show_file(), and textui_get_item().

#define ABS (   a)    (((a) < 0) ? (-(a)) : (a))
#define CMP (   a,
 
)    ((a) < (b) ? -1 : ((b) < (a) ? 1 : 0))
#define D2I (   X)    ((X) - '0')
#define DHERE   __FILE__ ":" DSTRING(__LINE__) ": "
#define DSTRING (   x)    DSTRINGIFY(x)
#define DSTRINGIFY (   x)    #x

Debugging macros.

#define FALSE   0

Referenced by _find_in_range(), add_first_pval_mod(), add_fixed_pval_mod(), add_flag(), add_high_resist(), add_monster_message(), add_resist(), add_stat(), add_sustain(), adjust_panel_help(), alloc_object(), alloc_stairs(), append_random_brand(), append_random_slay(), artifact_is_known(), artifact_power(), artifacts_acceptable(), askfor_aux(), askfor_aux_keypress(), askfor_aux_numbers(), auto_pickup_okay(), black_market_ok(), blow_after_effects(), blow_side_effects(), brand_object(), brands_are_equal(), build_circular(), build_crossed(), build_greater_vault(), build_huge(), build_large(), build_moria(), build_nest(), build_overlap(), build_pit(), build_quest_stairs(), build_room_of_chambers(), build_room_template(), build_room_template_type(), build_simple(), build_tunnel(), build_vault(), build_vault_type(), buy_stat(), calc_bonuses(), calc_inventory(), calc_mana(), call_monster(), can_call_monster(), cave_generate(), cave_light(), cavern_chunk(), cavern_gen(), chance_of_missile_hit(), change_panel(), check_devices(), check_header(), chest_death(), chunk_copy(), chunk_find(), chunk_list_remove(), classic_gen(), cmd_cancel_repeat(), cmd_disable_repeat(), cmd_list_action(), cmd_menu(), cmd_set_repeat(), cmdq_pop(), combine_pack(), contains_only_spaces(), context_menu_cave(), context_menu_object(), context_menu_player(), context_menu_player_2(), context_menu_store(), context_menu_store_item(), cursed_p(), death_file(), death_screen(), decrease_timeouts(), delete_monster_idx(), describe_blows(), describe_brands(), describe_combat(), describe_curses(), describe_damage(), describe_digger(), describe_effect(), describe_ego(), describe_elements(), describe_flavor_text(), describe_food(), describe_hates(), describe_ignores(), describe_light(), describe_misc_magic(), describe_origin(), describe_protects(), describe_slays(), describe_stats(), describe_sustains(), dice_parse_string(), dice_reset(), dice_test_variables(), dir_create(), dir_exists(), display_bolt(), display_explosion(), display_knowledge(), display_message(), display_resistance_panel(), disturb(), do_cmd_accept_character(), do_cmd_alter(), do_cmd_alter_aux(), do_cmd_birth_init(), do_cmd_birth_reset(), do_cmd_buy(), do_cmd_cast(), do_cmd_change_name(), do_cmd_choose_class(), do_cmd_choose_race(), do_cmd_close(), do_cmd_close_aux(), do_cmd_close_test(), do_cmd_colors(), do_cmd_disarm(), do_cmd_disarm_aux(), do_cmd_disarm_chest(), do_cmd_disarm_test(), do_cmd_feeling(), do_cmd_fire(), do_cmd_go_down(), do_cmd_go_up(), do_cmd_hold(), do_cmd_jump(), do_cmd_keymaps(), do_cmd_knowledge_artifacts(), do_cmd_knowledge_ego_items(), do_cmd_knowledge_features(), do_cmd_knowledge_monsters(), do_cmd_load_screen(), do_cmd_lock_door(), do_cmd_messages(), do_cmd_open(), do_cmd_open_aux(), do_cmd_open_chest(), do_cmd_open_test(), do_cmd_options(), do_cmd_options_item(), do_cmd_pickup(), do_cmd_pref_file_hack(), do_cmd_query_symbol(), do_cmd_reset_stats(), do_cmd_rest(), do_cmd_run(), do_cmd_save_screen_html(), do_cmd_sell(), do_cmd_spoilers(), do_cmd_stash(), do_cmd_throw(), do_cmd_toggle_search(), do_cmd_tunnel(), do_cmd_tunnel_aux(), do_cmd_tunnel_test(), do_cmd_visuals(), do_cmd_walk(), do_cmd_walk_test(), do_cmd_wiz_change_aux(), do_cmd_wiz_effect(), do_cmd_wiz_features(), do_cmd_wiz_play(), do_cmd_wizard(), do_ident_item(), do_mon_spell(), do_randart(), drop_near(), dump_save(), earlier_object(), easy_know(), edit_text(), effect_aim(), effect_do(), effect_handler_ACQUIRE(), effect_handler_AGGRAVATE(), effect_handler_BIZARRE(), effect_handler_CURSE_ARMOR(), effect_handler_CURSE_WEAPON(), effect_handler_DAMAGE(), effect_handler_DARKEN_AREA(), effect_handler_DETECT_DOORS(), effect_handler_DETECT_EVIL(), effect_handler_DETECT_GOLD(), effect_handler_DETECT_INVISIBLE_MONSTERS(), effect_handler_DETECT_OBJECTS(), effect_handler_DETECT_STAIRS(), effect_handler_DETECT_TRAPS(), effect_handler_DETECT_VISIBLE_MONSTERS(), effect_handler_DRAIN_MANA(), effect_handler_DRAIN_STAT(), effect_handler_EARTHQUAKE(), effect_handler_ENLIGHTENMENT(), effect_handler_GAIN_EXP(), effect_handler_LIGHT_AREA(), effect_handler_LOSE_EXP(), effect_handler_MON_HEAL_HP(), effect_handler_MON_TIMED_INC(), effect_handler_NOURISH(), effect_handler_PROBE(), effect_handler_PROJECT_LOS(), effect_handler_RESTORE_MANA(), effect_handler_RESTORE_STAT(), effect_handler_SENSE_OBJECTS(), effect_handler_SET_NOURISH(), effect_handler_SUMMON(), effect_handler_TELEPORT(), effect_handler_TELEPORT_LEVEL(), effect_handler_THRUST_AWAY(), effect_handler_TIMED_DEC(), effect_handler_TIMED_INC(), effect_handler_TIMED_SET(), effect_handler_TOUCH(), effect_handler_TRAP_DART_SLOW(), effect_handler_TRAP_DOOR(), effect_handler_TRAP_PIT(), effect_handler_TRAP_PIT_POISON(), effect_handler_TRAP_PIT_SPIKES(), effect_handler_TRAP_RUNE_SUMMON(), effect_handler_TRAP_RUNE_TELEPORT(), effect_handler_TRAP_SPOT_ACID(), effect_handler_TRAP_SPOT_FIRE(), effect_handler_WONDER(), effect_valid(), ego_action(), ego_apply_magic(), ego_ignore_clear(), ego_menu(), enchant(), enchant2(), enchant_curse(), enchant_score(), enchant_spell(), eval_monster_power(), expression_test_copy(), file_close(), file_getl(), file_newer(), file_putf(), file_readc(), file_vputf(), fill_slay_cache(), find_hiding(), find_safety(), find_space(), find_value_arg(), findpath(), flag_comp_union(), flag_diff(), flag_has(), flag_has_dbg(), flag_inter(), flag_is_empty(), flag_is_full(), flag_is_inter(), flag_is_subset(), flag_off(), flag_on(), flag_on_dbg(), flag_union(), flags_clear(), flags_mask(), flags_set(), flags_test(), flags_test_all(), flavor_init(), floor_carry(), flush_all_monster_messages(), gauntlet_gen(), generate_starburst_room(), generate_stats(), get_aim_dir(), get_chamber_monsters(), get_check(), get_com(), get_com_ex(), get_debug_command(), get_file_backup(), get_file_text(), get_item(), get_item_allow(), get_moves(), get_moves_fear(), get_moves_flow(), get_name_keypress(), get_rep_dir(), get_string(), get_tag(), get_vault_monsters(), gf_force_obvious(), glyph_command(), grab_element_flag(), handle_options_item(), handle_signal_simple(), hard_centre_gen(), history_add_artifact(), history_add_full(), history_display(), history_is_artifact_known(), history_is_artifact_logged(), history_know_artifact(), history_lose_artifact(), history_set_num(), hit_trap(), ignore_birth_init(), ignore_collect_kind(), ignore_item_ok(), ignore_point(), ignore_sval_menu_action(), ignore_tval(), init_nds(), init_parse_prefs(), inkey_aux(), inkey_ex(), inven_can_stack_partial(), inven_carry(), inven_carry_okay(), inven_damage(), inven_drop(), inven_stack_okay(), is_a_vowel(), is_daytime(), is_locked_chest(), is_quest(), is_trapped_chest(), is_valid_row(), item_is_available(), item_tester_hook_recharge(), item_tester_unknown(), key_confirm_command(), keymap_browse_hook(), keymap_dump(), keymap_get_trigger(), keymap_remove(), kind_info(), kind_is_good(), kind_is_ignored_aware(), kind_is_ignored_unaware(), labyrinth_check(), labyrinth_gen(), lair_gen(), load_block(), look_mon_desc(), lookup_sval(), lore_append_abilities(), lore_append_attack(), lore_append_awareness(), lore_append_kills(), lore_append_spells(), lore_save(), lore_show_interactive(), lore_show_subwindow(), los(), main(), make_artifact(), make_attack_normal(), make_attack_spell(), make_fake_artifact(), make_object(), make_ranged_shot(), make_ranged_throw(), map_info(), mass_produce(), match_monster_bases(), melee_effect_experience(), melee_effect_handler_BLIND(), melee_effect_handler_CONFUSE(), melee_effect_handler_EAT_FOOD(), melee_effect_handler_EAT_ITEM(), melee_effect_handler_POISON(), menu_action_handle(), menu_action_valid(), menu_handle_action(), menu_handle_keypress(), menu_question(), menu_select(), message_flush(), message_pain(), minus_ac(), modify_panel(), mon_clear_timed(), mon_create_drop(), mon_lore(), mon_pit_hook(), mon_resist_effect(), mon_restrict(), mon_select(), mon_set_timed(), mon_take_hit(), monster_can_flow(), monster_carry(), monster_check_active(), monster_list_collect(), monster_list_format_special(), monster_list_format_textblock(), monster_list_needs_update(), monster_list_reset(), monster_spell_is_projectable(), move_player(), multiply_monster(), my_dread(), nds_load_kbd(), nds_load_tiles(), near_permwall(), new_level_display_update(), next_section(), obj_can_activate(), obj_can_browse(), obj_can_fail(), obj_can_refill(), obj_can_zap(), obj_desc_get_basename(), obj_desc_inscrip(), obj_desc_name_prefix(), obj_desc_show_armor(), obj_has_charges(), obj_has_inscrip(), obj_is_activatable(), obj_is_useable(), obj_known_damage(), obj_known_digging(), obj_known_effect(), obj_known_light(), obj_known_misc_combat(), object_absorb_merge(), object_add_id_flag(), object_all_brands_and_slays_are_known(), object_all_but_flavor_is_known(), object_all_elements_are_known(), object_all_flags_are_known(), object_all_miscellaneous_are_known(), object_attack_plusses_are_visible(), object_check_for_ident(), object_defence_plusses_are_visible(), object_effect_is_known(), object_ego_is_visible(), object_element_is_known(), object_flag_is_known(), object_high_resist_is_possible(), object_info_out(), object_is_equipped(), object_is_ignored(), object_is_known(), object_kind_name(), object_list_collect(), object_list_format_name(), object_list_format_special(), object_list_needs_update(), object_list_reset(), object_list_should_ignore_object(), object_name_is_visible(), object_notice_attack_plusses(), object_notice_curses(), object_notice_ego(), object_notice_element(), object_notice_flag(), object_notice_flags(), object_notice_on_wield(), object_pseudo(), object_similar(), object_stackable(), object_test(), object_this_mod_is_visible(), object_value(), object_was_sensed(), object_was_worn(), on_new_level(), option_set(), option_toggle_handle(), option_toggle_menu(), pack_is_full(), pack_is_overfull(), pack_overflow(), parse_act_aim(), parse_artifact_flags(), parse_artifact_values(), parse_ego_flags(), parse_ego_min_val(), parse_ego_type(), parse_ego_values(), parse_object_base_flags(), parse_object_flags(), parse_object_values(), parse_p_race_values(), parse_random(), parser_hasval(), pick_and_place_distant_monster(), pick_and_place_monster(), pick_trap(), pile_contains(), place_friends(), place_gold(), place_monster(), place_monster_base_okay(), place_new_monster(), place_new_monster_one(), place_object(), player_book_has_unlearned_spells(), player_can_cast(), player_can_fire(), player_can_read(), player_can_refuel(), player_can_see_bold(), player_can_study(), player_confuse_dir(), player_dec_timed(), player_has_los_bold(), player_inc_timed(), player_init(), player_outfit(), player_pickup_gold(), player_pickup_item(), player_place(), player_resting_is_special(), player_resting_set_count(), player_set_food(), player_set_timed(), player_stat_dec(), player_stat_inc(), player_update_light(), point_based_command(), possible_doorway(), prefix(), prefix_i(), prefs_save(), price_item(), process_command(), process_monster(), process_monster_can_move(), process_monster_glyph(), process_monster_grab_objects(), process_monster_multiply(), process_monster_timed(), process_monster_try_push(), process_monsters(), process_player_cleanup(), process_pref_file(), process_pref_file_layered(), process_world(), project(), project_f(), project_feature_handler_KILL_WALL(), project_m(), project_m_apply_side_effects(), project_m_monster_attack(), project_m_player_attack(), project_monster_handler_CHAOS(), project_monster_handler_HOLY_ORB(), project_monster_handler_OLD_DRAIN(), project_monster_handler_WATER(), project_o(), project_object_elemental(), project_p(), project_player_drain_stats(), project_player_handler_CHAOS(), project_player_handler_GRAVITY(), project_player_handler_ICE(), project_player_handler_INERTIA(), project_player_handler_NETHER(), project_player_handler_SHARD(), project_player_handler_TIME(), projectable(), push_object(), py_attack(), py_attack_real(), quality_menu(), quest_check(), Rand_init(), randcalc_valid(), randname_make(), random_high_resist(), ranged_helper(), rd_ignore(), rd_item(), rd_object_memory(), rd_randomizer(), react_to_slay(), react_to_specific_slay(), ReadDIB2_PNG(), recharge_objects(), recharge_timeout(), recharged_notice(), redundant_monster_message(), refill_lamp(), region_inside(), remove_bad_spells(), remove_curse(), remove_old_dump(), remove_tiles(), repeated_command_display(), reset_visuals(), roller_command(), room_build(), run_game_loop(), run_init(), run_step(), run_test(), savefile_load(), savefile_save(), SaveWindow_PNG(), scan_items(), scramble_artifact(), search(), see_floor_items(), see_wall(), seen_tval(), sell_stat(), set_cut(), set_del(), set_stun(), setup_menus(), show_equip(), show_file(), show_inven(), show_obj_list(), show_quiver(), slay_power(), slays_are_equal(), slot_type_is(), spell_cast(), spell_identify_unknown_available(), spell_menu_handler(), spell_menu_new(), spell_okay_list(), spoil_artifact(), square_changeable(), square_destroy_door(), square_destroy_trap(), square_dtrap_edge(), square_is_granite_with_flag(), square_isplayer(), square_isstart(), square_open_door(), square_player_trap_allowed(), square_reveal_trap(), square_smash_door(), square_trap_flag(), square_trap_specific(), square_verify_trap(), start_game(), store_base_power(), store_carry(), store_check_num(), store_create_random(), store_display_entry(), store_display_help(), store_examine(), store_get_check(), store_is_staple(), store_menu_handle(), store_object_absorb(), store_process_command_key(), store_purchase(), store_sell(), store_stock_list(), store_will_buy(), store_will_buy_tester(), strescape(), subwindow_flag_changed(), suffix(), summon_possible(), summon_specific(), summon_specific_okay(), sval_menu(), take_hit(), target_accept(), target_dir(), target_okay(), target_recall_loop_object(), target_set_closest(), target_set_interactive(), target_set_interactive_aux(), target_set_location(), target_set_monster(), Term_fresh(), Term_inkey(), term_nuke(), Term_xtra_nds(), test_breakage_chance(), test_drop_eat(), test_drop_pickup(), test_loadgame(), test_magic_missile(), test_newgame(), test_obj_can_refill(), test_obj_piles(), test_prefs(), test_spells(), test_stairs1(), test_stairs2(), test_stat_dec(), textui_browse_knowledge(), textui_browse_object_knowledge(), textui_cmd_ignore_menu(), textui_do_birth(), textui_enter_store(), textui_get_aim_dir(), textui_get_check(), textui_get_command(), textui_get_item(), textui_get_rep_dir(), textui_init(), textui_prefs_init(), textui_process_key(), textui_quit(), textui_store_knowledge(), tile_picker_command(), town_gen(), try_load(), tval_can_have_failure(), tval_can_have_flavor_k(), tval_has_ignore_type(), tval_has_variable_power(), tval_is_ammo(), tval_is_armor(), tval_is_body_armor(), tval_is_book_k(), tval_is_edible(), tval_is_melee_weapon(), tval_is_useable(), tval_is_weapon(), tval_is_wearable(), twall(), ui_keymap_create(), ui_keymap_query(), ui_leave_init(), uncurse_object(), update_bonuses(), update_minimap_subwindow(), update_mon(), update_sidebar(), update_stuff(), use_aux(), vault_objects(), vstrnfmt(), wield_item(), wield_slot(), wiz_cheat_death(), wiz_create_item(), wiz_create_item_action(), wiz_create_item_subaction(), wiz_display_item(), wiz_gf_demo(), wiz_reroll_item(), wiz_statistics(), wiz_test_kind(), and wiz_tweak_curse().

#define HAVE_DIRENT_H
#define HAVE_FCNTL_H

Include autoconf autodetections, otherwise try to autodetect ourselves.

Native MSVC compiler doesn't understand inline or snprintf Using C99, assume we have stdint and stdbool Everyone except RISC OS has fcntl.h and sys/stat.h

#define HAVE_STAT
#define I2A (   X)    ((X) + 'a')
#define I2D (   X)    ((X) + '0')
#define MAX (   a,
 
)    (((a) < (b)) ? (b) : (a))
#define MAX_SHORT   32767
#define MAX_UCHAR   UCHAR_MAX
#define MIN (   a,
 
)    (((a) > (b)) ? (b) : (a))
#define N_ELEMENTS (   a)    (sizeof(a) / sizeof((a)[0]))


Useful fairly generic macros

Given an array, determine how many elements are in it.

Referenced by add_high_resist(), adj_energy(), append_random_brand(), append_random_slay(), build_freq_table(), change_path(), cleanup_arrays(), cmd_idx(), cmd_init(), cmd_lookup_key(), cmd_verb(), count_known_monsters(), death_screen(), describe_elements(), describe_hates(), describe_ignores(), describe_misc_magic(), describe_protects(), describe_stats(), describe_sustains(), display_feeling(), display_options_item(), display_player_xtra_info(), do_cmd_colors(), do_cmd_keymaps(), do_cmd_knowledge_ego_items(), do_cmd_knowledge_features(), do_cmd_knowledge_monsters(), do_cmd_options(), do_cmd_options_item(), do_cmd_save_screen_html(), do_cmd_spoilers(), do_cmd_visuals(), effect_lookup(), ego_item_name(), element_info_collect(), element_power(), enter_score(), expression_add_operations_string(), flags_power(), get_known_elements(), grab_effect_data(), handle_options_item(), ignore_tval(), ignore_type_of(), init_arrays(), keycode_find_code(), keycode_find_desc(), keymap_free(), main(), option_dump(), parse_frequencies(), parse_mon_spell_effect(), parse_mon_spell_name(), parse_prefs_keymap_action(), parse_prefs_keymap_input(), parse_prefs_window(), parse_profile_name(), parse_profile_room(), parse_random(), predict_score(), prt_tmd(), prt_welcome(), py_attack_real(), ranged_helper(), redraw_stuff(), show_scores(), subwindow_flag_changed(), tag_options_item(), test_length(), textui_knowledge_init(), try_save(), tval_find_idx(), tval_find_name(), tval_has_ignore_type(), ui_enter_game(), ui_leave_game(), update_sidebar(), update_statusline(), and valid_options_item().

#define PATH_SEP   "/"

Define SETGID if we are running as a central install on a multiuser system that has setgid support.

Every system seems to use its own symbol as a path separator.

Default to the standard Unix slash, but attempt to change this for various other systems. Note that any system that uses the "period" as a separator (i.e. RISCOS) will have to pretend that it uses the slash, and do its own mapping of period <-> slash.

It is most definitely wrong to have such things here. Platform-specific code should handle shifting Angband filenames to platform ones. XXX

Referenced by init_file_paths(), init_stuff(), path_build(), path_process(), set_file_paths(), stats_db_open(), and stats_make_output_dir().

#define PATH_SEPC   '/'

Referenced by dir_create(), and path_filename_index().

#define SGN (   a)    (((a) < 0) ? (-1) : ((a) != 0))

Referenced by object_value_real().

#define TRUE   1

Referenced by _find_in_range(), acquirement(), activation_message(), add_first_pval_mod(), add_fixed_pval_mod(), add_flag(), add_monster_message(), add_resist(), adjust_panel_help(), alloc_object(), alloc_stairs(), append_random_brand(), append_random_slay(), artifact_is_known(), artifact_power(), artifacts_acceptable(), askfor_aux(), askfor_aux_keypress(), auto_pickup_okay(), black_market_ok(), blow_after_effects(), brand_object(), brands_are_equal(), build_circular(), build_crossed(), build_huge(), build_large(), build_moria(), build_nest(), build_overlap(), build_pit(), build_room_of_chambers(), build_room_template(), build_room_template_type(), build_simple(), build_streamer(), build_tunnel(), build_vault(), build_vault_type(), buy_stat(), calc_bonuses(), calc_inventory(), calc_mana(), can_call_monster(), cave_generate(), cavern_gen(), center_panel(), chance_of_missile_hit(), change_panel(), cheat_monster_lore(), check_devices(), check_header(), check_hit(), CheckEvents(), chest_death(), chunk_copy(), chunk_find(), chunk_list_remove(), classic_gen(), cmd_get_spell(), cmd_menu(), cmd_set_repeat(), cmdq_pop(), combine_pack(), connect_caverns(), contains_only_spaces(), context_menu_cave(), context_menu_object(), context_menu_player(), context_menu_player_2(), context_menu_store(), context_menu_store_item(), describe_blows(), describe_brands(), describe_combat(), describe_curses(), describe_damage(), describe_digger(), describe_effect(), describe_ego(), describe_elements(), describe_flavor_text(), describe_food(), describe_hates(), describe_ignores(), describe_light(), describe_misc_magic(), describe_origin(), describe_protects(), describe_slays(), describe_stats(), describe_sustains(), dice_parse_string(), dice_test_values(), dice_test_variables(), dir_create(), dir_exists(), display_bolt(), display_explosion(), display_knowledge(), display_message(), display_resistance_panel(), do_autopickup(), do_cmd_accept_character(), do_cmd_birth_init(), do_cmd_buy(), do_cmd_buy_stat(), do_cmd_cast(), do_cmd_change_name(), do_cmd_close_test(), do_cmd_disarm(), do_cmd_disarm_aux(), do_cmd_disarm_chest(), do_cmd_disarm_test(), do_cmd_go_down(), do_cmd_go_up(), do_cmd_keylog(), do_cmd_load_screen(), do_cmd_lock_door(), do_cmd_messages(), do_cmd_open_aux(), do_cmd_open_chest(), do_cmd_open_test(), do_cmd_pathfind(), do_cmd_pref_file_hack(), do_cmd_query_symbol(), do_cmd_read_scroll(), do_cmd_reset_stats(), do_cmd_retrieve(), do_cmd_roll_stats(), do_cmd_run(), do_cmd_save_screen_html(), do_cmd_search(), do_cmd_sell(), do_cmd_sell_stat(), do_cmd_study_book(), do_cmd_study_spell(), do_cmd_suicide(), do_cmd_toggle_search(), do_cmd_tunnel_aux(), do_cmd_tunnel_test(), do_cmd_walk(), do_cmd_walk_test(), do_cmd_wiz_cure_all(), do_cmd_wiz_features(), do_cmd_wiz_learn(), do_cmd_wiz_named(), do_cmd_wiz_play(), do_cmd_wizard(), do_ident_item(), do_mon_spell(), do_randart(), draw_path(), drop_near(), dump_save(), dungeon_change_level(), earlier_object(), easy_know(), edit_text(), effect_aim(), effect_handler_ACQUIRE(), effect_handler_AGGRAVATE(), effect_handler_ALTER(), effect_handler_ALTER_REALITY(), effect_handler_BALL(), effect_handler_BANISH(), effect_handler_BEAM(), effect_handler_BIZARRE(), effect_handler_BOLT(), effect_handler_BOLT_AWARE(), effect_handler_BRAND_AMMO(), effect_handler_BRAND_BOLTS(), effect_handler_BRAND_WEAPON(), effect_handler_BREATH(), effect_handler_CONFUSING(), effect_handler_CREATE_STAIRS(), effect_handler_CRUNCH(), effect_handler_CURE(), effect_handler_CURSE_ARMOR(), effect_handler_CURSE_WEAPON(), effect_handler_DAMAGE(), effect_handler_DARKEN_AREA(), effect_handler_DEEP_DESCENT(), effect_handler_DESTRUCTION(), effect_handler_DETECT_DOORS(), effect_handler_DETECT_EVIL(), effect_handler_DETECT_GOLD(), effect_handler_DETECT_INVISIBLE_MONSTERS(), effect_handler_DETECT_OBJECTS(), effect_handler_DETECT_STAIRS(), effect_handler_DETECT_TRAPS(), effect_handler_DETECT_VISIBLE_MONSTERS(), effect_handler_DISENCHANT(), effect_handler_DRAIN_MANA(), effect_handler_DRAIN_STAT(), effect_handler_EARTHQUAKE(), effect_handler_ENCHANT(), effect_handler_ENLIGHTENMENT(), effect_handler_GAIN_EXP(), effect_handler_GAIN_STAT(), effect_handler_HEAL_HP(), effect_handler_IDENTIFY(), effect_handler_IDENTIFY_PACK(), effect_handler_LIGHT_AREA(), effect_handler_LINE(), effect_handler_LOSE_EXP(), effect_handler_LOSE_RANDOM_STAT(), effect_handler_MAP_AREA(), effect_handler_MASS_BANISH(), effect_handler_MON_HEAL_HP(), effect_handler_MON_TIMED_INC(), effect_handler_NOURISH(), effect_handler_PROBE(), effect_handler_PROJECT_LOS(), effect_handler_RANDOM(), effect_handler_RECALL(), effect_handler_RECHARGE(), effect_handler_REMOVE_ALL_CURSE(), effect_handler_REMOVE_CURSE(), effect_handler_RESTORE_EXP(), effect_handler_RESTORE_MANA(), effect_handler_RESTORE_STAT(), effect_handler_RUNE(), effect_handler_SENSE_OBJECTS(), effect_handler_SET_NOURISH(), effect_handler_STAR(), effect_handler_STAR_BALL(), effect_handler_SUMMON(), effect_handler_SWARM(), effect_handler_TELEPORT(), effect_handler_TELEPORT_LEVEL(), effect_handler_TELEPORT_TO(), effect_handler_THRUST_AWAY(), effect_handler_TIMED_DEC(), effect_handler_TIMED_INC(), effect_handler_TIMED_SET(), effect_handler_TOUCH(), effect_handler_TOUCH_AWARE(), effect_handler_TRAP_DART_LOSE_CON(), effect_handler_TRAP_DART_LOSE_DEX(), effect_handler_TRAP_DART_LOSE_STR(), effect_handler_TRAP_DART_SLOW(), effect_handler_TRAP_DOOR(), effect_handler_TRAP_GAS_BLIND(), effect_handler_TRAP_GAS_CONFUSE(), effect_handler_TRAP_GAS_POISON(), effect_handler_TRAP_GAS_SLEEP(), effect_handler_TRAP_PIT(), effect_handler_TRAP_PIT_POISON(), effect_handler_TRAP_PIT_SPIKES(), effect_handler_TRAP_RUNE_SUMMON(), effect_handler_TRAP_RUNE_TELEPORT(), effect_handler_TRAP_SPOT_ACID(), effect_handler_TRAP_SPOT_FIRE(), effect_handler_WONDER(), effect_simple(), ego_action(), ego_ignore(), enchant(), enchant2(), enchant_curse(), enchant_score(), enchant_spell(), ensure_connectedness(), equip_notice_after_time(), expression_test_copy(), file_close(), file_getl(), file_newer(), file_readc(), fill_slay_cache(), find_hiding(), find_safety(), find_space(), find_value_arg(), findpath(), flag_comp_union(), flag_diff(), flag_has(), flag_has_dbg(), flag_inter(), flag_is_empty(), flag_is_full(), flag_is_inter(), flag_is_subset(), flag_off(), flag_on(), flag_on_dbg(), flag_union(), flags_clear(), flags_set(), flags_test(), flags_test_all(), flavor_init(), floor_carry(), flush(), flush_all_monster_messages(), gauntlet_gen(), gear_excise_object(), generate_starburst_room(), generate_stats(), get_chamber_monsters(), get_com_ex(), get_debug_command(), get_file_backup(), get_file_text(), get_item_allow(), get_moves(), get_moves_fear(), get_moves_flow(), get_pref_path(), get_stats(), get_tag(), get_vault_monsters(), getmsg(), glyph_command(), grab_element_flag(), handle_options_item(), handle_signal_simple(), hard_centre_gen(), highscore_read(), history_add_artifact(), history_add_full(), history_display(), history_is_artifact_known(), history_is_artifact_logged(), history_know_artifact(), history_lose_artifact(), history_set_num(), ignore_collect_kind(), ignore_level_of(), ignore_point(), ignore_sval_menu_action(), ignore_tval(), init_angband(), init_nds(), inkey_aux(), inkey_ex(), inven_carry(), inven_carry_okay(), inven_damage(), inven_drop(), inven_stack_okay(), is_a_vowel(), is_daytime(), is_quest(), is_valid_pf(), is_valid_row(), item_is_available(), item_tester_hook_recharge(), item_tester_unknown(), key_confirm_command(), keymap_dump(), keymap_remove(), kind_is_good(), kind_is_ignored_aware(), kind_is_ignored_unaware(), labyrinth_check(), labyrinth_gen(), lair_gen(), load_block(), look_mon_desc(), lore_append_abilities(), lore_append_attack(), lore_append_awareness(), lore_append_drop(), lore_append_friends(), lore_append_kills(), lore_append_spells(), lore_append_toughness(), lore_do_probe(), lore_save(), lore_update(), los(), main(), make_artifact(), make_attack_normal(), make_attack_spell(), make_fake_artifact(), make_object(), make_ranged_shot(), make_ranged_throw(), map_info(), map_is_visible(), melee_effect_elemental(), melee_effect_experience(), melee_effect_handler_ACID(), melee_effect_handler_COLD(), melee_effect_handler_DRAIN_CHARGES(), melee_effect_handler_EAT_FOOD(), melee_effect_handler_EAT_GOLD(), melee_effect_handler_EAT_ITEM(), melee_effect_handler_EAT_LIGHT(), melee_effect_handler_ELEC(), melee_effect_handler_FIRE(), melee_effect_handler_HALLU(), melee_effect_handler_HURT(), melee_effect_handler_NONE(), melee_effect_handler_PARALYZE(), melee_effect_handler_POISON(), melee_effect_handler_SHATTER(), melee_effect_handler_TERRIFY(), melee_effect_timed(), menu_action_handle(), menu_action_valid(), menu_dynamic_select(), menu_handle_keypress(), menu_question(), menu_select(), minus_ac(), modified_chunk(), modified_gen(), modify_panel(), mon_create_drop(), mon_pit_hook(), mon_resist_effect(), mon_restrict(), mon_select(), mon_set_timed(), mon_take_hit(), monster_can_flow(), monster_carry(), monster_check_active(), monster_death(), monster_list_format_special(), monster_list_sort(), monster_spell_is_projectable(), monster_swap(), moria_chunk(), moria_gen(), multiply_monster(), my_dread(), my_stricmp(), nds_load_kbd(), nds_load_tiles(), near_permwall(), new_level_display_update(), next_section(), obj_can_activate(), obj_can_browse(), obj_can_fail(), obj_can_refill(), obj_can_zap(), obj_desc_name(), obj_desc_name_prefix(), obj_desc_show_armor(), obj_has_charges(), obj_has_inscrip(), obj_is_activatable(), obj_is_useable(), obj_known_blows(), obj_known_damage(), obj_known_digging(), obj_known_effect(), obj_known_light(), obj_known_misc_combat(), object_absorb_merge(), object_add_id_flag(), object_all_brands_and_slays_are_known(), object_all_but_flavor_is_known(), object_all_elements_are_known(), object_all_flags_are_known(), object_all_miscellaneous_are_known(), object_attack_plusses_are_visible(), object_check_for_ident(), object_defence_plusses_are_visible(), object_desc(), object_effect_is_known(), object_ego_is_visible(), object_element_is_known(), object_flag_is_known(), object_flavor_aware(), object_flavor_tried(), object_high_resist_is_possible(), object_info_out(), object_is_equipped(), object_is_ignored(), object_is_known(), object_know_brands_and_slays(), object_list_format_name(), object_list_needs_update(), object_list_should_ignore_object(), object_list_sort(), object_name_is_visible(), object_notice_brands(), object_notice_element(), object_notice_everything(), object_notice_flag(), object_notice_flags(), object_notice_on_wield(), object_notice_sensing(), object_notice_slays(), object_pseudo(), object_stackable(), object_this_mod_is_visible(), object_value(), object_was_sensed(), object_was_worn(), option_set(), option_toggle_handle(), pack_is_full(), pack_is_overfull(), panel_contains(), parse_act_aim(), parse_artifact_flags(), parse_artifact_values(), parse_ego_flags(), parse_ego_min_val(), parse_ego_type(), parse_ego_values(), parse_lore_t(), parse_object_base_flags(), parse_object_flags(), parse_object_values(), parse_p_race_values(), parse_prefs_gf(), parse_prefs_load(), parse_prefs_window(), parse_random(), parser_hasval(), pick_and_place_distant_monster(), pick_trap(), pile_contains(), place_friends(), place_monster(), place_monster_base_okay(), place_new_monster(), place_new_monster_group(), place_object(), player_book_has_unlearned_spells(), player_can_cast(), player_can_cast_prereq(), player_can_fire(), player_can_fire_prereq(), player_can_read(), player_can_read_prereq(), player_can_refuel(), player_can_refuel_prereq(), player_can_see_bold(), player_can_study(), player_can_study_prereq(), player_confuse_dir(), player_exp_gain(), player_exp_lose(), player_has_los_bold(), player_outfit(), player_pickup_aux(), player_pickup_gold(), player_pickup_item(), player_resting_cancel(), player_resting_is_special(), player_set_food(), player_set_timed(), player_stat_inc(), player_update_light(), possible_doorway(), prefix(), prefix_i(), prefs_save(), process_character_pref_files(), process_command(), process_monster(), process_monster_can_move(), process_monster_glyph(), process_monster_grab_objects(), process_monster_multiply(), process_monster_should_stagger(), process_monster_timed(), process_monster_try_push(), process_monsters(), process_pref_file(), process_pref_file_command(), process_pref_file_expr(), process_pref_file_layered(), process_world(), project(), project_feature_handler_DARK_WEAK(), project_feature_handler_KILL_DOOR(), project_feature_handler_KILL_TRAP(), project_feature_handler_KILL_WALL(), project_feature_handler_LIGHT_WEAK(), project_feature_handler_MAKE_DOOR(), project_m(), project_m_apply_side_effects(), project_m_monster_attack(), project_m_player_attack(), project_monster_dispel(), project_monster_handler_CHAOS(), project_monster_handler_DISEN(), project_monster_handler_NEXUS(), project_monster_handler_PLASMA(), project_monster_scare(), project_monster_teleport_away(), project_o(), project_object_elemental(), project_object_handler_HOLY_ORB(), project_object_handler_KILL_DOOR(), project_object_handler_KILL_TRAP(), project_object_handler_MANA(), project_p(), project_player_handler_CHAOS(), project_player_handler_DARK(), project_player_handler_FORCE(), project_player_handler_GRAVITY(), project_player_handler_ICE(), project_player_handler_INERTIA(), project_player_handler_LIGHT(), project_player_handler_PLASMA(), project_player_handler_POIS(), project_player_handler_SHARD(), project_player_handler_SOUND(), project_player_handler_WATER(), projectable(), py_attack(), py_attack_real(), quality_action(), quest_check(), rand_fix(), randcalc_valid(), randname_make(), random_high_resist(), ranged_helper(), rd_dungeon(), rd_ignore(), rd_item(), rd_misc(), rd_monster(), rd_object_memory(), rd_objects_aux(), rd_traps_aux(), react_to_slay(), react_to_specific_slay(), ReadDIB2_PNG(), recharge_objects(), recharge_timeout(), recharged_notice(), redundant_monster_message(), refill_lamp(), region_inside(), remove_all_curse(), remove_bad_spells(), remove_old_dump(), roll_hp(), roller_command(), room_build(), run_game_loop(), run_init(), run_step(), run_test(), save_game(), savefile_load(), savefile_save(), SaveWindow_PNG(), scan_items(), scatter(), scramble_artifact(), search(), see_floor_items(), see_wall(), seen_tval(), sell_stat(), set_cut(), set_del(), set_stun(), setup_menus(), show_equip(), show_file(), show_inven(), show_obj_list(), show_quiver(), slays_are_equal(), slot_type_is(), spell_cast(), spell_identify_unknown_available(), spell_menu_browse(), spell_menu_handler(), spell_menu_select(), spell_okay_list(), spoil_artifact(), spoil_mon_info(), spoil_obj_desc(), spread_monsters(), square_changeable(), square_dtrap_edge(), square_is_granite_with_flag(), square_isplayer(), square_isstart(), square_remove_ward(), square_trap_flag(), square_trap_specific(), square_verify_trap(), start_game(), store_can_carry(), store_check_num(), store_create_random(), store_display_help(), store_get_check(), store_get_stock(), store_is_staple(), store_menu_handle(), store_object_absorb(), store_process_command_key(), store_purchase(), store_sell(), store_stock_list(), store_will_buy(), strescape(), summon_possible(), summon_specific(), summon_specific_okay(), sval_menu(), take_hit(), target_accept(), target_okay(), target_set_closest(), target_set_interactive(), target_set_interactive_aux(), target_set_location(), target_set_monster(), Term_activate(), Term_clear(), term_data_link(), term_init(), Term_inkey(), Term_redraw(), Term_resize(), test_breakage_chance(), test_drop_eat(), test_drop_pickup(), test_loadgame(), test_newgame(), test_obj_can_refill(), test_obj_piles(), test_prefs(), test_spells(), test_stairs1(), test_stairs2(), test_stat_dec(), textui_action_menu_choose(), textui_cmd_ignore_menu(), textui_do_birth(), textui_get_aim_dir(), textui_get_check(), textui_get_command(), textui_get_item(), textui_get_rep_dir(), textui_panel_contains(), textui_process_command(), textui_process_key(), textui_store_knowledge(), textui_target_closest(), tile_picker_command(), town_gen(), trap_check_hit(), try_load(), try_save(), tval_can_have_failure(), tval_can_have_flavor_k(), tval_has_ignore_type(), tval_has_variable_power(), tval_is_ammo(), tval_is_armor(), tval_is_body_armor(), tval_is_book_k(), tval_is_edible(), tval_is_melee_weapon(), tval_is_useable(), tval_is_weapon(), tval_is_wearable(), twall(), ui_keymap_create(), ui_leave_birthscreen(), ui_leave_game(), ui_leave_init(), update_bonuses(), update_minimap_subwindow(), update_mon(), update_one(), update_sidebar(), update_stuff(), use_aux(), vault_monsters(), visuals_reset(), vstrnfmt(), wiz_cheat_death(), wiz_create_item_action(), wiz_create_item_display(), wiz_create_item_subaction(), wiz_create_item_subdisplay(), wiz_reroll_item(), wiz_statistics(), wiz_test_kind(), and wiz_tweak_item().

#define UNIX

Extract the "WINDOWS" flag from the compiler.

Define UNIX if our OS is UNIXy

Typedef Documentation

typedef char bool

Use a real bool type where possible.

typedef unsigned char byte

Use guaranteed-size ints where possible.

typedef int errr

ANSI C headers.

POSIX headers

Define the basic game types

errr is an error code

A "byte" is an unsigned byte of memory. s16b/u16b are exactly 2 bytes (where possible) s32b/u32b are exactly 4 bytes (where possible) C++ defines its own bool type, so we hack around it

typedef signed short s16b
typedef signed long s32b
typedef unsigned short u16b
typedef unsigned long u32b