Angband
Enumerations | Functions | Variables
obj-chest.h File Reference

Encapsulation of chest-related functions. More...

Go to the source code of this file.

Enumerations

enum  chest_query { CHEST_ANY, CHEST_OPENABLE, CHEST_TRAPPED }
 Chest check types. More...
 

Functions

char * chest_trap_name (const struct object *obj)
 

Chest trap information

More...
 
bool is_trapped_chest (const struct object *obj)
 Determine if a chest is trapped. More...
 
bool is_locked_chest (const struct object *obj)
 Determine if a chest is locked or trapped. More...
 
int pick_chest_traps (struct object *obj)
 Pick a set of chest traps Currently this only depends on the level of the chest object. More...
 
void unlock_chest (struct object *obj)
 Unlock a chest. More...
 
struct objectchest_check (struct loc grid, enum chest_query check_type)
 Determine if a grid contains a chest matching the query type, and return a pointer to the first such chest. More...
 
int count_chests (struct loc *grid, enum chest_query check_type)
 Return the number of grids holding a chests around (or under) the character. More...
 
bool do_cmd_open_chest (struct loc grid, struct object *obj)
 Attempt to open the given chest at the given location. More...
 
bool do_cmd_disarm_chest (struct object *obj)
 Attempt to disarm the chest at the given location Assume there is no monster blocking the destination. More...
 

Variables

struct chest_trapchest_traps
 
struct chest * chests
 
struct file_parser chest_trap_parser
 

Detailed Description

Encapsulation of chest-related functions.

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

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.

Enumeration Type Documentation

◆ chest_query

Chest check types.

Enumerator
CHEST_ANY 
CHEST_OPENABLE 
CHEST_TRAPPED 

Function Documentation

◆ chest_check()

struct object* chest_check ( struct loc  grid,
enum chest_query  check_type 
)

Determine if a grid contains a chest matching the query type, and return a pointer to the first such chest.

References cave, CHEST_ANY, CHEST_OPENABLE, CHEST_TRAPPED, ignore_item_ok(), is_trapped_chest(), object::known, object::next, object::pval, square_object(), and tval_is_chest().

Referenced by context_menu_cave(), count_chests(), do_cmd_disarm(), and do_cmd_open().

◆ chest_trap_name()

char* chest_trap_name ( const struct object obj)


Chest trap information

The name of a chest trap

References chest_traps, chest_trap::name, chest_trap::next, chest_trap::pval, and object::pval.

Referenced by obj_desc_chest().

◆ count_chests()

int count_chests ( struct loc grid,
enum chest_query  check_type 
)

Return the number of grids holding a chests around (or under) the character.

If requested, count only trapped chests.

References chest_check(), ddgrid_ddd, player::grid, and loc_sum().

Referenced by do_cmd_disarm(), and do_cmd_open().

◆ do_cmd_disarm_chest()

bool do_cmd_disarm_chest ( struct object obj)

Attempt to disarm the chest at the given location Assume there is no monster blocking the destination.

The calculation of difficulty assumes that there are 6 types of chest trap; if more are added, it will need adjusting.

Returns true if repeated commands may continue

References chest_trap(), EVENT_INPUT_FLUSH, event_signal(), is_trapped_chest(), object::known, chest_trap::magic, msg, msgt(), chest_trap::next, no_light(), player_exp_gain(), chest_trap::pval, object::pval, randint0, SKILL_DISARM_MAGIC, SKILL_DISARM_PHYS, player_state::skills, player::state, and player::timed.

Referenced by do_cmd_disarm().

◆ do_cmd_open_chest()

bool do_cmd_open_chest ( struct loc  grid,
struct object obj 
)

Attempt to open the given chest at the given location.

Assume there is no monster blocking the destination

Returns true if repeated commands may continue

References cave, chest_death(), chest_trap(), equip_learn_flag(), EVENT_INPUT_FLUSH, event_signal(), flag, i, object::known, msgt(), no_light(), object::notice, player_upkeep::notice, OBJ_NOTICE_IGNORE, player_exp_gain(), player_is_trapsafe(), player_of_has(), PN_IGNORE, object::pval, randint0, SKILL_DISARM_PHYS, player_state::skills, square_light_spot(), player::state, player::timed, and player::upkeep.

Referenced by do_cmd_open().

◆ is_locked_chest()

bool is_locked_chest ( const struct object obj)

Determine if a chest is locked or trapped.

References ignore_item_ok(), object::pval, and tval_is_chest().

Referenced by context_menu_cave(), and project_object_handler_KILL_TRAP().

◆ is_trapped_chest()

bool is_trapped_chest ( const struct object obj)

Determine if a chest is trapped.

References ignore_item_ok(), object::pval, and tval_is_chest().

Referenced by chest_check(), do_cmd_disarm_chest(), effect_handler_DETECT_TRAPS(), and search().

◆ pick_chest_traps()

int pick_chest_traps ( struct object obj)

Pick a set of chest traps Currently this only depends on the level of the chest object.

References object::kind, object_kind::level, one_in_, and pick_one_chest_trap().

Referenced by apply_magic().

◆ unlock_chest()

void unlock_chest ( struct object obj)

Unlock a chest.

References object::pval.

Referenced by project_object_handler_KILL_TRAP().

Variable Documentation

◆ chest_trap_parser

struct file_parser chest_trap_parser

◆ chest_traps

struct chest_trap* chest_traps

◆ chests

struct chest* chests