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

Encapsulation of chest-related functions. More...

Go to the source code of this file.

Macros

#define CHEST_LOSE_STR   0x01
 Chest trap flags (see "obj-chest.c")
#define CHEST_LOSE_CON   0x02
#define CHEST_POISON   0x04
#define CHEST_PARALYZE   0x08
#define CHEST_EXPLODE   0x10
#define CHEST_SUMMON   0x20

Enumerations

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

Functions

byte chest_trap_type (const object_type *o_ptr)
bool is_trapped_chest (const object_type *o_ptr)
bool is_locked_chest (const object_type *o_ptr)
void unlock_chest (object_type *o_ptr)
 Unlock a chest.
struct objectchest_check (int y, int x, 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.
int count_chests (int *y, int *x, enum chest_query check_type)
 Return the number of grids holding a chests around (or under) the character.
bool do_cmd_open_chest (int y, int x, struct object *obj)
 Attempt to open the given chest at the given location.
bool do_cmd_disarm_chest (int y, int x, struct object *obj)
 Attempt to disarm the chest at the given location.

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.

Macro Definition Documentation

#define CHEST_EXPLODE   0x10

Referenced by chest_trap(), and obj_desc_chest().

#define CHEST_LOSE_CON   0x02

Referenced by chest_trap(), and obj_desc_chest().

#define CHEST_LOSE_STR   0x01

Chest trap flags (see "obj-chest.c")

Referenced by chest_trap(), and obj_desc_chest().

#define CHEST_PARALYZE   0x08

Referenced by chest_trap(), and obj_desc_chest().

#define CHEST_POISON   0x04

Referenced by chest_trap(), and obj_desc_chest().

#define CHEST_SUMMON   0x20

Referenced by chest_trap(), and obj_desc_chest().

Enumeration Type Documentation

Chest check types.

Enumerator:
CHEST_ANY 
CHEST_OPENABLE 
CHEST_TRAPPED 

Function Documentation

struct object* chest_check ( int  y,
int  x,
enum chest_query  check_type 
)
read

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, is_trapped_chest(), object::next, object_is_known(), object::pval, square_object(), and tval_is_chest().

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

byte chest_trap_type ( const object_type o_ptr)
int count_chests ( int y,
int x,
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(), ddx_ddd, ddy_ddd, player::px, and player::py.

Referenced by do_cmd_disarm(), and do_cmd_open().

bool do_cmd_disarm_chest ( int  y,
int  x,
struct object obj 
)

Attempt to disarm the chest at the given location.

Assume there is no monster blocking the destination

Returns TRUE if repeated commands may continue

References chest_trap(), EVENT_INPUT_FLUSH, event_signal(), FALSE, i, is_trapped_chest(), msg, msgt(), no_light(), object_is_known(), player_exp_gain(), object::pval, randint0, randint1, SKILL_DISARM, player_state::skills, player::state, player::timed, and TRUE.

Referenced by do_cmd_disarm().

bool do_cmd_open_chest ( int  y,
int  x,
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(), EVENT_INPUT_FLUSH, event_signal(), FALSE, flag, i, object::ignore, msgt(), no_light(), player_upkeep::notice, player_exp_gain(), PN_IGNORE, object::pval, randint0, SKILL_DISARM, player_state::skills, square_light_spot(), player::state, player::timed, TRUE, and player::upkeep.

Referenced by do_cmd_open().

bool is_locked_chest ( const object_type o_ptr)
bool is_trapped_chest ( const object_type o_ptr)
void unlock_chest ( object_type o_ptr)