Angband
|
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 | 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 chunk * | cave_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 monster * | cave_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... | |
Variables | |
struct feature * | f_info |
struct chunk * | cave = 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 int * | dist_offsets_y [10] |
const int * | dist_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... | |
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.
Free a chunk.
References chunk::feat_count, heatmap::grids, chunk::height, square::info, mem_free(), chunk::monsters, chunk::name, chunk::noise, square::obj, object_pile_free(), chunk::objects, chunk::scent, square_free_trap(), chunk::squares, string_free(), square::trap, and chunk::width.
Referenced by cave_clear(), cave_generate(), cavern_chunk(), cleanup_angband(), cleanup_player(), gauntlet_gen(), hard_centre_gen(), and lair_gen().
Get a monster on the current level by its index.
References chunk::monsters, and NULL.
Referenced by add_monster_lights(), call_monster(), chunk_copy(), chunk_write(), compact_monsters(), compact_monsters_aux(), delete_monster_idx(), do_animation(), do_cmd_walk_test(), do_cmd_wiz_zap(), effect_handler_BALL(), effect_handler_BANISH(), effect_handler_BREATH(), effect_handler_DAMAGE(), effect_handler_DETECT_EVIL(), effect_handler_DETECT_INVISIBLE_MONSTERS(), effect_handler_DETECT_VISIBLE_MONSTERS(), 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_SUMMON(), effect_handler_TELEPORT(), effect_handler_TELEPORT_TO(), effect_handler_WAKE(), find_artifact(), get_target(), grid_data_as_text(), look_mon_desc(), map_info(), mon_pop(), monster_list_collect(), monster_list_show_subwindow(), monster_swap(), 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(), spell_value_base_spell_power(), square_monster(), update_monsters(), wipe_mon_list(), and wr_monsters_aux().
The current number of monsters present on the level.
References chunk::mon_cnt.
Referenced by process_world().
The maximum number of monsters allowed in the level.
References chunk::mon_max.
Referenced by add_monster_lights(), call_monster(), cave_generate(), compact_monsters(), do_animation(), do_cmd_wiz_zap(), effect_handler_BANISH(), effect_handler_DETECT_EVIL(), effect_handler_DETECT_INVISIBLE_MONSTERS(), effect_handler_DETECT_VISIBLE_MONSTERS(), effect_handler_MASS_BANISH(), effect_handler_PROBE(), effect_handler_PROJECT_LOS(), effect_handler_PROJECT_LOS_AWARE(), effect_handler_WAKE(), find_artifact(), mon_pop(), monster_list_can_update(), monster_list_collect(), monster_list_new(), monster_list_reset(), monster_list_show_subwindow(), process_monsters(), process_player_cleanup(), process_world(), reset_monsters(), update_monsters(), wipe_mon_list(), and wr_monsters_aux().
Allocate a new chunk of the world.
References chunk::created_at, angband_constants::f_max, chunk::feat_count, heatmap::grids, chunk::height, height, square::info, angband_constants::level_monster_max, mem_zalloc(), chunk::mon_current, chunk::mon_max, chunk::monsters, chunk::noise, chunk::obj_max, OBJECT_LIST_SIZE, chunk::objects, chunk::scent, SQUARE_SIZE, chunk::squares, turn, chunk::width, width, and z_info.
Referenced by cave_generate(), cavern_chunk(), chunk_write(), classic_gen(), gauntlet_gen(), hard_centre_gen(), labyrinth_chunk(), lair_gen(), modified_chunk(), moria_chunk(), rd_dungeon_aux(), town_gen(), and vault_chunk().
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().
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, NULL, 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(), and uncurse_object().
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(), NULL, chunk::obj_max, OBJECT_LIST_INCR, chunk::objects, and object::oidx.
Referenced by floor_carry(), monster_carry(), place_gold(), place_monster(), and place_object().
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().
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(), and chunk::squares.
Referenced by square_know_pile().
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(), 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 constants to the indices from terrain.txt.
References FEAT_BROKEN, FEAT_CLOSED, FEAT_FLOOR, FEAT_GRANITE, FEAT_LAVA, FEAT_LESS, FEAT_MAGMA, FEAT_MAGMA_K, FEAT_MORE, FEAT_NONE, FEAT_OPEN, FEAT_PASS_RUBBLE, FEAT_PERM, FEAT_QUARTZ, FEAT_QUARTZ_K, FEAT_RUBBLE, FEAT_SECRET, and lookup_feat().
Referenced by finish_parse_feat().
Referenced by acquirement(), autoinscribe_ground(), become_aware(), blow_after_effects(), build_quest_stairs(), call_monster(), can_call_monster(), cave_generate(), cave_known(), cave_light(), cave_room_aux(), cave_unlight(), chest_check(), chest_death(), chunk_write(), cleanup_angband(), close_game(), compact_monsters(), compact_monsters_aux(), context_menu_cave(), context_menu_object(), context_menu_player(), delete_monster(), delete_monster_idx(), 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_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(), 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_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_DRAIN_MANA(), effect_handler_EARTHQUAKE(), 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_RUBBLE(), effect_handler_RUNE(), effect_handler_SENSE_OBJECTS(), effect_handler_SUMMON(), effect_handler_TELEPORT(), effect_handler_TELEPORT_TO(), effect_handler_THRUST_AWAY(), effect_handler_WAKE(), enter_store(), fill_terrain_info(), find_artifact(), findpath(), floor_carry_fail(), floor_object_for_use(), 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(), light_room(), look_mon_desc(), make_attack_spell(), make_noise(), make_ranged_shot(), make_ranged_throw(), map_info(), melee_effect_handler_EAT_GOLD(), melee_effect_handler_EAT_ITEM(), modify_panel(), 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(), 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_check_terrain_damage(), player_inc_check(), player_know_object(), player_pickup_aux(), player_pickup_gold(), player_pickup_item(), player_take_terrain_damage(), process_player_cleanup(), process_world(), 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_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(), recharge_objects(), refill_lamp(), remove_bad_spells(), reset_monsters(), run_game_loop(), run_step(), run_test(), rune_autoinscribe(), scan_distant_floor(), scan_floor(), search(), see_wall(), show_obj(), spell_value_base_dungeon_level(), spell_value_base_spell_power(), square_forget(), square_isbelievedwall(), square_isknown(), square_isnotknown(), square_know_pile(), square_light_spot(), square_memorize(), square_note_spot(), square_sense_pile(), start_game(), store_at(), store_will_buy_tester(), summon_possible(), summon_specific(), take1(), target_able(), target_accept(), target_get_monsters(), target_recall_loop_object(), target_set_closest(), target_set_interactive(), target_set_interactive_aux(), target_set_location(), target_sighted(), test_drop_eat(), test_drop_pickup(), test_loadgame(), test_magic_missile(), test_newgame(), textui_process_click(), twall(), uncurse_object(), update_minimap_subwindow(), 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().
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
Global array for looping through the "keypad directions".
Referenced by build_streamer(), monster_turn(), and player_confuse_dir().
Global arrays for converting "keypad direction" into "offsets".
Referenced by build_streamer(), change_panel(), column_process_direction(), do_cmd_alter_aux(), do_cmd_close(), do_cmd_disarm(), do_cmd_jump(), do_cmd_open(), do_cmd_options_win(), do_cmd_run(), do_cmd_tunnel(), do_cmd_walk(), effect_handler_BALL(), effect_handler_BIZARRE(), effect_handler_BREATH(), effect_handler_SWARM(), findpath(), get_target(), glyph_command(), monster_turn(), move_player(), object_skin_process_direction(), ranged_helper(), run_init(), run_step(), run_test(), scroll_process_direction(), see_wall(), target_set_interactive(), and tile_picker_command().
Global arrays for optimizing "ddx[ddd[i]]" and "ddy[ddd[i]]".
This means that each entry in this array corresponds to the direction with the same array index in ddd[].
Referenced by build_room_of_chambers(), cave_illuminate(), cave_known(), count_chests(), count_feats(), effect_handler_EARTHQUAKE(), effect_handler_MAP_AREA(), effect_handler_RUBBLE(), effect_handler_STAR(), effect_handler_STAR_BALL(), effect_handler_THRUST_AWAY(), generate_starburst_room(), get_move(), get_move_advance(), get_move_flee(), hollow_out_room(), make_chamber(), make_noise(), next_to_corr(), place_new_monster_group(), project(), rand_dir(), update_scent(), update_view_one(), and wiz_light().
Referenced by build_streamer(), change_panel(), column_process_direction(), do_cmd_alter_aux(), do_cmd_close(), do_cmd_disarm(), do_cmd_jump(), do_cmd_open(), do_cmd_options_win(), do_cmd_run(), do_cmd_tunnel(), do_cmd_walk(), effect_handler_BALL(), effect_handler_BIZARRE(), effect_handler_BREATH(), effect_handler_SWARM(), findpath(), get_target(), glyph_command(), menu_handle_keypress(), monster_turn(), move_player(), object_skin_process_direction(), ranged_helper(), run_init(), run_step(), run_test(), scroll_process_direction(), see_wall(), target_set_interactive(), and tile_picker_command().
Referenced by build_room_of_chambers(), cave_illuminate(), cave_known(), count_chests(), count_feats(), effect_handler_EARTHQUAKE(), effect_handler_MAP_AREA(), effect_handler_RUBBLE(), effect_handler_STAR(), effect_handler_STAR_BALL(), effect_handler_THRUST_AWAY(), generate_starburst_room(), get_move(), get_move_advance(), get_move_flee(), hollow_out_room(), make_chamber(), make_noise(), next_to_corr(), place_new_monster_group(), project(), rand_dir(), update_scent(), update_view_one(), and wiz_light().
Referenced by get_move_find_hiding(), and get_move_find_safety().
Referenced by get_move_find_hiding(), and get_move_find_safety().
struct feature* f_info |
Referenced by build_store(), cleanup_feat(), display_feature(), display_map(), do_cmd_knowledge_features(), dump_features(), f_cmp_fkind(), feat_is_bright(), feat_is_fiery(), feat_is_floor(), feat_is_granite(), feat_is_magma(), feat_is_monster_walkable(), feat_is_no_flow(), feat_is_no_scent(), feat_is_object_holding(), feat_is_passable(), feat_is_projectable(), feat_is_quartz(), feat_is_shop(), feat_is_smooth(), feat_is_torch(), feat_is_trap_holding(), feat_is_treasure(), feat_is_wall(), feat_lore(), feat_order(), finish_parse_feat(), grid_data_as_text(), lookup_symbol(), map_info(), reset_visuals(), square_apparent_name(), square_digging(), square_feat(), square_hasgoldvein(), square_isbrokendoor(), square_iscloseddoor(), square_isdoor(), square_isdownstairs(), square_isinteresting(), square_isopendoor(), square_isperm(), square_isrock(), square_isrubble(), square_issecretdoor(), square_isstairs(), square_isupstairs(), square_seemslikewall(), and square_shopnum().
int FEAT_BROKEN |
Referenced by build_room_of_chambers(), do_cmd_wiz_features(), hollow_out_room(), place_random_door(), set_terrain(), and square_smash_door().
int FEAT_CLOSED |
Referenced by build_crossed(), build_large(), build_nest(), build_pit(), do_cmd_wiz_features(), place_closed_door(), set_terrain(), square_add_door(), and square_close_door().
int FEAT_FLOOR |
Referenced by build_circular(), build_crossed(), build_huge(), build_large(), build_moria(), build_nest(), build_overlap(), build_pit(), build_room_of_chambers(), build_room_template(), build_simple(), build_tunnel(), build_vault(), cavern_chunk(), do_cmd_wiz_features(), gauntlet_gen(), hard_centre_gen(), hollow_out_room(), init_cavern(), join_region(), labyrinth_chunk(), modified_chunk(), moria_chunk(), mutate_cavern(), project_feature_handler_COLD(), project_feature_handler_ICE(), set_terrain(), square_destroy(), square_destroy_door(), square_destroy_rubble(), square_destroy_wall(), square_earthquake(), square_force_floor(), square_tunnel_wall(), and town_gen_layout().
int FEAT_GRANITE |
Referenced by build_circular(), build_crossed(), build_large(), build_nest(), build_overlap(), build_pit(), build_room_of_chambers(), build_simple(), classic_gen(), do_cmd_wiz_features(), gauntlet_gen(), generate_starburst_room(), init_cavern(), labyrinth_chunk(), make_inner_chamber_wall(), modified_chunk(), moria_chunk(), mutate_cavern(), set_marked_granite(), set_terrain(), square_destroy(), square_earthquake(), square_is_granite_with_flag(), and town_gen_layout().
int FEAT_LAVA |
Referenced by build_vault(), project_feature_handler_FIRE(), project_feature_handler_PLASMA(), set_terrain(), and town_gen_layout().
int FEAT_LESS |
int FEAT_MAGMA |
int FEAT_MAGMA_K |
Referenced by build_vault(), do_cmd_wiz_features(), set_terrain(), and square_upgrade_mineral().
int FEAT_MORE |
Referenced by build_quest_stairs(), build_vault(), cavern_gen(), classic_gen(), do_cmd_wiz_features(), gauntlet_gen(), hard_centre_gen(), labyrinth_gen(), lair_gen(), modified_gen(), moria_gen(), new_player_spot(), place_random_stairs(), place_stairs(), set_terrain(), square_add_stairs(), town_gen(), and town_gen_layout().
int FEAT_NONE |
Referenced by map_info(), set_terrain(), square_forget(), and square_isknown().
int FEAT_OPEN |
int FEAT_PASS_RUBBLE |
int FEAT_PERM |
int FEAT_QUARTZ |
int FEAT_QUARTZ_K |
Referenced by build_vault(), do_cmd_wiz_features(), set_terrain(), and square_upgrade_mineral().
int FEAT_RUBBLE |
int FEAT_SECRET |
Referenced by build_crossed(), do_cmd_wiz_features(), place_secret_door(), and set_terrain().
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().