Angband
Functions | Variables
cave.c File Reference

chunk allocation and utility functions More...

#include "angband.h"
#include "cave.h"
#include "cmds.h"
#include "cmd-core.h"
#include "game-event.h"
#include "game-world.h"
#include "init.h"
#include "monster.h"
#include "obj-ignore.h"
#include "obj-pile.h"
#include "obj-tval.h"
#include "obj-util.h"
#include "object.h"
#include "player-timed.h"
#include "trap.h"

Functions

int motion_dir (struct loc start, struct loc finish)
 Given a "start" and "finish" location, extract a "direction", which will move one step from the "start" towards the "finish". More...
 
int lookup_feat (const char *name)
 Find a terrain feature index by name. More...
 
void set_terrain (void)
 Set terrain constants to the indices from terrain.txt. More...
 
struct chunkcave_new (int height, int width)
 Allocate a new chunk of the world. More...
 
void cave_free (struct chunk *c)
 Free a chunk. More...
 
void list_object (struct chunk *c, struct object *obj)
 Enter an object in the list of objects for the current level/chunk. More...
 
void delist_object (struct chunk *c, struct object *obj)
 Remove an object from the list of objects for the current level/chunk. More...
 
void object_lists_check_integrity (struct chunk *c, struct chunk *c_k)
 Check that a pair of object lists are consistent and relate to locations of objects correctly. More...
 
void scatter (struct chunk *c, int *yp, int *xp, int y, int x, int d, bool need_los)
 Standard "find me a location" function, now with all legal outputs! More...
 
struct monstercave_monster (struct chunk *c, int idx)
 Get a monster on the current level by its index. More...
 
int cave_monster_max (struct chunk *c)
 The maximum number of monsters allowed in the level. More...
 
int cave_monster_count (struct chunk *c)
 The current number of monsters present on the level. More...
 
int count_feats (int *y, int *x, bool(*test)(struct chunk *c, int y, int x), bool under)
 Return the number of doors/traps around (or under) the character. More...
 
struct loc cave_find_decoy (struct chunk *c)
 

Variables

struct featuref_info
 
struct chunkcave = NULL
 
int FEAT_NONE
 
int FEAT_FLOOR
 
int FEAT_CLOSED
 
int FEAT_OPEN
 
int FEAT_BROKEN
 
int FEAT_LESS
 
int FEAT_MORE
 
int FEAT_SECRET
 
int FEAT_RUBBLE
 
int FEAT_PASS_RUBBLE
 
int FEAT_MAGMA
 
int FEAT_QUARTZ
 
int FEAT_MAGMA_K
 
int FEAT_QUARTZ_K
 
int FEAT_GRANITE
 
int FEAT_PERM
 
int FEAT_LAVA
 
const s16b ddd [9]
 Global array for looping through the "keypad directions". More...
 
const s16b ddx [10]
 Global arrays for converting "keypad direction" into "offsets". More...
 
const s16b ddy [10]
 
const s16b ddx_ddd [9]
 Global arrays for optimizing "ddx[ddd[i]]" and "ddy[ddd[i]]". More...
 
const s16b ddy_ddd [9]
 
static const int d_off_y_0 []
 Hack – Precompute a bunch of calls to distance(). More...
 
static const int d_off_x_0 []
 
static const int d_off_y_1 []
 
static const int d_off_x_1 []
 
static const int d_off_y_2 []
 
static const int d_off_x_2 []
 
static const int d_off_y_3 []
 
static const int d_off_x_3 []
 
static const int d_off_y_4 []
 
static const int d_off_x_4 []
 
static const int d_off_y_5 []
 
static const int d_off_x_5 []
 
static const int d_off_y_6 []
 
static const int d_off_x_6 []
 
static const int d_off_y_7 []
 
static const int d_off_x_7 []
 
static const int d_off_y_8 []
 
static const int d_off_x_8 []
 
static const int d_off_y_9 []
 
static const int d_off_x_9 []
 
const intdist_offsets_y [10]
 
const intdist_offsets_x [10]
 
const byte side_dirs [20][8]
 Given a central direction at position [dir #][0], return a series of directions radiating out on both sides from the central direction all the way back to its rear. More...
 

Detailed Description

chunk allocation and utility functions

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

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": 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.

Function Documentation

◆ cave_find_decoy()

struct loc cave_find_decoy ( struct chunk c)

◆ cave_free()

void cave_free ( struct chunk c)

◆ cave_monster()

struct monster* cave_monster ( struct chunk c,
int  idx 
)

Get a monster on the current level by its index.

References chunk::monsters.

Referenced by add_monster_lights(), call_monster(), chunk_copy(), compact_monsters(), compact_monsters_aux(), delete_monster_idx(), detect_monsters(), do_animation(), do_cmd_walk_test(), do_cmd_wiz_zap(), do_mon_spell(), effect_handler_BALL(), effect_handler_BANISH(), effect_handler_BREATH(), effect_handler_DAMAGE(), effect_handler_DRAIN_MANA(), effect_handler_MASS_BANISH(), effect_handler_MON_HEAL_HP(), effect_handler_MON_HEAL_KIN(), effect_handler_MON_TIMED_INC(), effect_handler_PROBE(), effect_handler_PROJECT_LOS(), effect_handler_PROJECT_LOS_AWARE(), effect_handler_READ_MINDS(), effect_handler_SINGLE_COMBAT(), effect_handler_SUMMON(), effect_handler_TELEPORT(), effect_handler_TELEPORT_TO(), effect_handler_TOUCH(), effect_handler_WAKE(), find_artifact(), get_commanded_monster(), get_target(), grid_data_as_text(), kill_arena_monster(), look_mon_desc(), map_info(), mon_pop(), monster_blow_method_action(), monster_list_collect(), monster_list_show_subwindow(), monster_swap(), monster_target_monster(), move_player(), origin_get_loc(), place_monster(), player_inc_check(), process_monsters(), process_player_cleanup(), project_m(), project_o(), project_p(), project_player_handler_NEXUS(), reset_monsters(), restore_monsters(), spell_message(), spell_value_base_spell_power(), square_monster(), steal_monster_item(), target_get_monster(), target_okay(), target_sighted(), update_monsters(), wipe_mon_list(), and wr_monsters_aux().

◆ cave_monster_count()

int cave_monster_count ( struct chunk c)

The current number of monsters present on the level.

References chunk::mon_cnt.

Referenced by process_world().

◆ cave_monster_max()

int cave_monster_max ( struct chunk c)

◆ cave_new()

struct chunk* cave_new ( int  height,
int  width 
)

◆ count_feats()

int count_feats ( int y,
int x,
bool(*)(struct chunk *c, int y, int x)  test,
bool  under 
)

Return the number of doors/traps around (or under) the character.

References ddx_ddd, ddy_ddd, player::px, player::py, square_in_bounds_fully(), and square_isknown().

Referenced by do_cmd_close(), do_cmd_disarm(), do_cmd_open(), and effect_handler_RUBBLE().

◆ delist_object()

void delist_object ( struct chunk c,
struct object obj 
)

Remove an object from the list of objects for the current level/chunk.

This function is robust against delisting of unlisted objects.

References player::cave, chunk::objects, and object::oidx.

Referenced by become_aware(), delete_monster_idx(), floor_carry(), floor_carry_fail(), floor_object_for_use(), monster_turn_grab_objects(), player_pickup_aux(), player_pickup_gold(), project_o(), square_know_pile(), steal_monster_item(), and uncurse_object().

◆ list_object()

void list_object ( struct chunk c,
struct object obj 
)

Enter an object in the list of objects for the current level/chunk.

This function is robust against listing of duplicates or non-objects

References player::cave, i, mem_realloc(), chunk::obj_max, OBJECT_LIST_INCR, chunk::objects, and object::oidx.

Referenced by floor_carry(), mon_create_mimicked_object(), monster_carry(), place_gold(), and place_object().

◆ lookup_feat()

int lookup_feat ( const char *  name)

Find a terrain feature index by name.

References angband_constants::f_max, i, feature::name, quit_fmt(), streq, and z_info.

Referenced by map_info(), parse_prefs_feat(), set_terrain(), and square_apparent_name().

◆ motion_dir()

int motion_dir ( struct loc  start,
struct loc  finish 
)

Given a "start" and "finish" location, extract a "direction", which will move one step from the "start" towards the "finish".

Note that we use "diagonal" motion whenever possible.

We return DIR_NONE if no motion is needed.

References DIR_E, DIR_N, DIR_NE, DIR_NONE, DIR_NW, DIR_S, DIR_SE, DIR_SW, DIR_W, loc_eq(), loc::x, and loc::y.

Referenced by coords_to_dir().

◆ object_lists_check_integrity()

void object_lists_check_integrity ( struct chunk c,
struct chunk c_k 
)

Check that a pair of object lists are consistent and relate to locations of objects correctly.

References i, object::ix, object::iy, object::known, square::obj, chunk::obj_max, chunk::objects, object::oidx, pile_contains(), player_upkeep::playing, chunk::squares, and player::upkeep.

Referenced by square_know_pile().

◆ scatter()

void scatter ( struct chunk c,
int yp,
int xp,
int  y,
int  x,
int  d,
bool  need_los 
)

Standard "find me a location" function, now with all legal outputs!

Obtains a legal location within the given distance of the initial location, and with "los()" from the source to destination location.

This function is often called from inside a loop which searches for locations while increasing the "d" distance.

need_los determines whether line of sight is needed

References distance(), loc(), los(), rand_spread, and square_in_bounds_fully().

Referenced by build_quest_stairs(), do_cmd_wiz_named(), multiply_monster(), place_friends(), summon_specific(), and vault_monsters().

◆ set_terrain()

void set_terrain ( void  )

Variable Documentation

◆ cave

struct chunk* cave = NULL

Referenced by acquirement(), autoinscribe_ground(), become_aware(), blow_after_effects(), blow_knock_back(), build_quest_stairs(), call_monster(), can_call_monster(), cave_known(), cave_light(), cave_room_aux(), cave_unlight(), chest_check(), chest_death(), cleanup_angband(), close_game(), compact_monsters(), compact_monsters_aux(), context_menu_cave(), context_menu_object(), context_menu_player(), decrease_timeouts(), delete_monster(), delete_monster_idx(), detect_monsters(), display_feeling(), display_map(), do_animation(), do_autopickup(), do_cmd_alter_aux(), do_cmd_buy(), do_cmd_close(), do_cmd_close_aux(), do_cmd_close_test(), do_cmd_disarm(), do_cmd_disarm_aux(), do_cmd_disarm_test(), do_cmd_go_down(), do_cmd_go_up(), do_cmd_hold(), do_cmd_lock_door(), do_cmd_mon_command(), do_cmd_open(), do_cmd_open_aux(), do_cmd_open_chest(), do_cmd_open_test(), do_cmd_retrieve(), do_cmd_sell(), do_cmd_stash(), do_cmd_tunnel(), do_cmd_tunnel_aux(), do_cmd_tunnel_test(), do_cmd_walk(), do_cmd_walk_test(), do_cmd_wiz_bamf(), do_cmd_wiz_features(), do_cmd_wiz_hack_nick(), do_cmd_wiz_named(), do_cmd_wiz_query(), do_cmd_wiz_zap(), do_mon_spell(), draw_path(), drop_find_grid(), drop_near(), effect_handler_BALL(), effect_handler_BANISH(), effect_handler_BREATH(), effect_handler_CREATE_STAIRS(), effect_handler_DAMAGE(), effect_handler_DARKEN_AREA(), effect_handler_DARKEN_LEVEL(), effect_handler_DESTRUCTION(), effect_handler_DETECT_DOORS(), effect_handler_DETECT_GOLD(), effect_handler_DETECT_OBJECTS(), effect_handler_DETECT_STAIRS(), effect_handler_DETECT_TRAPS(), effect_handler_DRAIN_MANA(), effect_handler_EARTHQUAKE(), effect_handler_GLYPH(), effect_handler_JUMP_AND_BITE(), effect_handler_LIGHT_LEVEL(), effect_handler_MAP_AREA(), effect_handler_MASS_BANISH(), effect_handler_MON_HEAL_HP(), effect_handler_MON_HEAL_KIN(), effect_handler_MON_TIMED_INC(), effect_handler_PROBE(), effect_handler_PROJECT_LOS(), effect_handler_PROJECT_LOS_AWARE(), effect_handler_READ_MINDS(), effect_handler_RUBBLE(), effect_handler_SENSE_OBJECTS(), effect_handler_SINGLE_COMBAT(), effect_handler_SUMMON(), effect_handler_TELEPORT(), effect_handler_TELEPORT_LEVEL(), effect_handler_TELEPORT_TO(), effect_handler_TIMED_INC(), effect_handler_TOUCH(), effect_handler_WAKE(), enter_store(), fill_terrain_info(), find_artifact(), findpath(), floor_carry_fail(), floor_object_for_use(), get_commanded_monster(), get_debug_command(), get_panel_skills(), get_target(), grid_data_as_text(), hit_trap(), hp_colour_change(), ignore_drop(), ignore_known_item_ok(), inven_drop(), is_valid_pf(), item_is_available(), kill_arena_monster(), light_room(), look_mon_desc(), make_attack_spell(), make_noise(), make_ranged_shot(), make_ranged_throw(), map_info(), melee_effect_handler_EAT_GOLD(), modify_panel(), monster_attack_monster(), monster_blow_method_action(), monster_can_cast(), monster_death(), monster_list_can_update(), monster_list_collect(), monster_list_new(), monster_list_reset(), monster_list_show_subwindow(), monster_swap(), monster_take_terrain_damage(), monster_target_monster(), move_player(), no_light(), object_delete(), object_flavor_aware(), object_list_collect(), object_list_entry_line_attribute(), object_list_format_name(), object_list_should_ignore_object(), object_list_standard_compare(), origin_get_loc(), pack_overflow(), panel_should_modify(), path_analyse(), player_attack_random_monster(), player_check_terrain_damage(), player_inc_check(), player_know_object(), player_pickup_aux(), player_pickup_gold(), player_pickup_item(), player_take_terrain_damage(), prepare_next_level(), process_player_cleanup(), project(), project_feature_handler_ACID(), project_feature_handler_ARROW(), project_feature_handler_CHAOS(), project_feature_handler_COLD(), project_feature_handler_DARK_WEAK(), project_feature_handler_DISEN(), project_feature_handler_ELEC(), project_feature_handler_FIRE(), project_feature_handler_FORCE(), project_feature_handler_GRAVITY(), project_feature_handler_HOLY_ORB(), project_feature_handler_ICE(), project_feature_handler_INERTIA(), 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_feature_handler_MAKE_TRAP(), project_feature_handler_MANA(), project_feature_handler_METEOR(), project_feature_handler_MISSILE(), project_feature_handler_NETHER(), project_feature_handler_NEXUS(), project_feature_handler_PLASMA(), project_feature_handler_POIS(), project_feature_handler_SHARD(), project_feature_handler_SOUND(), project_feature_handler_TIME(), project_feature_handler_WATER(), project_m(), project_m_apply_side_effects(), project_monster_handler_MON_CLONE(), project_o(), project_p(), project_path(), project_player_handler_NEXUS(), prt_dtrap(), prt_level_feeling(), prt_map(), prt_map_aux(), push_object(), py_attack(), py_attack_real(), ranged_helper(), rd_dungeon(), rd_monsters(), rd_objects(), rd_traps(), rd_traps_aux(), recharge_objects(), refill_lamp(), remove_bad_spells(), reset_monsters(), restore_monsters(), run_game_loop(), run_step(), run_test(), rune_autoinscribe(), scan_distant_floor(), scan_floor(), search(), see_wall(), show_obj(), spell_chance(), spell_message(), spell_value_base_dungeon_level(), spell_value_base_spell_power(), square_forget(), square_isknown(), square_isnotknown(), square_know_pile(), square_light_spot(), square_memorize(), square_note_spot(), square_sense_pile(), start_game(), steal_monster_item(), steal_player_item(), store_at(), store_will_buy_tester(), summon_possible(), summon_specific(), take1(), target_able(), target_accept(), target_get_monster(), target_get_monsters(), target_okay(), target_recall_loop_object(), target_set_closest(), target_set_interactive(), target_set_interactive_aux(), target_set_location(), target_sighted(), teardown_tests(), test_drop_eat(), test_drop_pickup(), test_loadgame(), test_magic_missile(), test_newgame(), textui_process_click(), thrust_away(), twall(), uncurse_object(), update_minimap_subwindow(), update_mon(), update_monsters(), update_player_object_knowledge(), update_scent(), update_stuff(), use_aux(), use_store(), wiz_create_item_drop_object(), wiz_statistics(), wiz_test_kind(), wr_dungeon(), wr_monsters(), wr_objects(), and wr_traps().

◆ d_off_x_0

const int d_off_x_0[]
static
Initial value:
=
{ 0 }

◆ d_off_x_1

const int d_off_x_1[]
static
Initial value:
=
{ -1, 0, 1, -1, 1, -1, 0, 1, 0 }

◆ d_off_x_2

const int d_off_x_2[]
static
Initial value:
=
{ -2, 2, -1, 0, 1, -2, 2, -2, 2, -1, 0, 1, 0 }

◆ d_off_x_3

const int d_off_x_3[]
static
Initial value:
=
{ -3, 3, -2, 2, -1, 0, 1, -3, 3, -3, 3, -2, 2,
-1, 0, 1, 0 }

◆ d_off_x_4

const int d_off_x_4[]
static
Initial value:
=
{ -4, 4, -3, 3, -2, -3, 2, 3, -1, 0, 1, -4, 4,
-4, 4, -3, 3, -2, -3, 2, 3, -1, 0, 1, 0 }

◆ d_off_x_5

const int d_off_x_5[]
static
Initial value:
=
{ -5, 5, -4, 4, -4, 4, -2, -3, 2, 3, -1, 0, 1,
-5, 5, -5, 5, -4, 4, -4, 4, -2, -3, 2, 3, -1,
0, 1, 0 }

◆ d_off_x_6

const int d_off_x_6[]
static
Initial value:
=
{ -6, 6, -5, 5, -5, 5, -4, 4, -2, -3, 2, 3, -1,
0, 1, -6, 6, -6, 6, -5, 5, -5, 5, -4, 4, -2,
-3, 2, 3, -1, 0, 1, 0 }

◆ d_off_x_7

const int d_off_x_7[]
static
Initial value:
=
{ -7, 7, -6, 6, -6, 6, -5, 5, -4, -5, 4, 5, -2,
-3, 2, 3, -1, 0, 1, -7, 7, -7, 7, -6, 6, -6,
6, -5, 5, -4, -5, 4, 5, -2, -3, 2, 3, -1, 0,
1, 0 }

◆ d_off_x_8

const int d_off_x_8[]
static
Initial value:
=
{ -8, 8, -7, 7, -7, 7, -6, 6, -6, 6, -4, -5, 4,
5, -2, -3, 2, 3, -1, 0, 1, -8, 8, -8, 8, -7,
7, -7, 7, -6, 6, -6, 6, -4, -5, 4, 5, -2, -3,
2, 3, -1, 0, 1, 0 }

◆ d_off_x_9

const int d_off_x_9[]
static
Initial value:
=
{ -9, 9, -8, 8, -8, 8, -7, 7, -7, 7, -6, 6, -4,
-5, 4, 5, -2, -3, 2, 3, -1, 0, 1, -9, 9, -9,
9, -8, 8, -8, 8, -7, 7, -7, 7, -6, 6, -4, -5,
4, 5, -2, -3, 2, 3, -1, 0, 1, 0 }

◆ d_off_y_0

const int d_off_y_0[]
static
Initial value:
=
{ 0 }

Hack – Precompute a bunch of calls to distance().

The pair of arrays dist_offsets_y[n] and dist_offsets_x[n] contain the offsets of all the locations with a distance of n from a central point, with an offset of (0,0) indicating no more offsets at this distance.

This is, of course, fairly unreadable, but it eliminates multiple loops from the previous version.

It is probably better to replace these arrays with code to compute the relevant arrays, even if the storage is pre-allocated in hard coded sizes. At the very least, code should be included which is able to generate and dump these arrays (ala "los()"). XXX XXX XXX

◆ d_off_y_1

const int d_off_y_1[]
static
Initial value:
=
{ -1, -1, -1, 0, 0, 1, 1, 1, 0 }

◆ d_off_y_2

const int d_off_y_2[]
static
Initial value:
=
{ -1, -1, -2, -2, -2, 0, 0, 1, 1, 2, 2, 2, 0 }

◆ d_off_y_3

const int d_off_y_3[]
static
Initial value:
=
{ -1, -1, -2, -2, -3, -3, -3, 0, 0, 1, 1, 2, 2,
3, 3, 3, 0 }

◆ d_off_y_4

const int d_off_y_4[]
static
Initial value:
=
{ -1, -1, -2, -2, -3, -3, -3, -3, -4, -4, -4, 0,
0, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 0 }

◆ d_off_y_5

const int d_off_y_5[]
static
Initial value:
=
{ -1, -1, -2, -2, -3, -3, -4, -4, -4, -4, -5, -5,
-5, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5,
5, 0 }

◆ d_off_y_6

const int d_off_y_6[]
static
Initial value:
=
{ -1, -1, -2, -2, -3, -3, -4, -4, -5, -5, -5, -5,
-6, -6, -6, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5,
5, 5, 6, 6, 6, 0 }

◆ d_off_y_7

const int d_off_y_7[]
static
Initial value:
=
{ -1, -1, -2, -2, -3, -3, -4, -4, -5, -5, -5, -5,
-6, -6, -6, -6, -7, -7, -7, 0, 0, 1, 1, 2, 2, 3,
3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 0 }

◆ d_off_y_8

const int d_off_y_8[]
static
Initial value:
=
{ -1, -1, -2, -2, -3, -3, -4, -4, -5, -5, -6, -6,
-6, -6, -7, -7, -7, -7, -8, -8, -8, 0, 0, 1, 1,
2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
8, 8, 8, 0 }

◆ d_off_y_9

const int d_off_y_9[]
static
Initial value:
=
{ -1, -1, -2, -2, -3, -3, -4, -4, -5, -5, -6, -6,
-7, -7, -7, -7, -8, -8, -8, -8, -9, -9, -9, 0,
0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7,
7, 8, 8, 8, 8, 9, 9, 9, 0 }

◆ ddd

const s16b ddd[9]
Initial value:
=
{ 2, 8, 6, 4, 3, 1, 9, 7, 5 }

Global array for looping through the "keypad directions".

Referenced by build_streamer(), monster_turn(), player_confuse_dir(), and use_aux().

◆ ddx

const s16b ddx[10]

◆ ddx_ddd

const s16b ddx_ddd[9]

◆ ddy

const s16b ddy[10]

◆ ddy_ddd

const s16b ddy_ddd[9]

◆ dist_offsets_x

const int* dist_offsets_x[10]
Initial value:
=
{
}
static const int d_off_x_5[]
Definition: cave.c:144
static const int d_off_x_4[]
Definition: cave.c:134
static const int d_off_x_9[]
Definition: cave.c:192
static const int d_off_x_3[]
Definition: cave.c:125
static const int d_off_x_1[]
Definition: cave.c:110
static const int d_off_x_2[]
Definition: cave.c:117
static const int d_off_x_8[]
Definition: cave.c:179
static const int d_off_x_7[]
Definition: cave.c:166
static const int d_off_x_6[]
Definition: cave.c:155
static const int d_off_x_0[]
Definition: cave.c:103

Referenced by get_move_find_hiding(), and get_move_find_safety().

◆ dist_offsets_y

const int* dist_offsets_y[10]
Initial value:
=
{
}
static const int d_off_y_1[]
Definition: cave.c:107
static const int d_off_y_7[]
Definition: cave.c:161
static const int d_off_y_8[]
Definition: cave.c:173
static const int d_off_y_6[]
Definition: cave.c:150
static const int d_off_y_2[]
Definition: cave.c:114
static const int d_off_y_5[]
Definition: cave.c:139
static const int d_off_y_4[]
Definition: cave.c:130
static const int d_off_y_0[]
Hack – Precompute a bunch of calls to distance().
Definition: cave.c:100
static const int d_off_y_3[]
Definition: cave.c:121
static const int d_off_y_9[]
Definition: cave.c:186

Referenced by get_move_find_hiding(), and get_move_find_safety().

◆ f_info

struct feature* f_info

◆ FEAT_BROKEN

int FEAT_BROKEN

◆ FEAT_CLOSED

int FEAT_CLOSED

◆ FEAT_FLOOR

int FEAT_FLOOR

◆ FEAT_GRANITE

int FEAT_GRANITE

◆ FEAT_LAVA

int FEAT_LAVA

◆ FEAT_LESS

int FEAT_LESS

◆ FEAT_MAGMA

int FEAT_MAGMA

◆ FEAT_MAGMA_K

int FEAT_MAGMA_K

◆ FEAT_MORE

int FEAT_MORE

◆ FEAT_NONE

int FEAT_NONE

◆ FEAT_OPEN

int FEAT_OPEN

◆ FEAT_PASS_RUBBLE

int FEAT_PASS_RUBBLE

◆ FEAT_PERM

int FEAT_PERM

◆ FEAT_QUARTZ

int FEAT_QUARTZ

◆ FEAT_QUARTZ_K

int FEAT_QUARTZ_K

◆ FEAT_RUBBLE

int FEAT_RUBBLE

◆ FEAT_SECRET

int FEAT_SECRET

◆ side_dirs

const byte side_dirs[20][8]
Initial value:
= {
{0, 0, 0, 0, 0, 0, 0, 0},
{1, 4, 2, 7, 3, 8, 6, 9},
{2, 1, 3, 4, 6, 7, 9, 8},
{3, 2, 6, 1, 9, 4, 8, 7},
{4, 7, 1, 8, 2, 9, 3, 6},
{5, 5, 5, 5, 5, 5, 5, 5},
{6, 3, 9, 2, 8, 1, 7, 4},
{7, 8, 4, 9, 1, 6, 2, 3},
{8, 9, 7, 6, 4, 3, 1, 2},
{9, 6, 8, 3, 7, 2, 4, 1},
{0, 0, 0, 0, 0, 0, 0, 0},
{1, 2, 4, 3, 7, 6, 8, 9},
{2, 3, 1, 6, 4, 9, 7, 8},
{3, 6, 2, 9, 1, 8, 4, 7},
{4, 1, 7, 2, 8, 3, 9, 6},
{5, 5, 5, 5, 5, 5, 5, 5},
{6, 9, 3, 8, 2, 7, 1, 4},
{7, 4, 8, 1, 9, 2, 6, 3},
{8, 7, 9, 4, 6, 1, 3, 2},
{9, 8, 6, 7, 3, 4, 2, 1}
}

Given a central direction at position [dir #][0], return a series of directions radiating out on both sides from the central direction all the way back to its rear.

Side directions come in pairs; for example, directions '1' and '3' flank direction '2'. The code should know which side to consider first. If the left, it must add 10 to the central direction to access the second part of the table.

Referenced by monster_turn().