Angband
Data Structures | Functions | Variables
init.h File Reference

initialization More...

#include "h-basic.h"
#include "z-bitflag.h"
#include "z-file.h"
#include "z-rand.h"
#include "datafile.h"
#include "object.h"

Go to the source code of this file.

Data Structures

struct  angband_constants
 Information about maximal indices of certain arrays. More...
 
struct  init_module
 

Functions

struct parserinit_parse_artifact (void)
 
struct parserinit_parse_class (void)
 
struct parserinit_parse_ego (void)
 
struct parserinit_parse_feat (void)
 
struct parserinit_parse_history (void)
 
struct parserinit_parse_object (void)
 
struct parserinit_parse_object_base (void)
 
struct parserinit_parse_pain (void)
 
struct parserinit_parse_p_race (void)
 
struct parserinit_parse_pit (void)
 
struct parserinit_parse_monster (void)
 
struct parserinit_parse_vault (void)
 
struct parserinit_parse_constants (void)
 
struct parserinit_parse_flavor (void)
 
struct parserinit_parse_names (void)
 
struct parserinit_parse_hints (void)
 
struct parserinit_parse_trap (void)
 
struct parserinit_parse_quest (void)
 
errr grab_effect_data (struct parser *p, struct effect *effect)
 
void init_file_paths (const char *config, const char *lib, const char *data)
 Find the default paths to all of our important sub-directories. More...
 
void init_game_constants (void)
 Initialize game constants. More...
 
void init_arrays (void)
 Initialize just the internal arrays. More...
 
void create_needed_dirs (void)
 Create any missing directories. More...
 
bool init_angband (void)
 Initialise Angband's data stores and allocate memory for structures, etc, so that the game can get started. More...
 
void cleanup_angband (void)
 Free all the stuff initialised in init_angband() More...
 

Variables

const char * list_element_names []
 
const char * list_obj_flag_names []
 
struct angband_constantsz_info
 Structure (not array) of game constants. More...
 
const char * ANGBAND_SYS
 
char * ANGBAND_DIR_GAMEDATA
 Various directories. More...
 
char * ANGBAND_DIR_CUSTOMIZE
 
char * ANGBAND_DIR_HELP
 
char * ANGBAND_DIR_SCREENS
 
char * ANGBAND_DIR_FONTS
 
char * ANGBAND_DIR_TILES
 
char * ANGBAND_DIR_SOUNDS
 
char * ANGBAND_DIR_ICONS
 
char * ANGBAND_DIR_USER
 
char * ANGBAND_DIR_SAVE
 
char * ANGBAND_DIR_SCORES
 
char * ANGBAND_DIR_INFO
 
char * ANGBAND_DIR_ARCHIVE
 
struct file_parser flavor_parser
 

Detailed Description

initialization

Copyright (c) 2000 Robert Ruehlmann

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.

Function Documentation

void cleanup_angband ( void  )
void create_needed_dirs ( void  )

Create any missing directories.

We create only those dirs which may be empty (user/, save/, scores/, info/, help/). The others are assumed to contain required files and therefore must exist at startup (edit/, pref/, file/, xtra/).

ToDo: Only create the directories when actually writing files.

References ANGBAND_DIR_ARCHIVE, ANGBAND_DIR_HELP, ANGBAND_DIR_INFO, ANGBAND_DIR_SAVE, ANGBAND_DIR_SCORES, ANGBAND_DIR_USER, dir_create(), path_build(), and quit_fmt().

Referenced by main().

errr grab_effect_data ( struct parser p,
struct effect effect 
)
bool init_angband ( void  )

Initialise Angband's data stores and allocate memory for structures, etc, so that the game can get started.

The only input/output in this file should be via event_signal_string(). We cannot rely on any particular UI as this part should be UI-agnostic. We also cannot rely on anything else having being initialised into any particlar state. Which is why you'd be calling this function in the first place.

Old comment, not sure if still accurate: Note that the "graf-xxx.prf" file must be loaded separately, if needed, in the first (?) pass through "TERM_XTRA_REACT".

References EVENT_ENTER_INIT, EVENT_INITSTATUS, event_signal(), event_signal_message(), i, init_module::init, init_game_constants(), monster_list_init(), object_list_init(), and Rand_init().

Referenced by main(), and setup_tests().

void init_arrays ( void  )

Initialize just the internal arrays.

This should be callable by the test suite, without relying on input, or anything to do with a user or savefiles.

Assumption: Paths are set up correctly before calling this function.

References EVENT_INITSTATUS, event_signal_message(), format(), i, msg, N_ELEMENTS, pl, quit_fmt(), run_parser(), string_free(), and string_make().

Referenced by read_edit_files().

void init_file_paths ( const char *  configpath,
const char *  libpath,
const char *  datapath 
)

Find the default paths to all of our important sub-directories.

All of the sub-directories should, by default, be located inside the main directory, whose location is very system dependent and is set by the ANGBAND_PATH environment variable, if it exists. (On multi- user systems such as Linux this is not the default - see config.h for more info.)

This function takes a writable buffers, initially containing the "path" to the "config", "lib" and "data" directories, for example, "/etc/angband/", "/usr/share/angband" and "/var/games/angband" - or a system dependent string, for example, ":lib:". The buffer must be large enough to contain at least 32 more characters.

Various command line options may allow some of the important directories to be changed to user-specified directories, most importantly, the "scores" and "user" and "save" directories, but this is done after this function, see "main.c".

In general, the initial path should end in the appropriate "PATH_SEP" string. All of the "sub-directory" paths (created below or supplied by the user) will NOT end in the "PATH_SEP" string, see the special "path_build()" function in "util.c" for more information.

Hack – first we free all the strings, since this is known to succeed even if the strings have not been allocated yet, as long as the variables start out as "NULL". This allows this function to be called multiple times, for example, to try several base "path" values until a good one is found.

References ANGBAND_DIR_ARCHIVE, ANGBAND_DIR_CUSTOMIZE, ANGBAND_DIR_FONTS, ANGBAND_DIR_GAMEDATA, ANGBAND_DIR_HELP, ANGBAND_DIR_ICONS, ANGBAND_DIR_INFO, ANGBAND_DIR_SAVE, ANGBAND_DIR_SCORES, ANGBAND_DIR_SCREENS, ANGBAND_DIR_SOUNDS, ANGBAND_DIR_TILES, ANGBAND_DIR_USER, ANGBAND_SYS, buf, BUILD_DIRECTORY_PATH, my_strcpy(), NULL, path_build(), PATH_SEP, string_free(), string_make(), suffix(), and VERSION_NAME.

Referenced by init_stuff(), and set_file_paths().

void init_game_constants ( void  )

Initialize game constants.

Assumption: Paths are set up correctly before calling this function.

References EVENT_INITSTATUS, event_signal_message(), quit_fmt(), and run_parser().

Referenced by init_angband(), and read_edit_files().

struct parser* init_parse_artifact ( void  )
struct parser* init_parse_class ( void  )
struct parser* init_parse_constants ( void  )
struct parser* init_parse_ego ( void  )
struct parser* init_parse_feat ( void  )
struct parser* init_parse_flavor ( void  )
struct parser* init_parse_hints ( void  )
struct parser* init_parse_history ( void  )
struct parser* init_parse_monster ( void  )
struct parser* init_parse_names ( void  )
struct parser* init_parse_object ( void  )
struct parser* init_parse_object_base ( void  )
struct parser* init_parse_p_race ( void  )
struct parser* init_parse_pain ( void  )
struct parser* init_parse_pit ( void  )
struct parser* init_parse_quest ( void  )
struct parser* init_parse_trap ( void  )
struct parser* init_parse_vault ( void  )

Variable Documentation

char* ANGBAND_DIR_ARCHIVE
char* ANGBAND_DIR_CUSTOMIZE
char* ANGBAND_DIR_FONTS

Referenced by cleanup_angband(), and init_file_paths().

char* ANGBAND_DIR_GAMEDATA

Various directories.

These are no longer necessarily all subdirs of "lib"

Referenced by cleanup_angband(), init_file_paths(), and parse_file().

char* ANGBAND_DIR_HELP
char* ANGBAND_DIR_ICONS

Referenced by cleanup_angband(), and init_file_paths().

char* ANGBAND_DIR_INFO
char* ANGBAND_DIR_SAVE
char* ANGBAND_DIR_SCORES
char* ANGBAND_DIR_SCREENS
char* ANGBAND_DIR_SOUNDS
char* ANGBAND_DIR_TILES
char* ANGBAND_DIR_USER
const char* ANGBAND_SYS
struct file_parser flavor_parser

Referenced by flavor_init().

const char* list_element_names[]
const char* list_obj_flag_names[]
struct angband_constants* z_info

Structure (not array) of game constants.

Referenced by add_activation(), add_curse(), add_monster_lights(), alloc_init_egos(), alloc_init_objects(), append_artifact_curse(), append_object_curse(), append_random_brand(), append_random_slay(), apply_curse(), artifact_prep(), artifact_set_data_new(), blow_color(), blow_index(), brand_count(), brand_object(), build_store(), build_tunnel(), build_vault(), calc_inventory(), cave_generate(), cave_new(), cavern_gen(), check_artifact_curses(), check_object_curses(), choose_profile(), chunk_copy(), classic_gen(), cleanup_act(), cleanup_artifact(), cleanup_brand(), cleanup_curse(), cleanup_ego(), cleanup_lore(), cleanup_monster(), cleanup_object(), cleanup_object_power(), cleanup_object_property(), cleanup_pain(), cleanup_pits(), cleanup_profile(), cleanup_projection(), cleanup_quest(), cleanup_slay(), collect_artifact_data(), collect_known_artifacts(), collect_slay_brand_stats(), copy_artifact(), copy_brands(), copy_curses(), copy_slays(), count_known_monsters(), create_obj_flag_mask(), curse_menu(), curses_are_equal(), decrease_timeouts(), describe_brands(), describe_curses(), describe_damage(), describe_slays(), design_artifact(), display_feeling(), do_cmd_alter_aux(), do_cmd_autopickup(), do_cmd_buy(), do_cmd_cast(), do_cmd_close(), do_cmd_disarm(), do_cmd_drop(), do_cmd_fire(), do_cmd_fire_at_nearest(), do_cmd_go_down(), do_cmd_go_up(), do_cmd_hold(), do_cmd_jump(), do_cmd_knowledge_artifacts(), do_cmd_knowledge_ego_items(), do_cmd_knowledge_features(), do_cmd_knowledge_monsters(), do_cmd_knowledge_traps(), do_cmd_open(), do_cmd_pickup(), do_cmd_query_symbol(), do_cmd_refill(), do_cmd_sleep(), do_cmd_study_book(), do_cmd_study_spell(), do_cmd_takeoff(), do_cmd_tunnel(), do_cmd_walk(), do_cmd_wiz_jump(), do_cmd_wiz_learn(), do_randart(), drop_find_grid(), dump_autoinscriptions(), dump_features(), dump_monsters(), dump_objects(), dungeon_get_next_level(), effect_handler_BREATH(), effect_handler_CURSE_ARMOR(), effect_handler_CURSE_WEAPON(), effect_handler_DEEP_DESCENT(), effect_handler_MASS_BANISH(), effect_handler_TELEPORT(), effect_handler_TELEPORT_LEVEL(), effect_handler_WAKE(), ego_menu(), find_cave_profile(), find_space(), finish_parse_act(), finish_parse_artifact(), finish_parse_brand(), finish_parse_curse(), finish_parse_eff(), finish_parse_ego(), finish_parse_lore(), finish_parse_meth(), finish_parse_monster(), finish_parse_object(), finish_parse_object_power(), finish_parse_object_property(), finish_parse_pain(), finish_parse_pit(), finish_parse_profile(), finish_parse_projection(), finish_parse_quest(), finish_parse_randart(), finish_parse_slay(), flavor_assign_fixed(), flavor_assign_random(), flavor_init(), flavor_set_all_aware(), floor_carry(), gauntlet_gen(), gear_to_label(), get_base_item(), get_debug_command(), get_mon_num(), get_money(), get_move(), get_move_find_range(), get_obj_num(), get_obj_num_by_kind(), hallucinatory_monster(), hallucinatory_object(), hard_centre_gen(), ignore_birth_init(), ignore_collect_kind(), improve_attack_modifier(), init_ignore(), init_player(), init_race_allocs(), init_rune(), inven_carry(), inven_carry_num(), inven_wield(), is_daytime(), is_quest(), item_menu_browser(), item_tester_uncursable(), labyrinth_gen(), lair_gen(), load_roller_data(), lookup_artifact_name(), lookup_curse(), lookup_ego_item(), lookup_feat(), lookup_kind(), lookup_monster(), lookup_obj_property(), lookup_sval(), lookup_symbol(), lookup_trap(), lore_append_attack(), lore_is_fully_known(), lore_update(), make_artifact(), make_artifact_special(), make_attack_normal(), make_attack_spell(), make_ego_item(), melee_effect_experience(), melee_effect_handler_DRAIN_CHARGES(), melee_effect_handler_EAT_FOOD(), melee_effect_handler_EAT_ITEM(), modified_gen(), mon_create_drop(), mon_pop(), mon_restrict(), mon_summary(), money_kind(), monster_turn_glyph(), monster_turn_multiply(), moria_gen(), new_level_display_update(), obj_has_flag(), obj_known_damage(), obj_known_light(), obj_known_misc_combat(), object_copy(), object_curses_find_element(), object_curses_find_flags(), object_curses_find_modifiers(), object_curses_find_to_a(), object_curses_find_to_d(), object_curses_find_to_h(), object_has_rune(), object_info_ego(), object_is_in_quiver(), object_learn_brand(), object_learn_slay(), object_power(), object_power_calculation_ALL_BRANDS(), object_power_calculation_ALL_KILLS(), object_power_calculation_ALL_SLAYS(), object_prep(), object_runes_known(), objkind_byid(), on_new_level(), pack_is_full(), pack_is_overfull(), pack_overflow(), pack_slots_used(), parse_artifact_act(), parse_artifact_brand(), parse_artifact_curse(), parse_artifact_info(), parse_artifact_slay(), parse_artifact_time(), parse_ego_brand(), parse_ego_curse(), parse_ego_slay(), parse_ego_type(), parse_lore_blow(), parse_mon_base_pain(), parse_monster_hearing(), parse_monster_smell(), parse_object_brand(), parse_object_curse(), parse_object_power_type(), parse_object_slay(), parse_prefs_feat(), parse_prefs_monster_base(), parse_prefs_object(), parse_prefs_trap(), parse_vault_max_depth(), path_analyse(), pick_trap(), place_feeling(), place_stairs(), place_trap(), player_book_has_unlearned_spells(), player_init(), player_know_object(), player_knows_ego(), player_knows_rune(), player_learn_rune(), player_pickup_item(), player_quests_free(), player_quests_reset(), player_resting_step_turn(), player_set_recall_depth(), process_monsters(), process_world(), project(), project_player_handler_CHAOS(), project_player_handler_NETHER(), project_player_handler_TIME(), projectable(), prt_level_feeling(), push_object(), py_attack(), quest_check(), quiver_absorb_num(), ranged_helper(), rd_artifacts(), rd_chunks(), rd_dungeon(), rd_item(), rd_monster_memory(), rd_monsters_aux(), rd_object_memory(), rd_player(), rd_quests(), rd_stores_aux(), react_to_slay(), recalculate_stats(), refill_lamp(), refresh_stock(), remove_object_curse(), reset_visuals(), restore_monsters(), room_build(), run_game_loop(), run_step(), scan_items(), see_floor_items(), seen_tval(), set_pit_type(), setup_tests(), show_equip(), show_floor(), show_inven(), show_obj_list(), show_quiver(), slay_count(), spell_value_base_max_sight(), spoil_artifact(), spoil_mon_desc(), spoil_mon_info(), spoil_obj_desc(), square_add_stairs(), store_base_power(), store_carry(), store_create_random(), store_menu_init(), store_new(), store_update(), target_set_interactive(), target_set_interactive_aux(), teardown_tests(), test_defaults(), textui_browse_knowledge(), textui_browse_object_knowledge(), textui_get_item(), textui_prefs_init(), town_gen(), town_gen_layout(), try_supercharge(), turn_energy(), tval_sval_count(), tval_sval_list(), update_one(), update_player_object_knowledge(), update_view_one(), use_aux(), use_store(), wiz_create_item(), wiz_create_item_all_items(), wr_artifacts(), wr_chunks(), wr_ignore(), wr_item(), wr_misc(), wr_monster_memory(), wr_object_memory(), wr_quests(), write_character_dump(), write_curse_kinds(), write_dummy_object_record(), and write_lore_entries().