cmds.h File Reference

Header for game command files. More...

#include "cave.h"
#include "cmd-core.h"

Go to the source code of this file.


void do_cmd_go_up (struct command *cmd)
 Go up one level.
void do_cmd_go_down (struct command *cmd)
 Go down one level.
bool search (bool verbose)
 Search for hidden things.
void do_cmd_search (struct command *cmd)
 Simple command to "search" for one turn.
void do_cmd_toggle_search (struct command *cmd)
 Toggle search mode.
void do_cmd_open (struct command *cmd)
 Open a closed/locked/jammed door or a closed/locked chest.
void do_cmd_close (struct command *cmd)
 Close an open door.
void do_cmd_tunnel (struct command *cmd)
 Tunnel through "walls" (including rubble and doors, secret or otherwise)
void do_cmd_disarm (struct command *cmd)
 Disarms a trap, or a chest.
void do_cmd_alter_aux (int dir)
 Manipulate an adjacent grid in some way.
void do_cmd_alter (struct command *cmd)
void move_player (int dir, bool disarm)
 Move player in the given direction.
void do_cmd_walk (struct command *cmd)
 Walk in the given direction.
void do_cmd_jump (struct command *cmd)
 Walk into a trap.
void do_cmd_run (struct command *cmd)
 Start running.
void do_cmd_pathfind (struct command *cmd)
 Start running with pathfinder.
void do_cmd_hold (struct command *cmd)
 Stay still.
void do_cmd_rest (struct command *cmd)
 Rest (restores hit points and mana and such)
void do_cmd_sleep (struct command *cmd)
 Spend a turn doing nothing.
void display_feeling (bool obj_only)
 Display the feeling.
void do_cmd_feeling (void)
void do_cmd_wizard (void)
 Toggle wizard mode.
void do_cmd_suicide (struct command *cmd)
 Commit suicide.
void do_cmd_version (void)
 Mention the current version.
void do_cmd_note (void)
 Record the player's thoughts as a note.
void do_cmd_uninscribe (struct command *cmd)


void do_cmd_inscribe (struct command *cmd)
 Add inscription.
void do_cmd_autoinscribe (struct command *cmd)
 Autoinscribe all appropriate objects.
void do_cmd_takeoff (struct command *cmd)

Taking off/putting on

void wield_item (struct object *obj, int slot)
 Wield or wear a single item from the pack or floor.
void do_cmd_wield (struct command *cmd)
 Wield or wear an item.
void do_cmd_drop (struct command *cmd)
 Drop an item.
void do_cmd_read_scroll (struct command *cmd)
 Read a scroll.
void do_cmd_use_staff (struct command *cmd)
 Use a staff.
void do_cmd_aim_wand (struct command *cmd)
 Aim a wand.
void do_cmd_zap_rod (struct command *cmd)
 Zap a rod.
void do_cmd_activate (struct command *cmd)
 Activate an object.
void do_cmd_eat_food (struct command *cmd)
 Eat some food.
void do_cmd_quaff_potion (struct command *cmd)
 Quaff a potion.
void do_cmd_use (struct command *cmd)
 Use any usable item.
void do_cmd_refill (struct command *cmd)
void do_cmd_cast (struct command *cmd)

Spell casting

void do_cmd_study_spell (struct command *cmd)
 Gain a specific spell, specified by spell number (for mages).
void do_cmd_study_book (struct command *cmd)
 Gain a random spell from the given book (for priests)
void do_cmd_study (struct command *cmd)
 Choose the way to study.
int do_autopickup (void)
 Pick up everything on the floor that requires no player action.
void do_cmd_pickup (struct command *cmd)
 Pick up objects at the player's request.
void do_cmd_autopickup (struct command *cmd)
 Pick up or look at objects on a square when the player steps onto it.

Detailed Description

Header for game command files.

Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke Copyright (c) 2007-9 Andi Sidwell, Chris Carr, Ed Graham, Erik Osheim

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

void display_feeling ( bool  obj_only)

Display the feeling.

Players always get a monster feeling. Object feelings are delayed until the player has explored some of the level.

References cave, player::depth, chunk::feeling, angband_constants::feeling_need, chunk::feeling_squares, mon_feeling_text, msg, N_ELEMENTS, obj_feeling_text, OPT, and z_info.

Referenced by do_cmd_feeling(), on_new_level(), and update_one().

int do_autopickup ( void  )

Pick up everything on the floor that requires no player action.

References auto_pickup_okay(), cave, disturb(), ignore_item_ok(), object::next, player_pickup_aux(), player_pickup_gold(), player::px, player::py, square_object(), and TRUE.

Referenced by do_cmd_autopickup(), do_cmd_hold(), and do_cmd_pickup().

void do_cmd_activate ( struct command cmd)
void do_cmd_aim_wand ( struct command cmd)
void do_cmd_alter ( struct command cmd)
void do_cmd_alter_aux ( int  dir)

Manipulate an adjacent grid in some way.

Attack monsters, tunnel through walls, disarm traps, open doors.

This command must always take energy, to prevent free detection of invisible monsters.

The "semantics" of this command must be chosen before the player is confused, and it must be verified against the new grid.

References cave, ddx, ddy, disturb(), do_cmd_disarm_aux(), do_cmd_open_aux(), do_cmd_tunnel_aux(), player_upkeep::energy_use, FALSE, square::mon, angband_constants::move_energy, msg, player_confuse_dir(), player::px, player::py, py_attack(), square_iscloseddoor(), square_isdiggable(), square_isknowntrap(), chunk::squares, player::upkeep, and z_info.

Referenced by do_cmd_alter(), and move_player().

void do_cmd_autoinscribe ( struct command cmd)
void do_cmd_autopickup ( struct command cmd)

Pick up or look at objects on a square when the player steps onto it.

References do_autopickup(), player_upkeep::energy_use, EVENT_SEEFLOOR, event_signal(), angband_constants::move_energy, player::upkeep, and z_info.

void do_cmd_cast ( struct command cmd)
void do_cmd_close ( struct command cmd)
void do_cmd_disarm ( struct command cmd)
void do_cmd_drop ( struct command cmd)
void do_cmd_eat_food ( struct command cmd)

Eat some food.

References cmd_get_item(), CMD_OK, tval_is_edible(), use_aux(), USE_FLOOR, USE_INVEN, and USE_SINGLE.

Referenced by do_cmd_use().

void do_cmd_feeling ( void  )

References display_feeling(), and FALSE.

void do_cmd_go_down ( struct command cmd)
void do_cmd_go_up ( struct command cmd)
void do_cmd_hold ( struct command cmd)
void do_cmd_inscribe ( struct command cmd)
void do_cmd_jump ( struct command cmd)
void do_cmd_note ( void  )

Record the player's thoughts as a note.

This both displays the note back to the player and adds it to the game log. Two fancy note types are supported: notes beginning with "/say" will be written as 'Frodo says: "____"', and notes beginning with "/me" will be written as 'Frodo ____'.

References player_other::full_name, get_string(), history_add(), msg, my_strcpy(), note(), op_ptr, and strnfmt().

void do_cmd_open ( struct command cmd)
void do_cmd_pathfind ( struct command cmd)

Start running with pathfinder.

Note that running while confused is not allowed.

References cmd_get_arg_point(), findpath(), PU_TORCH, run_step(), player_upkeep::running, player_upkeep::running_withpathfind, player::timed, TRUE, player_upkeep::update, and player::upkeep.

void do_cmd_pickup ( struct command cmd)
void do_cmd_quaff_potion ( struct command cmd)

Quaff a potion.

References cmd_get_item(), CMD_OK, tval_is_potion(), use_aux(), USE_FLOOR, USE_INVEN, and USE_SINGLE.

Referenced by do_cmd_use().

void do_cmd_read_scroll ( struct command cmd)
void do_cmd_refill ( struct command cmd)
void do_cmd_rest ( struct command cmd)
void do_cmd_run ( struct command cmd)

Start running.

Note that running while confused is not allowed.

References cmd_get_direction(), CMD_OK, ddx, ddy, do_cmd_walk_test(), FALSE, player_confuse_dir(), player::px, player::py, run_step(), and TRUE.

void do_cmd_search ( struct command cmd)

Simple command to "search" for one turn.

References player_upkeep::energy_use, angband_constants::move_energy, search(), TRUE, player::upkeep, and z_info.

void do_cmd_sleep ( struct command cmd)

Spend a turn doing nothing.

References player_upkeep::energy_use, angband_constants::move_energy, player::upkeep, and z_info.

void do_cmd_study ( struct command cmd)

Choose the way to study.

Choose life. Choose a career. Choose family. Choose a fucking big monster, choose orc shamans, kobolds, dark elven druids, and Mim, Betrayer of Turin.

References do_cmd_study_book(), do_cmd_study_spell(), and player_has.

void do_cmd_study_book ( struct command cmd)
void do_cmd_study_spell ( struct command cmd)
void do_cmd_suicide ( struct command cmd)

Commit suicide.

References player::died_from, player::is_dead, my_strcpy(), and TRUE.

void do_cmd_takeoff ( struct command cmd)
void do_cmd_toggle_search ( struct command cmd)
void do_cmd_tunnel ( struct command cmd)

Tunnel through "walls" (including rubble and doors, secret or otherwise)

Digging is very difficult without a "digger" weapon, but can be accomplished by strong players using heavy weapons.

References cave, cmd_get_direction(), ddx, ddy, disturb(), do_cmd_tunnel_aux(), do_cmd_tunnel_test(), player_upkeep::energy_use, FALSE, square::mon, angband_constants::move_energy, msg, player_confuse_dir(), player::px, player::py, py_attack(), chunk::squares, player::upkeep, and z_info.

void do_cmd_uninscribe ( struct command cmd)
void do_cmd_use ( struct command cmd)
void do_cmd_use_staff ( struct command cmd)
void do_cmd_version ( void  )

Mention the current version.

References buildver, and msg.

void do_cmd_walk ( struct command cmd)
void do_cmd_wield ( struct command cmd)
void do_cmd_wizard ( void  )
void do_cmd_zap_rod ( struct command cmd)
void move_player ( int  dir,
bool  disarm 
bool search ( bool  verbose)

Search for hidden things.

Returns true if a search was attempted, returns false when the player has a 0% chance of finding anything. Prints messages for negative confirmation when verbose mode is requested.

References cave, disturb(), FALSE, is_trapped_chest(), msg, object::next, no_light(), object_is_known(), object_notice_everything(), place_closed_door(), player::px, player::py, randint0, SKILL_SEARCH, player_state::skills, square_issecretdoor(), square_issecrettrap(), square_object(), square_reveal_trap(), player::state, player::timed, and TRUE.

Referenced by do_cmd_hold(), do_cmd_search(), do_cmd_tunnel_aux(), and move_player().

void wield_item ( struct object obj,
int  slot