Angband
Functions
cave-square.c File Reference

functions for dealing with individual squares More...

#include "angband.h"
#include "cave.h"
#include "game-world.h"
#include "init.h"
#include "monster.h"
#include "obj-knowledge.h"
#include "obj-pile.h"
#include "obj-util.h"
#include "object.h"
#include "trap.h"

Functions

bool feat_is_magma (int feat)
 FEATURE PREDICATES. More...
 
bool feat_is_quartz (int feat)
 True if the square is a quartz wall. More...
 
bool feat_is_granite (int feat)
 True if the square is a granite wall. More...
 
bool feat_is_treasure (int feat)
 True if the square is a mineral wall with treasure (magma/quartz). More...
 
bool feat_is_wall (int feat)
 True is the feature is a solid wall (not rubble). More...
 
bool feat_is_floor (int feat)
 True is the feature is a floor. More...
 
bool feat_is_trap_holding (int feat)
 True is the feature can hold a trap. More...
 
bool feat_is_object_holding (int feat)
 True is the feature can hold an object. More...
 
bool feat_is_monster_walkable (int feat)
 True if a monster can walk through the feature. More...
 
bool feat_is_shop (int feat)
 True if the feature is a shop entrance. More...
 
bool feat_is_passable (int feat)
 True if the feature is passable by the player. More...
 
bool feat_is_projectable (int feat)
 True if any projectable can pass through the feature. More...
 
bool feat_is_torch (int feat)
 True if the feature can be lit by light sources. More...
 
bool feat_is_bright (int feat)
 True if the feature is internally lit. More...
 
bool feat_is_fiery (int feat)
 True if the feature is internally lit. More...
 
bool feat_is_no_flow (int feat)
 True if the feature doesn't carry monster flow information. More...
 
bool feat_is_no_scent (int feat)
 True if the feature doesn't carry player scent. More...
 
bool feat_is_smooth (int feat)
 True if the feature should have smooth boundaries (for dungeon generation). More...
 
bool square_isfloor (struct chunk *c, int y, int x)
 SQUARE FEATURE PREDICATES. More...
 
bool square_istrappable (struct chunk *c, int y, int x)
 True if the square can hold a trap. More...
 
bool square_isobjectholding (struct chunk *c, int y, int x)
 True if the square can hold an object. More...
 
bool square_isrock (struct chunk *c, int y, int x)
 True if the square is a normal granite rock wall. More...
 
bool square_isperm (struct chunk *c, int y, int x)
 True if the square is a permanent wall. More...
 
bool square_ismagma (struct chunk *c, int y, int x)
 True if the square is a magma wall. More...
 
bool square_isquartz (struct chunk *c, int y, int x)
 True if the square is a quartz wall. More...
 
bool square_isgranite (struct chunk *c, int y, int x)
 True if the square is granite. More...
 
bool square_ismineral (struct chunk *c, int y, int x)
 True if the square is a mineral wall (magma/quartz). More...
 
bool square_hasgoldvein (struct chunk *c, int y, int x)
 
bool square_isrubble (struct chunk *c, int y, int x)
 True if the square is rubble. More...
 
bool square_issecretdoor (struct chunk *c, int y, int x)
 True if the square is a hidden secret door. More...
 
bool square_isopendoor (struct chunk *c, int y, int x)
 True if the square is an open door. More...
 
bool square_iscloseddoor (struct chunk *c, int y, int x)
 True if the square is a closed door (possibly locked or jammed). More...
 
bool square_isbrokendoor (struct chunk *c, int y, int x)
 
bool square_isdoor (struct chunk *c, int y, int x)
 True if the square is a door. More...
 
bool square_isstairs (struct chunk *c, int y, int x)
 True if square is any stair. More...
 
bool square_isupstairs (struct chunk *c, int y, int x)
 True if square is an up stair. More...
 
bool square_isdownstairs (struct chunk *c, int y, int x)
 True if square is a down stair. More...
 
bool square_isshop (struct chunk *c, int y, int x)
 True if the square is a shop entrance. More...
 
bool square_isplayer (struct chunk *c, int y, int x)
 True if the square contains the player. More...
 
bool square_isknown (struct chunk *c, int y, int x)
 True if the the player knows the terrain of the square. More...
 
bool square_isnotknown (struct chunk *c, int y, int x)
 True if the the player's knowledge of the terrain of the square is wrong or missing. More...
 
bool square_ismark (struct chunk *c, int y, int x)
 SQUARE INFO PREDICATES. More...
 
bool square_isglow (struct chunk *c, int y, int x)
 True if the square is lit. More...
 
bool square_isvault (struct chunk *c, int y, int x)
 True if the square is part of a vault. More...
 
bool square_isroom (struct chunk *c, int y, int x)
 True if the square is part of a room. More...
 
bool square_isseen (struct chunk *c, int y, int x)
 True if the square has been seen by the player. More...
 
bool square_isview (struct chunk *c, int y, int x)
 True if the cave square is currently viewable by the player. More...
 
bool square_wasseen (struct chunk *c, int y, int x)
 True if the cave square was seen before the current update. More...
 
bool square_isfeel (struct chunk *c, int y, int x)
 True if cave square is a feeling trigger square. More...
 
bool square_istrap (struct chunk *c, int y, int x)
 True if the square has a known trap. More...
 
bool square_isinvis (struct chunk *c, int y, int x)
 True if the square has an unknown trap. More...
 
bool square_iswall_inner (struct chunk *c, int y, int x)
 True if cave square is an inner wall (generation) More...
 
bool square_iswall_outer (struct chunk *c, int y, int x)
 True if cave square is an outer wall (generation) More...
 
bool square_iswall_solid (struct chunk *c, int y, int x)
 True if cave square is a solid wall (generation) More...
 
bool square_ismon_restrict (struct chunk *c, int y, int x)
 True if cave square has monster restrictions (generation) More...
 
bool square_isno_teleport (struct chunk *c, int y, int x)
 True if cave square can't be teleported from by the player. More...
 
bool square_isno_map (struct chunk *c, int y, int x)
 True if cave square can't be magically mapped by the player. More...
 
bool square_isno_esp (struct chunk *c, int y, int x)
 True if cave square can't be detected by player ESP. More...
 
bool square_isproject (struct chunk *c, int y, int x)
 True if cave square is marked for projection processing. More...
 
bool square_isdtrap (struct chunk *c, int y, int x)
 True if cave square has been detected for traps. More...
 
bool square_isopen (struct chunk *c, int y, int x)
 SQUARE BEHAVIOR PREDICATES. More...
 
bool square_isempty (struct chunk *c, int y, int x)
 True if the square is empty (an open square without any items). More...
 
bool square_canputitem (struct chunk *c, int y, int x)
 True if the square is an untrapped floor square without items. More...
 
bool square_isdiggable (struct chunk *c, int y, int x)
 True if the square can be dug: this includes rubble and non-permanent walls. More...
 
bool square_is_monster_walkable (struct chunk *c, int y, int x)
 True if a monster can walk through the tile. More...
 
bool square_ispassable (struct chunk *c, int y, int x)
 True if the square is passable by the player. More...
 
bool square_isprojectable (struct chunk *c, int y, int x)
 True if any projectable can pass through the square. More...
 
bool square_iswall (struct chunk *c, int y, int x)
 True if the square is a wall square (impedes the player). More...
 
bool square_isstrongwall (struct chunk *c, int y, int x)
 True if the square is a permanent wall or one of the "stronger" walls. More...
 
bool square_isbright (struct chunk *c, int y, int x)
 True if the cave square is internally lit. More...
 
bool square_isfiery (struct chunk *c, int y, int x)
 True if the cave square is fire-based. More...
 
bool square_isdamaging (struct chunk *c, int y, int x)
 True if the cave square can damage the inhabitant - only lava so far. More...
 
bool square_isnoflow (struct chunk *c, int y, int x)
 True if the cave square doesn't allow monster flow information. More...
 
bool square_isnoscent (struct chunk *c, int y, int x)
 True if the cave square doesn't carry player scent. More...
 
bool square_iswarded (struct chunk *c, int y, int x)
 
bool square_canward (struct chunk *c, int y, int x)
 
bool square_seemslikewall (struct chunk *c, int y, int x)
 
bool square_isinteresting (struct chunk *c, int y, int x)
 
bool square_islockeddoor (struct chunk *c, int y, int x)
 True if the square is a closed, locked door. More...
 
bool square_isplayertrap (struct chunk *c, int y, int x)
 True if there is a player trap (known or unknown) in this square. More...
 
bool square_isvisibletrap (struct chunk *c, int y, int x)
 True if there is a visible trap in this square. More...
 
bool square_issecrettrap (struct chunk *c, int y, int x)
 True if the square is an unknown player trap (it will appear as a floor tile) More...
 
bool square_isdisabledtrap (struct chunk *c, int y, int x)
 True if the square is a known, disabled player trap. More...
 
bool square_isdisarmabletrap (struct chunk *c, int y, int x)
 True if the square is a known, disarmable player trap. More...
 
bool square_dtrap_edge (struct chunk *c, int y, int x)
 Checks if a square is at the (inner) edge of a trap detect area. More...
 
bool square_changeable (struct chunk *c, int y, int x)
 Determine if a given location may be "destroyed". More...
 
bool square_in_bounds (struct chunk *c, int y, int x)
 
bool square_in_bounds_fully (struct chunk *c, int y, int x)
 
bool square_isbelievedwall (struct chunk *c, int y, int x)
 Checks if a square is thought by the player to block projections. More...
 
struct featuresquare_feat (struct chunk *c, int y, int x)
 OTHER SQUARE FUNCTIONS. More...
 
struct monstersquare_monster (struct chunk *c, int y, int x)
 Get a monster on the current level by its position. More...
 
struct objectsquare_object (struct chunk *c, int y, int x)
 Get the top object of a pile on the current level by its position. More...
 
struct trapsquare_trap (struct chunk *c, int y, int x)
 Get the first (and currently only) trap in a position on the current level. More...
 
bool square_holds_object (struct chunk *c, int y, int x, struct object *obj)
 Return true if the given object is on the floor at this grid. More...
 
void square_excise_object (struct chunk *c, int y, int x, struct object *obj)
 Excise an object from a floor pile, leaving it orphaned. More...
 
void square_excise_pile (struct chunk *c, int y, int x)
 Excise an entire floor pile. More...
 
void square_sense_pile (struct chunk *c, int y, int x)
 Sense the existence of objects on a grid in the current level. More...
 
void square_know_pile (struct chunk *c, int y, int x)
 Update the player's knowledge of the objects on a grid in the current level. More...
 
void square_set_feat (struct chunk *c, int y, int x, int feat)
 Set the terrain type for a square. More...
 
void square_add_trap (struct chunk *c, int y, int x)
 
void square_add_ward (struct chunk *c, int y, int x)
 
void square_add_stairs (struct chunk *c, int y, int x, int depth)
 
void square_add_door (struct chunk *c, int y, int x, bool closed)
 
void square_open_door (struct chunk *c, int y, int x)
 
void square_close_door (struct chunk *c, int y, int x)
 
void square_smash_door (struct chunk *c, int y, int x)
 
void square_unlock_door (struct chunk *c, int y, int x)
 
void square_destroy_door (struct chunk *c, int y, int x)
 
void square_destroy_trap (struct chunk *c, int y, int x)
 
void square_disable_trap (struct chunk *c, int y, int x)
 
void square_tunnel_wall (struct chunk *c, int y, int x)
 
void square_destroy_wall (struct chunk *c, int y, int x)
 
void square_destroy (struct chunk *c, int y, int x)
 
void square_earthquake (struct chunk *c, int y, int x)
 
void square_remove_ward (struct chunk *c, int y, int x)
 
void square_upgrade_mineral (struct chunk *c, int y, int x)
 Add visible treasure to a mineral square. More...
 
void square_destroy_rubble (struct chunk *c, int y, int x)
 
void square_force_floor (struct chunk *c, int y, int x)
 
int square_shopnum (struct chunk *c, int y, int x)
 
int square_digging (struct chunk *c, int y, int x)
 
const char * square_apparent_name (struct chunk *c, struct player *p, int y, int x)
 
void square_memorize (struct chunk *c, int y, int x)
 
void square_forget (struct chunk *c, int y, int x)
 
void square_mark (struct chunk *c, int y, int x)
 
void square_unmark (struct chunk *c, int y, int x)
 

Detailed Description

functions for dealing with individual squares

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

bool feat_is_bright ( int  feat)

True if the feature is internally lit.

References f_info, flags, and tf_has.

Referenced by square_isbright().

bool feat_is_fiery ( int  feat)

True if the feature is internally lit.

References f_info, flags, and tf_has.

Referenced by square_isdamaging(), and square_isfiery().

bool feat_is_floor ( int  feat)

True is the feature is a floor.

References f_info, flags, and tf_has.

Referenced by generate_starburst_room(), grid_get_attr(), pick_trap(), and square_isfloor().

bool feat_is_granite ( int  feat)

True if the square is a granite wall.

References f_info, flags, and tf_has.

Referenced by square_isgranite().

bool feat_is_magma ( int  feat)

FEATURE PREDICATES.

These functions test a terrain feature index for the obviously described type. They are used in the square feature predicates below, and occasionally on their own True if the square is a magma wall.

References f_info, flags, and tf_has.

Referenced by grid_get_attr(), and square_ismagma().

bool feat_is_monster_walkable ( int  feat)

True if a monster can walk through the feature.

References f_info, flags, and tf_has.

Referenced by square_is_monster_walkable().

bool feat_is_no_flow ( int  feat)

True if the feature doesn't carry monster flow information.

References f_info, flags, and tf_has.

Referenced by square_isnoflow().

bool feat_is_no_scent ( int  feat)

True if the feature doesn't carry player scent.

References f_info, flags, and tf_has.

Referenced by square_isnoscent().

bool feat_is_object_holding ( int  feat)

True is the feature can hold an object.

References f_info, flags, and tf_has.

Referenced by square_isobjectholding().

bool feat_is_passable ( int  feat)

True if the feature is passable by the player.

References f_info, flags, and tf_has.

Referenced by generate_starburst_room(), and square_ispassable().

bool feat_is_projectable ( int  feat)

True if any projectable can pass through the feature.

References f_info, flags, and tf_has.

Referenced by square_isprojectable().

bool feat_is_quartz ( int  feat)

True if the square is a quartz wall.

References f_info, flags, and tf_has.

Referenced by grid_get_attr(), and square_isquartz().

bool feat_is_shop ( int  feat)

True if the feature is a shop entrance.

References f_info, flags, and tf_has.

Referenced by build_store(), and square_isshop().

bool feat_is_smooth ( int  feat)

True if the feature should have smooth boundaries (for dungeon generation).

References f_info, flags, and tf_has.

Referenced by generate_starburst_room().

bool feat_is_torch ( int  feat)

True if the feature can be lit by light sources.

References f_info, flags, and tf_has.

Referenced by grid_get_attr().

bool feat_is_trap_holding ( int  feat)

True is the feature can hold a trap.

References f_info, flags, and tf_has.

Referenced by pick_trap(), and square_istrappable().

bool feat_is_treasure ( int  feat)

True if the square is a mineral wall with treasure (magma/quartz).

References f_info, flags, and tf_has.

Referenced by grid_get_attr().

bool feat_is_wall ( int  feat)

True is the feature is a solid wall (not rubble).

References f_info, flags, and tf_has.

Referenced by grid_get_attr().

void square_add_door ( struct chunk c,
int  y,
int  x,
bool  closed 
)
void square_add_stairs ( struct chunk c,
int  y,
int  x,
int  depth 
)
void square_add_trap ( struct chunk c,
int  y,
int  x 
)
void square_add_ward ( struct chunk c,
int  y,
int  x 
)
const char* square_apparent_name ( struct chunk c,
struct player p,
int  y,
int  x 
)
bool square_canputitem ( struct chunk c,
int  y,
int  x 
)

True if the square is an untrapped floor square without items.

References square_isfloor(), square_isplayertrap(), square_iswarded(), and square_object().

Referenced by drop_find_grid(), place_gold(), place_object(), place_random_stairs(), and vault_objects().

bool square_canward ( struct chunk c,
int  y,
int  x 
)

References square_isfloor().

Referenced by effect_handler_RUNE().

bool square_changeable ( struct chunk c,
int  y,
int  x 
)

Determine if a given location may be "destroyed".

Used by destruction spells, and for placing stairs, etc.

References object::artifact, object::next, square_isperm(), square_isshop(), square_isstairs(), and square_object().

Referenced by build_quest_stairs(), and effect_handler_EARTHQUAKE().

void square_close_door ( struct chunk c,
int  y,
int  x 
)

References FEAT_CLOSED, and square_set_feat().

Referenced by do_cmd_close_aux().

void square_destroy ( struct chunk c,
int  y,
int  x 
)
void square_destroy_door ( struct chunk c,
int  y,
int  x 
)
void square_destroy_rubble ( struct chunk c,
int  y,
int  x 
)
void square_destroy_trap ( struct chunk c,
int  y,
int  x 
)
void square_destroy_wall ( struct chunk c,
int  y,
int  x 
)
int square_digging ( struct chunk c,
int  y,
int  x 
)
void square_disable_trap ( struct chunk c,
int  y,
int  x 
)
bool square_dtrap_edge ( struct chunk c,
int  y,
int  x 
)

Checks if a square is at the (inner) edge of a trap detect area.

References square_in_bounds_fully(), and square_isdtrap().

Referenced by prt_dtrap().

void square_earthquake ( struct chunk c,
int  y,
int  x 
)
void square_excise_object ( struct chunk c,
int  y,
int  x,
struct object obj 
)
void square_excise_pile ( struct chunk c,
int  y,
int  x 
)
struct feature* square_feat ( struct chunk c,
int  y,
int  x 
)

OTHER SQUARE FUNCTIONS.

Below are various square-specific functions which are not predicates

References f_info, square::feat, square_in_bounds(), and chunk::squares.

Referenced by find_safety(), move_player(), player_take_terrain_damage(), process_monster_can_move(), and push_object().

void square_force_floor ( struct chunk c,
int  y,
int  x 
)

References FEAT_FLOOR, and square_set_feat().

Referenced by push_object().

void square_forget ( struct chunk c,
int  y,
int  x 
)
bool square_hasgoldvein ( struct chunk c,
int  y,
int  x 
)
bool square_holds_object ( struct chunk c,
int  y,
int  x,
struct object obj 
)

Return true if the given object is on the floor at this grid.

References pile_contains(), square_in_bounds(), and square_object().

Referenced by item_is_available(), object_see(), player_know_object(), and square_know_pile().

bool square_in_bounds ( struct chunk c,
int  y,
int  x 
)
bool square_in_bounds_fully ( struct chunk c,
int  y,
int  x 
)
bool square_is_monster_walkable ( struct chunk c,
int  y,
int  x 
)

True if a monster can walk through the tile.

This is needed for polymorphing. A monster may be on a feature that isn't an empty space, causing problems when it is replaced with a new monster.

References square::feat, feat_is_monster_walkable(), square_in_bounds(), and chunk::squares.

Referenced by place_new_monster_one().

bool square_isbelievedwall ( struct chunk c,
int  y,
int  x 
)

Checks if a square is thought by the player to block projections.

References cave, player::cave, square_in_bounds_fully(), square_isknown(), and square_isprojectable().

Referenced by project_path().

bool square_isbright ( struct chunk c,
int  y,
int  x 
)

True if the cave square is internally lit.

References square::feat, feat_is_bright(), square_in_bounds(), and chunk::squares.

Referenced by cave_known(), and update_view_one().

bool square_isbrokendoor ( struct chunk c,
int  y,
int  x 
)
bool square_iscloseddoor ( struct chunk c,
int  y,
int  x 
)
bool square_isdamaging ( struct chunk c,
int  y,
int  x 
)

True if the cave square can damage the inhabitant - only lava so far.

References square::feat, feat_is_fiery(), square_in_bounds(), and chunk::squares.

Referenced by find_safety(), is_valid_pf(), move_player(), and process_monster_can_move().

bool square_isdiggable ( struct chunk c,
int  y,
int  x 
)

True if the square can be dug: this includes rubble and non-permanent walls.

References square_ismineral(), square_isrubble(), and square_issecretdoor().

Referenced by context_menu_cave(), do_cmd_alter_aux(), do_cmd_tunnel_test(), square_digging(), and twall().

bool square_isdisabledtrap ( struct chunk c,
int  y,
int  x 
)

True if the square is a known, disabled player trap.

References square_isvisibletrap(), and square_trap_timeout().

Referenced by square_isdisarmabletrap().

bool square_isdisarmabletrap ( struct chunk c,
int  y,
int  x 
)
bool square_isdoor ( struct chunk c,
int  y,
int  x 
)
bool square_isdownstairs ( struct chunk c,
int  y,
int  x 
)

True if square is a down stair.

References f_info, square::feat, flags, chunk::squares, and tf_has.

Referenced by context_menu_player(), do_cmd_go_down(), labyrinth_gen(), and textui_process_click().

bool square_isdtrap ( struct chunk c,
int  y,
int  x 
)

True if cave square has been detected for traps.

References square::info, sqinfo_has, square_in_bounds(), and chunk::squares.

Referenced by move_player(), prt_dtrap(), and square_dtrap_edge().

bool square_isempty ( struct chunk c,
int  y,
int  x 
)
bool square_isfeel ( struct chunk c,
int  y,
int  x 
)

True if cave square is a feeling trigger square.

References square::info, sqinfo_has, square_in_bounds(), and chunk::squares.

Referenced by place_feeling(), and update_one().

bool square_isfiery ( struct chunk c,
int  y,
int  x 
)
bool square_isfloor ( struct chunk c,
int  y,
int  x 
)

SQUARE FEATURE PREDICATES.

These functions are used to figure out what kind of square something is, via c->squares[y][x].feat. All direct testing of c->squares[y][x].feat should be rewritten in terms of these functions.

It's often better to use square behavior predicates (written in terms of these functions) instead of these functions directly. For instance, square_isrock() will return false for a secret door, even though it will behave like a rock wall until the player determines it's a door.

Use functions like square_isdiggable, square_iswall, etc. in these cases. True if the square is normal open floor.

References square::feat, feat_is_floor(), and chunk::squares.

Referenced by build_room_of_chambers(), cave_illuminate(), cave_unlight(), count_adj_walls(), drop_find_grid(), effect_handler_CREATE_STAIRS(), effect_handler_MAP_AREA(), generate_starburst_room(), get_debug_command(), next_to_corr(), project_feature_handler_FIRE(), project_feature_handler_MAKE_DOOR(), project_feature_handler_PLASMA(), square_canputitem(), square_canward(), square_isopen(), town_gen_layout(), and wiz_light().

bool square_isglow ( struct chunk c,
int  y,
int  x 
)

True if the square is lit.

References square::info, sqinfo_has, square_in_bounds(), and chunk::squares.

Referenced by become_viewable(), map_info(), and update_view().

bool square_isgranite ( struct chunk c,
int  y,
int  x 
)

True if the square is granite.

References square::feat, feat_is_granite(), and chunk::squares.

Referenced by build_tunnel().

bool square_isinteresting ( struct chunk c,
int  y,
int  x 
)
bool square_isinvis ( struct chunk c,
int  y,
int  x 
)

True if the square has an unknown trap.

References square::info, sqinfo_has, square_in_bounds(), and chunk::squares.

bool square_isknown ( struct chunk c,
int  y,
int  x 
)
bool square_islockeddoor ( struct chunk c,
int  y,
int  x 
)
bool square_ismagma ( struct chunk c,
int  y,
int  x 
)

True if the square is a magma wall.

References square::feat, feat_is_magma(), and chunk::squares.

Referenced by project_feature_handler_KILL_WALL(), and square_ismineral().

bool square_ismark ( struct chunk c,
int  y,
int  x 
)

SQUARE INFO PREDICATES.

These functions tell whether a square is marked with one of the SQUARE_* flags. These flags are mostly used to mark a square with some information about its location or status. True if the square is marked

References square::info, sqinfo_has, square_in_bounds(), and chunk::squares.

Referenced by wiz_light().

bool square_ismineral ( struct chunk c,
int  y,
int  x 
)

True if the square is a mineral wall (magma/quartz).

References square_ismagma(), square_isquartz(), and square_isrock().

Referenced by square_isdiggable(), and square_isstrongwall().

bool square_ismon_restrict ( struct chunk c,
int  y,
int  x 
)

True if cave square has monster restrictions (generation)

References square::info, sqinfo_has, square_in_bounds(), and chunk::squares.

Referenced by pick_and_place_distant_monster().

bool square_isno_esp ( struct chunk c,
int  y,
int  x 
)

True if cave square can't be detected by player ESP.

References square::info, sqinfo_has, square_in_bounds(), and chunk::squares.

Referenced by update_mon().

bool square_isno_map ( struct chunk c,
int  y,
int  x 
)

True if cave square can't be magically mapped by the player.

References square::info, sqinfo_has, square_in_bounds(), and chunk::squares.

Referenced by effect_handler_MAP_AREA().

bool square_isno_teleport ( struct chunk c,
int  y,
int  x 
)

True if cave square can't be teleported from by the player.

References square::info, sqinfo_has, square_in_bounds(), and chunk::squares.

Referenced by effect_handler_TELEPORT().

bool square_isnoflow ( struct chunk c,
int  y,
int  x 
)

True if the cave square doesn't allow monster flow information.

References square::feat, feat_is_no_flow(), square_in_bounds(), and chunk::squares.

Referenced by make_noise().

bool square_isnoscent ( struct chunk c,
int  y,
int  x 
)

True if the cave square doesn't carry player scent.

References square::feat, feat_is_no_scent(), square_in_bounds(), and chunk::squares.

Referenced by update_scent().

bool square_isnotknown ( struct chunk c,
int  y,
int  x 
)

True if the the player's knowledge of the terrain of the square is wrong or missing.

References cave, player::cave, square::feat, NULL, and chunk::squares.

Referenced by effect_handler_DETECT_DOORS(), effect_handler_MAP_AREA(), and wiz_light().

bool square_isobjectholding ( struct chunk c,
int  y,
int  x 
)

True if the square can hold an object.

References square::feat, feat_is_object_holding(), and chunk::squares.

Referenced by floor_carry().

bool square_isopen ( struct chunk c,
int  y,
int  x 
)

SQUARE BEHAVIOR PREDICATES.

These functions define how a given square behaves, e.g. whether it is passable by the player, whether it is diggable, contains items, etc.

These functions use the SQUARE FEATURE PREDICATES (among other info) to make the determination. True if the square is open (a floor square not occupied by a monster).

References square::mon, square_isfloor(), and chunk::squares.

Referenced by lab_is_tunnel(), place_friends(), and square_isempty().

bool square_isopendoor ( struct chunk c,
int  y,
int  x 
)

True if the square is an open door.

References f_info, square::feat, feature::flags, chunk::squares, and tf_has.

Referenced by context_menu_cave(), do_cmd_close(), and do_cmd_close_test().

bool square_ispassable ( struct chunk c,
int  y,
int  x 
)
bool square_isperm ( struct chunk c,
int  y,
int  x 
)
bool square_isplayer ( struct chunk c,
int  y,
int  x 
)

True if the square contains the player.

References square::mon, and chunk::squares.

Referenced by process_monster(), project_feature_handler_MAKE_DOOR(), and project_p().

bool square_isplayertrap ( struct chunk c,
int  y,
int  x 
)
bool square_isproject ( struct chunk c,
int  y,
int  x 
)

True if cave square is marked for projection processing.

References square::info, sqinfo_has, square_in_bounds(), and chunk::squares.

Referenced by project().

bool square_isprojectable ( struct chunk c,
int  y,
int  x 
)
bool square_isquartz ( struct chunk c,
int  y,
int  x 
)

True if the square is a quartz wall.

References square::feat, feat_is_quartz(), and chunk::squares.

Referenced by project_feature_handler_KILL_WALL(), and square_ismineral().

bool square_isrock ( struct chunk c,
int  y,
int  x 
)

True if the square is a normal granite rock wall.

References f_info, square::feat, feature::flags, chunk::squares, and tf_has.

Referenced by build_streamer(), init_cavern(), and square_ismineral().

bool square_isroom ( struct chunk c,
int  y,
int  x 
)

True if the square is part of a room.

References square::info, sqinfo_has, square_in_bounds(), and chunk::squares.

Referenced by alloc_object(), build_tunnel(), cave_room_aux(), get_moves(), next_to_corr(), and try_door().

bool square_isrubble ( struct chunk c,
int  y,
int  x 
)
bool square_issecretdoor ( struct chunk c,
int  y,
int  x 
)

True if the square is a hidden secret door.

These squares appear as if they were granite–when detected a secret door is replaced by a closed door.

References f_info, square::feat, feature::flags, chunk::squares, and tf_has.

Referenced by effect_handler_DETECT_DOORS(), process_monster_can_move(), project_feature_handler_KILL_TRAP(), search(), and square_isdiggable().

bool square_issecrettrap ( struct chunk c,
int  y,
int  x 
)

True if the square is an unknown player trap (it will appear as a floor tile)

References square_isplayertrap(), and square_isvisibletrap().

Referenced by move_player(), and square_note_spot().

bool square_isseen ( struct chunk c,
int  y,
int  x 
)
bool square_isshop ( struct chunk c,
int  y,
int  x 
)
bool square_isstairs ( struct chunk c,
int  y,
int  x 
)
bool square_isstrongwall ( struct chunk c,
int  y,
int  x 
)

True if the square is a permanent wall or one of the "stronger" walls.

The stronger walls are granite, magma and quartz. This excludes things like secret doors and rubble.

References square_in_bounds(), square_ismineral(), and square_isperm().

Referenced by possible_doorway(), and try_door().

bool square_istrap ( struct chunk c,
int  y,
int  x 
)
bool square_istrappable ( struct chunk c,
int  y,
int  x 
)

True if the square can hold a trap.

References square::feat, feat_is_trap_holding(), and chunk::squares.

Referenced by square_player_trap_allowed().

bool square_isupstairs ( struct chunk c,
int  y,
int  x 
)

True if square is an up stair.

References f_info, square::feat, flags, chunk::squares, and tf_has.

Referenced by context_menu_player(), do_cmd_go_up(), labyrinth_gen(), and textui_process_click().

bool square_isvault ( struct chunk c,
int  y,
int  x 
)

True if the square is part of a vault.

This doesn't say what kind of square it is, just that it is part of a vault.

References square::info, sqinfo_has, square_in_bounds(), and chunk::squares.

Referenced by effect_handler_TELEPORT(), generate_starburst_room(), join_region(), and square_isstart().

bool square_isview ( struct chunk c,
int  y,
int  x 
)
bool square_isvisibletrap ( struct chunk c,
int  y,
int  x 
)
bool square_iswall ( struct chunk c,
int  y,
int  x 
)

True if the square is a wall square (impedes the player).

This function is the logical negation of square_isprojectable().

References square_in_bounds(), and square_isprojectable().

Referenced by become_viewable(), build_quest_stairs(), next_to_walls(), path_analyse(), place_feeling(), process_monster_can_move(), project_feature_handler_KILL_WALL(), and update_view_one().

bool square_iswall_inner ( struct chunk c,
int  y,
int  x 
)

True if cave square is an inner wall (generation)

References square::info, sqinfo_has, square_in_bounds(), and chunk::squares.

Referenced by build_room_of_chambers(), and make_chamber().

bool square_iswall_outer ( struct chunk c,
int  y,
int  x 
)

True if cave square is an outer wall (generation)

References square::info, sqinfo_has, square_in_bounds(), and chunk::squares.

Referenced by build_room_of_chambers(), and make_inner_chamber_wall().

bool square_iswall_solid ( struct chunk c,
int  y,
int  x 
)

True if cave square is a solid wall (generation)

References square::info, sqinfo_has, square_in_bounds(), and chunk::squares.

Referenced by build_room_of_chambers(), and make_inner_chamber_wall().

bool square_iswarded ( struct chunk c,
int  y,
int  x 
)
void square_know_pile ( struct chunk c,
int  y,
int  x 
)
void square_mark ( struct chunk c,
int  y,
int  x 
)

References square::info, sqinfo_on, and chunk::squares.

Referenced by wiz_light().

void square_memorize ( struct chunk c,
int  y,
int  x 
)
struct monster* square_monster ( struct chunk c,
int  y,
int  x 
)
struct object* square_object ( struct chunk c,
int  y,
int  x 
)
void square_open_door ( struct chunk c,
int  y,
int  x 
)
void square_remove_ward ( struct chunk c,
int  y,
int  x 
)
bool square_seemslikewall ( struct chunk c,
int  y,
int  x 
)
void square_sense_pile ( struct chunk c,
int  y,
int  x 
)

Sense the existence of objects on a grid in the current level.

References cave, object::next, object_sense(), and square_object().

Referenced by effect_handler_SENSE_OBJECTS(), and wiz_light().

void square_set_feat ( struct chunk c,
int  y,
int  x,
int  feat 
)
int square_shopnum ( struct chunk c,
int  y,
int  x 
)
void square_smash_door ( struct chunk c,
int  y,
int  x 
)
struct trap* square_trap ( struct chunk c,
int  y,
int  x 
)
void square_tunnel_wall ( struct chunk c,
int  y,
int  x 
)

References FEAT_FLOOR, and square_set_feat().

Referenced by twall().

void square_unlock_door ( struct chunk c,
int  y,
int  x 
)
void square_unmark ( struct chunk c,
int  y,
int  x 
)
void square_upgrade_mineral ( struct chunk c,
int  y,
int  x 
)

Add visible treasure to a mineral square.

References square::feat, FEAT_MAGMA, FEAT_MAGMA_K, FEAT_QUARTZ, FEAT_QUARTZ_K, square_set_feat(), and chunk::squares.

Referenced by build_streamer().

bool square_wasseen ( struct chunk c,
int  y,
int  x 
)

True if the cave square was seen before the current update.

References square::info, sqinfo_has, square_in_bounds(), and chunk::squares.

Referenced by update_one().