summaryrefslogtreecommitdiff
path: root/src/cmd2.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd2.cc')
-rw-r--r--src/cmd2.cc774
1 files changed, 227 insertions, 547 deletions
diff --git a/src/cmd2.cc b/src/cmd2.cc
index a348c221..c57fcb2e 100644
--- a/src/cmd2.cc
+++ b/src/cmd2.cc
@@ -12,6 +12,7 @@
#include "cave.hpp"
#include "cave_type.hpp"
#include "cmd1.hpp"
+#include "cmd5.hpp"
#include "dungeon_info_type.hpp"
#include "dungeon_flag.hpp"
#include "feature_flag.hpp"
@@ -45,16 +46,17 @@
#include "stats.hpp"
#include "tables.hpp"
#include "util.hpp"
-#include "util.h"
-#include "variable.h"
#include "variable.hpp"
#include "wilderness_map.hpp"
#include "wilderness_type_info.hpp"
#include "xtra1.hpp"
#include "xtra2.hpp"
+#include "z-form.hpp"
#include "z-rand.hpp"
+#include "z-term.hpp"
#include <chrono>
+#include <fmt/format.h>
#include <thread>
using std::this_thread::sleep_for;
@@ -65,23 +67,23 @@ void do_cmd_immovable_special();
/*
* Try to bash an altar
*/
-static bool_ do_cmd_bash_altar(int y, int x)
+static bool do_cmd_bash_altar(int y, int x)
{
msg_print("Are you mad? You want to anger the gods?");
- return (FALSE);
+ return false;
}
/*
* Try to bash a fountain
*/
-static bool_ do_cmd_bash_fountain(int y, int x)
+static bool do_cmd_bash_fountain(int y, int x)
{
auto const &r_info = game->edit_data.r_info;
int bash, temp;
- bool_ more = TRUE;
+ bool more = true;
auto r_ptr = &r_info[p_ptr->body_monster];
@@ -90,7 +92,7 @@ static bool_ do_cmd_bash_fountain(int y, int x)
{
msg_print("You cannot do that.");
- return (FALSE);
+ return false;
}
/* Take a turn */
@@ -118,7 +120,7 @@ static bool_ do_cmd_bash_fountain(int y, int x)
fire_ball(GF_WATER, 5, damroll(6, 8), 2);
cave_set_feat(y, x, FEAT_DEEP_WATER);
- more = FALSE;
+ more = false;
}
return (more);
@@ -127,10 +129,10 @@ static bool_ do_cmd_bash_fountain(int y, int x)
/*
* Stair hooks
*/
-static bool_ stair_hooks(stairs_direction direction)
+static bool stair_hooks(stairs_direction direction)
{
hook_stair_in in = { direction };
- hook_stair_out out = { TRUE }; /* Allow by default */
+ hook_stair_out out = { true }; /* Allow by default */
process_hooks_new(HOOK_STAIR, &in, &out);
return (!out.allow);
}
@@ -165,8 +167,9 @@ static bool ask_leave()
void do_cmd_go_up()
{
auto const &d_info = game->edit_data.d_info;
+ auto const &dungeon_flags = game->dungeon_flags;
- bool_ go_up = FALSE, go_up_many = FALSE, prob_traveling = FALSE;
+ bool go_up = false, go_up_many = false, prob_traveling = false;
cave_type *c_ptr;
@@ -189,7 +192,7 @@ void do_cmd_go_up()
{
if (!dun_level)
{
- go_up = TRUE;
+ go_up = true;
}
else if (dungeon_flags & DF_ASK_LEAVE)
{
@@ -197,7 +200,7 @@ void do_cmd_go_up()
}
else if (ask_leave())
{
- go_up = TRUE;
+ go_up = true;
}
}
@@ -206,7 +209,7 @@ void do_cmd_go_up()
{
if (dun_level == 1)
{
- go_up = TRUE;
+ go_up = true;
}
else if (dungeon_flags & DF_ASK_LEAVE)
{
@@ -214,7 +217,7 @@ void do_cmd_go_up()
}
else if (ask_leave())
{
- go_up_many = TRUE;
+ go_up_many = true;
}
}
@@ -231,7 +234,7 @@ void do_cmd_go_up()
dun_level = 0;
p_ptr->oldpx = 0;
p_ptr->oldpy = 0;
- p_ptr->leaving = TRUE;
+ p_ptr->leaving = true;
return;
}
@@ -248,11 +251,11 @@ void do_cmd_go_up()
return;
}
- prob_traveling = TRUE;
+ prob_traveling = true;
if (ask_leave())
{
- go_up = TRUE;
+ go_up = true;
}
}
else
@@ -284,9 +287,9 @@ void do_cmd_go_up()
/* Create a way back */
if (go_up_many)
- create_down_shaft = TRUE;
+ create_down_shaft = true;
else
- create_down_stair = TRUE;
+ create_down_stair = true;
/* New depth */
if (go_up)
@@ -306,15 +309,15 @@ void do_cmd_go_up()
}
/* Leaving */
- p_ptr->leaving = TRUE;
+ p_ptr->leaving = true;
}
}
/*
- * Returns TRUE if we are in the Between...
+ * Returns true if we are in the Between...
*/
-static bool_ between_effect()
+static bool between_effect()
{
byte bx, by;
@@ -333,26 +336,26 @@ static bool_ between_effect()
/* To avoid being teleported back */
energy_use = 100;
- return (TRUE);
+ return true;
}
else if (cave[p_ptr->py][p_ptr->px].feat == FEAT_BETWEEN2)
{
between_exit *be_ptr = &between_exits[cave[p_ptr->py][p_ptr->px].special];
- p_ptr->wild_mode = FALSE;
+ p_ptr->wild_mode = false;
p_ptr->wilderness_x = be_ptr->wild_x;
p_ptr->wilderness_y = be_ptr->wild_y;
p_ptr->oldpx = p_ptr->px = be_ptr->px;
p_ptr->oldpy = p_ptr->py = be_ptr->py;
dungeon_type = be_ptr->d_idx;
dun_level = be_ptr->level;
- p_ptr->leaving = TRUE;
+ p_ptr->leaving = true;
- return (TRUE);
+ return true;
}
else
- return (FALSE);
+ return false;
}
/*
@@ -361,10 +364,11 @@ static bool_ between_effect()
void do_cmd_go_down()
{
auto const &d_info = game->edit_data.d_info;
+ auto const &dungeon_flags = game->dungeon_flags;
cave_type *c_ptr;
- bool_ go_down = FALSE, go_down_many = FALSE, prob_traveling = FALSE;
+ bool go_down = false, go_down_many = false, prob_traveling = false;
char i;
@@ -402,7 +406,7 @@ void do_cmd_go_down()
{
if (!dun_level)
{
- go_down = TRUE;
+ go_down = true;
/* Save old player position */
p_ptr->oldpx = p_ptr->px;
@@ -412,7 +416,7 @@ void do_cmd_go_down()
{
if (ask_leave())
{
- go_down_many = TRUE;
+ go_down_many = true;
}
}
}
@@ -426,7 +430,7 @@ void do_cmd_go_down()
}
if (!dun_level)
{
- go_down = TRUE;
+ go_down = true;
/* Save old player position */
p_ptr->oldpx = p_ptr->px;
@@ -436,7 +440,7 @@ void do_cmd_go_down()
{
if (ask_leave())
{
- go_down = TRUE;
+ go_down = true;
}
}
}
@@ -461,11 +465,11 @@ void do_cmd_go_down()
return;
}
- prob_traveling = TRUE;
+ prob_traveling = true;
if (ask_leave())
{
- go_down = TRUE;
+ go_down = true;
}
}
@@ -551,221 +555,23 @@ void do_cmd_go_down()
}
/* Leaving */
- p_ptr->leaving = TRUE;
+ p_ptr->leaving = true;
}
}
/*
- * Determine if a grid contains a chest
+ * Return true if the given grid is an open door
*/
-static s16b chest_check(int y, int x)
-{
- cave_type *c_ptr = &cave[y][x];
-
- /* Scan all objects in the grid */
- for (auto const this_o_idx: c_ptr->o_idxs)
- {
- object_type * o_ptr;
-
- /* Acquire object */
- o_ptr = &o_list[this_o_idx];
-
- /* Skip unknown chests XXX XXX */
- /* if (!o_ptr->marked) continue; */
-
- /* Check for chest */
- if (o_ptr->tval == TV_CHEST) return (this_o_idx);
- }
-
- /* No chest */
- return (0);
-}
-
-
-/*
- * Allocates objects upon opening a chest -BEN-
- *
- * Disperse treasures from the given chest, centered at (x,y).
- *
- * Small chests often contain "gold", while Large chests always contain
- * items. Wooden chests contain 2 items, Iron chests contain 4 items,
- * and Steel chests contain 6 items. The "value" of the items in a
- * chest is based on the "power" of the chest, which is in turn based
- * on the level on which the chest is generated.
- */
-static void chest_death(int y, int x, s16b o_idx)
-{
- auto const &d_info = game->edit_data.d_info;
-
- int number;
-
- bool_ small;
-
- object_type forge;
- object_type *q_ptr;
-
- object_type *o_ptr = &o_list[o_idx];
-
-
- /* Small chests often hold "gold" */
- small = (o_ptr->sval < SV_CHEST_MIN_LARGE);
-
- /* Determine how much to drop (see above) */
- number = (o_ptr->sval % SV_CHEST_MIN_LARGE) * 2;
-
- /* Zero pval means empty chest */
- if (!o_ptr->pval) number = 0;
-
- /* Opening a chest */
- opening_chest = TRUE;
-
- /* Determine the "value" of the items */
- object_level = ABS(o_ptr->pval) + 10;
-
- /* Drop some objects (non-chests) */
- for (; number > 0; --number)
- {
- /* Get local object */
- q_ptr = &forge;
-
- /* Wipe the object */
- object_wipe(q_ptr);
-
- /* Small chests often drop gold */
- if (small && (rand_int(100) < 75))
- {
- /* Make some gold */
- if (!make_gold(q_ptr)) continue;
- }
-
- /* Otherwise drop an item */
- else
- {
- /* Make an object */
- if (!make_object(q_ptr, FALSE, FALSE, d_info[dungeon_type].objs))
- continue;
- }
-
- /* Drop it in the dungeon */
- drop_near(q_ptr, -1, y, x);
- }
-
- /* Reset the object level */
- object_level = dun_level;
-
- /* No longer opening a chest */
- opening_chest = FALSE;
-
- /* Empty */
- o_ptr->pval = 0;
- o_ptr->pval2 = 0;
-
- /* Known */
- object_known(o_ptr);
-}
-
-
-/*
- * 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
- */
-static bool_ do_cmd_open_chest(int y, int x, s16b o_idx)
-{
- auto const &r_info = game->edit_data.r_info;
-
- int i, j;
-
- bool_ flag = TRUE;
-
- bool_ more = FALSE;
-
- object_type *o_ptr = &o_list[o_idx];
-
- auto r_ptr = &r_info[p_ptr->body_monster];
-
-
- if ((p_ptr->body_monster != 0) && !(r_ptr->flags & RF_OPEN_DOOR))
- {
- msg_print("You cannot open chests.");
-
- return (FALSE);
- }
-
- /* Take a turn */
- energy_use = 100;
-
- /* Attempt to unlock it */
- if (o_ptr->pval > 0)
- {
- /* Assume locked, and thus not open */
- flag = FALSE;
-
- /* Get the "disarm" factor */
- i = 100;
-
- /* Penalize some conditions */
- if (p_ptr->blind || no_lite()) i = i / 10;
- if (p_ptr->confused || p_ptr->image) i = i / 10;
-
- /* Extract the difficulty */
- j = i - o_ptr->pval;
-
- /* Always have a small chance of success */
- if (j < 2) j = 2;
-
- /* Success -- May still have traps */
- if (rand_int(100) < j)
- {
- msg_print("You have picked the lock.");
- gain_exp(1);
- flag = TRUE;
- }
-
- /* Failure -- Keep trying */
- else
- {
- /* We may continue repeating */
- more = TRUE;
-
- flush_on_failure();
-
- msg_print("You failed to pick the lock.");
- }
- }
-
- /* Allowed to open */
- if (flag)
- {
- /* Let the Chest drop items */
- chest_death(y, x, o_idx);
- }
-
- /* Result */
- return (more);
-}
-
-
-/*
- * Original code by TNB, improvement for Angband 2.9.3 by rr9
- * Slightly modified for ToME because of its trap implementation
- */
-
-/*
- * Return TRUE if the given grid is an open door
- */
-static bool_ is_open(cave_type *c_ptr)
+static bool is_open(cave_type *c_ptr)
{
return (c_ptr->feat == FEAT_OPEN);
}
/*
- * Return TRUE if the given grid is a closed door
+ * Return true if the given grid is a closed door
*/
-static bool_ is_closed(cave_type *c_ptr)
+static bool is_closed(cave_type *c_ptr)
{
byte feat;
@@ -779,8 +585,8 @@ static bool_ is_closed(cave_type *c_ptr)
* Return the number of doors/traps around (or under)
* the character using the filter function 'test'
*/
-static int count_feats(int *y, int *x, bool_ (*test) (cave_type *c_ptr),
- bool_ under)
+static int count_feats(int *y, int *x, bool (*test) (cave_type *c_ptr),
+ bool under)
{
int d;
@@ -826,50 +632,6 @@ static int count_feats(int *y, int *x, bool_ (*test) (cave_type *c_ptr),
/*
- * Return the number of chests around (or under) the character.
- * If requested, count only trapped chests.
- */
-static int count_chests(int *y, int *x, bool_ trapped)
-{
- int d, count, o_idx;
-
- object_type *o_ptr;
-
-
- /* Count how many matches */
- count = 0;
-
- /* Check around (and under) the character */
- for (d = 0; d < 9; d++)
- {
-
- /* Extract adjacent (legal) location */
- int yy = p_ptr->py + ddy_ddd[d];
- int xx = p_ptr->px + ddx_ddd[d];
-
- /* No (visible) chest is there */
- if ((o_idx = chest_check(yy, xx)) == 0) continue;
-
- /* Grab the object */
- o_ptr = &o_list[o_idx];
-
- /* Already open */
- if (o_ptr->pval == 0) continue;
-
- /* OK */
- ++count;
-
- /* Remember the location. Only useful if only one match */
- *y = yy;
- *x = xx;
- }
-
- /* All done */
- return (count);
-}
-
-
-/*
* Convert an adjacent location to a direction.
*/
static int coords_to_dir(int y, int x)
@@ -900,9 +662,9 @@ static int coords_to_dir(int y, int x)
*
* Assume there is no monster blocking the destination
*
- * Returns TRUE if repeated commands may continue
+ * Returns true if repeated commands may continue
*/
-static bool_ do_cmd_open_aux(int y, int x, int dir)
+static bool do_cmd_open_aux(int y, int x)
{
auto const &r_info = game->edit_data.r_info;
@@ -910,7 +672,7 @@ static bool_ do_cmd_open_aux(int y, int x, int dir)
cave_type *c_ptr;
- bool_ more = FALSE;
+ bool more = false;
auto r_ptr = &r_info[p_ptr->body_monster];
@@ -919,7 +681,7 @@ static bool_ do_cmd_open_aux(int y, int x, int dir)
{
msg_print("You cannot open doors.");
- return (FALSE);
+ return false;
}
/* Take a turn */
@@ -980,7 +742,7 @@ static bool_ do_cmd_open_aux(int y, int x, int dir)
msg_print("You failed to pick the lock.");
/* We may keep trying */
- more = TRUE;
+ more = true;
}
}
@@ -999,6 +761,26 @@ static bool_ do_cmd_open_aux(int y, int x, int dir)
}
+/*
+ * Change a command "argument" to a number of repitions
+ */
+static void allow_repeat_command()
+{
+ // If there's a command argument, we set the number
+ // of repetitions instead.
+ if (command_arg)
+ {
+ /* Set repeat count */
+ command_rep = command_arg - 1;
+
+ /* Redraw the state */
+ p_ptr->redraw |= (PR_FRAME);
+
+ /* Cancel the arg */
+ command_arg = 0;
+ }
+}
+
/*
* Open a closed/locked/jammed door or a closed/locked chest.
@@ -1011,11 +793,9 @@ void do_cmd_open()
int y, x, dir;
- s16b o_idx;
-
cave_type *c_ptr;
- bool_ more = FALSE;
+ bool more = false;
auto r_ptr = &r_info[p_ptr->body_monster];
@@ -1029,16 +809,11 @@ void do_cmd_open()
/* Pick a direction if there's an obvious target */
{
- int num_doors, num_chests;
-
/* Count closed doors (locked or jammed) */
- num_doors = count_feats(&y, &x, is_closed, FALSE);
-
- /* Count chests (locked) */
- num_chests = count_chests(&y, &x, FALSE);
+ const int num_doors = count_feats(&y, &x, is_closed, false);
/* There is nothing the player can open */
- if ((num_doors + num_chests) == 0)
+ if (num_doors == 0)
{
/* Message */
msg_print("You see nothing there to open.");
@@ -1048,24 +823,14 @@ void do_cmd_open()
}
/* Set direction if there is only one target */
- else if ((num_doors + num_chests) == 1)
+ else if (num_doors == 1)
{
command_dir = coords_to_dir(y, x);
}
}
/* Allow repeated command */
- if (command_arg)
- {
- /* Set repeat count */
- command_rep = command_arg - 1;
-
- /* Redraw the state */
- p_ptr->redraw |= (PR_FRAME);
-
- /* Cancel the arg */
- command_arg = 0;
- }
+ allow_repeat_command();
/* Get a "repeated" direction */
if (get_rep_dir(&dir))
@@ -1077,12 +842,9 @@ void do_cmd_open()
/* Get requested grid */
c_ptr = &cave[y][x];
- /* Check for chest */
- o_idx = chest_check(y, x);
-
/* Nothing useful */
if (!((c_ptr->feat >= FEAT_DOOR_HEAD) &&
- (c_ptr->feat <= FEAT_DOOR_TAIL)) && !o_idx)
+ (c_ptr->feat <= FEAT_DOOR_TAIL)))
{
/* Message */
msg_print("You see nothing there to open.");
@@ -1101,18 +863,11 @@ void do_cmd_open()
py_attack(y, x, -1);
}
- /* Handle chests */
- else if (o_idx)
- {
- /* Open the chest */
- more = do_cmd_open_chest(y, x, o_idx);
- }
-
/* Handle doors */
else
{
/* Open the door */
- more = do_cmd_open_aux(y, x, dir);
+ more = do_cmd_open_aux(y, x);
}
}
@@ -1129,15 +884,15 @@ void do_cmd_open()
*
* Assume there is no monster blocking the destination
*
- * Returns TRUE if repeated commands may continue
+ * Returns true if repeated commands may continue
*/
-static bool_ do_cmd_close_aux(int y, int x, int dir)
+static bool do_cmd_close_aux(int y, int x)
{
auto const &r_info = game->edit_data.r_info;
cave_type *c_ptr;
- bool_ more = FALSE;
+ bool more = false;
auto r_ptr = &r_info[p_ptr->body_monster];
@@ -1146,7 +901,7 @@ static bool_ do_cmd_close_aux(int y, int x, int dir)
{
msg_print("You cannot close doors.");
- return (FALSE);
+ return false;
}
/* Take a turn */
@@ -1186,7 +941,7 @@ void do_cmd_close()
cave_type *c_ptr;
- bool_ more = FALSE;
+ bool more = false;
/* Pick a direction if there's an obvious choice */
@@ -1194,7 +949,7 @@ void do_cmd_close()
int num_doors;
/* Count open doors */
- num_doors = count_feats(&y, &x, is_open, FALSE);
+ num_doors = count_feats(&y, &x, is_open, false);
/* There are no doors the player can close */
if (num_doors == 0)
@@ -1214,17 +969,7 @@ void do_cmd_close()
}
/* Allow repeated command */
- if (command_arg)
- {
- /* Set repeat count */
- command_rep = command_arg - 1;
-
- /* Redraw the state */
- p_ptr->redraw |= (PR_FRAME);
-
- /* Cancel the arg */
- command_arg = 0;
- }
+ allow_repeat_command();
/* Get a "repeated" direction */
if (get_rep_dir(&dir))
@@ -1260,7 +1005,7 @@ void do_cmd_close()
else
{
/* Close the door */
- more = do_cmd_close_aux(y, x, dir);
+ more = do_cmd_close_aux(y, x);
}
}
@@ -1272,7 +1017,7 @@ void do_cmd_close()
/*
* Determine if a given grid may be "tunneled"
*/
-static bool_ do_cmd_tunnel_test(int y, int x)
+static bool do_cmd_tunnel_test(int y, int x)
{
auto const &f_info = game->edit_data.f_info;
@@ -1283,7 +1028,7 @@ static bool_ do_cmd_tunnel_test(int y, int x)
msg_print("You see nothing there.");
/* Nope */
- return (FALSE);
+ return false;
}
/* Must be a wall/door/etc */
@@ -1293,7 +1038,7 @@ static bool_ do_cmd_tunnel_test(int y, int x)
msg_print("You see nothing there to tunnel.");
/* Nope */
- return (FALSE);
+ return false;
}
/* Must be tunnelable */
@@ -1303,11 +1048,11 @@ static bool_ do_cmd_tunnel_test(int y, int x)
msg_print(f_info[cave[y][x].feat].tunnel);
/* Nope */
- return (FALSE);
+ return false;
}
/* Okay */
- return (TRUE);
+ return true;
}
@@ -1321,13 +1066,13 @@ static bool_ do_cmd_tunnel_test(int y, int x)
* This will, however, produce grids which are NOT illuminated
* (or darkened) along with the rest of the room.
*/
-static bool_ twall(int y, int x, byte feat)
+static bool twall(int y, int x, byte feat)
{
cave_type *c_ptr = &cave[y][x];
/* Paranoia -- Require a wall or door or some such */
- if (cave_floor_bold(y, x)) return (FALSE);
+ if (cave_floor_bold(y, x)) return false;
/* Forget the wall */
c_ptr->info &= ~(CAVE_MARK);
@@ -1339,7 +1084,7 @@ static bool_ twall(int y, int x, byte feat)
p_ptr->update |= (PU_VIEW | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
/* Result */
- return (TRUE);
+ return true;
}
@@ -1352,9 +1097,9 @@ static bool_ twall(int y, int x, byte feat)
*
* Assumes that no monster is blocking the destination
*
- * Returns TRUE if repeated commands may continue
+ * Returns true if repeated commands may continue
*/
-static bool_ do_cmd_tunnel_aux(int y, int x, int dir)
+static bool do_cmd_tunnel_aux(int y, int x)
{
auto const &d_info = game->edit_data.d_info;
auto const &f_info = game->edit_data.f_info;
@@ -1364,23 +1109,23 @@ static bool_ do_cmd_tunnel_aux(int y, int x, int dir)
auto f_ptr = &f_info[c_ptr->feat];
- bool_ more = FALSE;
+ bool more = false;
/* Must be have something to dig with (except for sandwalls) */
if ((c_ptr->feat < FEAT_SANDWALL) || (c_ptr->feat > FEAT_SANDWALL_K))
{
- if (!p_ptr->inventory[INVEN_TOOL].k_idx ||
- (p_ptr->inventory[INVEN_TOOL].tval != TV_DIGGING))
+ auto o_ptr = &p_ptr->inventory[INVEN_TOOL];
+ if (!o_ptr->k_ptr || (o_ptr->tval != TV_DIGGING))
{
msg_print("You need to have a shovel or pick in your tool slot.");
- return (FALSE);
+ return false;
}
}
/* Verify legality */
- if (!do_cmd_tunnel_test(y, x)) return (FALSE);
+ if (!do_cmd_tunnel_test(y, x)) return false;
/* Take a turn */
energy_use = 100;
@@ -1409,7 +1154,7 @@ static bool_ do_cmd_tunnel_aux(int y, int x, int dir)
{
/* We may continue chopping */
msg_print(f_ptr->tunnel);
- more = TRUE;
+ more = true;
}
}
@@ -1431,7 +1176,7 @@ static bool_ do_cmd_tunnel_aux(int y, int x, int dir)
{
/* We may continue tunelling */
msg_print(f_ptr->tunnel);
- more = TRUE;
+ more = true;
}
}
@@ -1442,24 +1187,24 @@ static bool_ do_cmd_tunnel_aux(int y, int x, int dir)
((c_ptr->feat >= FEAT_SANDWALL) &&
(c_ptr->feat <= FEAT_SANDWALL_K)))
{
- bool_ okay = FALSE;
- bool_ gold = FALSE;
- bool_ hard = FALSE;
- bool_ soft = FALSE;
+ bool okay = false;
+ bool gold = false;
+ bool hard = false;
+ bool soft = false;
/* Found gold */
if ((c_ptr->feat >= FEAT_MAGMA_H) &&
- (c_ptr->feat <= FEAT_QUARTZ_K)) gold = TRUE;
+ (c_ptr->feat <= FEAT_QUARTZ_K)) gold = true;
if ((c_ptr->feat == FEAT_SANDWALL_H) ||
(c_ptr->feat == FEAT_SANDWALL_K))
{
- gold = TRUE;
- soft = TRUE;
+ gold = true;
+ soft = true;
}
else
/* Extract "quartz" flag XXX XXX XXX */
- if ((c_ptr->feat - FEAT_MAGMA) & 0x01) hard = TRUE;
+ if ((c_ptr->feat - FEAT_MAGMA) & 0x01) hard = true;
/* Quartz */
if (hard)
@@ -1511,7 +1256,7 @@ static bool_ do_cmd_tunnel_aux(int y, int x, int dir)
{
/* Message, continue digging */
msg_print(f_ptr->tunnel);
- more = TRUE;
+ more = true;
}
}
@@ -1531,7 +1276,7 @@ static bool_ do_cmd_tunnel_aux(int y, int x, int dir)
if (rand_int(100) < 10)
{
/* Create a simple object */
- place_object(y, x, FALSE, FALSE, OBJ_FOUND_RUBBLE);
+ place_object(y, x, false, false, OBJ_FOUND_RUBBLE);
/* Observe new object */
if (player_can_see_bold(y, x))
@@ -1545,7 +1290,7 @@ static bool_ do_cmd_tunnel_aux(int y, int x, int dir)
{
/* Message, keep digging */
msg_print(f_ptr->tunnel);
- more = TRUE;
+ more = true;
}
}
@@ -1573,7 +1318,7 @@ static bool_ do_cmd_tunnel_aux(int y, int x, int dir)
/* We may continue tunelling */
msg_print(f_info[feat].tunnel);
- more = TRUE;
+ more = true;
}
}
@@ -1593,7 +1338,7 @@ static bool_ do_cmd_tunnel_aux(int y, int x, int dir)
{
/* We may continue tunelling */
msg_print(f_ptr->tunnel);
- more = TRUE;
+ more = true;
}
}
@@ -1602,7 +1347,7 @@ static bool_ do_cmd_tunnel_aux(int y, int x, int dir)
if (p_ptr->skill_dig < skill_req)
{
msg_print("You fail to make even the slightest of progress.");
- more = FALSE;
+ more = false;
}
else if (p_ptr->skill_dig < skill_req_1pct)
{
@@ -1637,23 +1382,13 @@ void do_cmd_tunnel()
cave_type *c_ptr;
- bool_ more = FALSE;
+ bool more = false;
if (p_ptr->wild_mode) return;
/* Allow repeated command */
- if (command_arg)
- {
- /* Set repeat count */
- command_rep = command_arg - 1;
-
- /* Redraw the state */
- p_ptr->redraw |= (PR_FRAME);
-
- /* Cancel the arg */
- command_arg = 0;
- }
+ allow_repeat_command();
/* Get a direction to tunnel, or Abort */
if (get_rep_dir(&dir))
@@ -1689,7 +1424,7 @@ void do_cmd_tunnel()
else
{
/* Tunnel through walls */
- more = do_cmd_tunnel_aux(y, x, dir);
+ more = do_cmd_tunnel_aux(y, x);
}
}
@@ -1704,9 +1439,9 @@ void do_cmd_tunnel()
*
* Assume there is no monster blocking the destination
*
- * Returns TRUE if repeated commands may continue
+ * Returns true if repeated commands may continue
*/
-static bool_ do_cmd_bash_aux(int y, int x, int dir)
+static bool do_cmd_bash_aux(int y, int x, int dir)
{
auto const &r_info = game->edit_data.r_info;
@@ -1714,7 +1449,7 @@ static bool_ do_cmd_bash_aux(int y, int x, int dir)
cave_type *c_ptr;
- bool_ more = FALSE;
+ bool more = false;
auto r_ptr = &r_info[p_ptr->body_monster];
@@ -1723,7 +1458,7 @@ static bool_ do_cmd_bash_aux(int y, int x, int dir)
{
msg_print("You cannot do that.");
- return (FALSE);
+ return false;
}
/* Take a turn */
@@ -1781,7 +1516,7 @@ static bool_ do_cmd_bash_aux(int y, int x, int dir)
msg_print("The door holds firm.");
/* Allow repeated bashing */
- more = TRUE;
+ more = true;
}
/* High dexterity yields coolness */
@@ -1821,7 +1556,7 @@ void do_cmd_bash()
cave_type *c_ptr;
- bool_ more = FALSE;
+ bool more = false;
auto r_ptr = &r_info[p_ptr->body_monster];
@@ -1834,17 +1569,7 @@ void do_cmd_bash()
}
/* Allow repeated command */
- if (command_arg)
- {
- /* Set repeat count */
- command_rep = command_arg - 1;
-
- /* Redraw the state */
- p_ptr->redraw |= (PR_FRAME);
-
- /* Cancel the arg */
- command_arg = 0;
- }
+ allow_repeat_command();
/* Get a "repeated" direction */
if (get_rep_dir(&dir))
@@ -1920,21 +1645,11 @@ void do_cmd_alter()
cave_type *c_ptr;
- bool_ more = FALSE;
+ bool more = false;
/* Allow repeated command */
- if (command_arg)
- {
- /* Set repeat count */
- command_rep = command_arg - 1;
-
- /* Redraw the state */
- p_ptr->redraw |= (PR_FRAME);
-
- /* Cancel the arg */
- command_arg = 0;
- }
+ allow_repeat_command();
/* Get a direction */
if (get_rep_dir(&dir))
@@ -1961,14 +1676,14 @@ void do_cmd_alter()
(c_ptr->feat <= FEAT_DOOR_TAIL))
{
/* Tunnel */
- more = do_cmd_open_aux(y, x, dir);
+ more = do_cmd_open_aux(y, x);
}
/* Tunnel through walls */
else if (f_info[c_ptr->feat].flags & FF_TUNNELABLE)
{
/* Tunnel */
- more = do_cmd_tunnel_aux(y, x, dir);
+ more = do_cmd_tunnel_aux(y, x);
}
/* Oops */
@@ -1989,7 +1704,7 @@ void do_cmd_alter()
*
* XXX XXX XXX Let user choose a pile of spikes, perhaps?
*/
-static bool_ get_spike(int *ip)
+static bool get_spike(int *ip)
{
int i;
@@ -1999,8 +1714,10 @@ static bool_ get_spike(int *ip)
{
object_type *o_ptr = &p_ptr->inventory[i];
- /* Skip non-objects */
- if (!o_ptr->k_idx) continue;
+ if (!o_ptr->k_ptr)
+ {
+ continue;
+ }
/* Check the "tval" code */
if (o_ptr->tval == TV_SPIKE)
@@ -2009,12 +1726,12 @@ static bool_ get_spike(int *ip)
(*ip) = i;
/* Success */
- return (TRUE);
+ return true;
}
}
/* Oops */
- return (FALSE);
+ return false;
}
@@ -2097,21 +1814,11 @@ static void do_cmd_walk_jump(int pickup)
int dir;
- bool_ more = FALSE;
+ bool more = false;
/* Allow repeated command */
- if (command_arg)
- {
- /* Set repeat count */
- command_rep = command_arg - 1;
-
- /* Redraw the state */
- p_ptr->redraw |= (PR_FRAME);
-
- /* Cancel the arg */
- command_arg = 0;
- }
+ allow_repeat_command();
/* Get a "repeated" direction */
if (get_rep_dir(&dir))
@@ -2123,7 +1830,7 @@ static void do_cmd_walk_jump(int pickup)
move_player(dir, pickup);
/* Allow more walking */
- more = TRUE;
+ more = true;
}
/* Hack -- In small scale wilderness it takes MUCH more time to move */
@@ -2141,7 +1848,7 @@ static void do_cmd_walk_jump(int pickup)
change_wild_mode();
/* HACk -- set the encouter flag for the wilderness generation */
- generate_encounter = TRUE;
+ generate_encounter = true;
p_ptr->oldpx = MAX_WID / 2;
p_ptr->oldpy = MAX_HGT / 2;
@@ -2163,7 +1870,7 @@ static void do_cmd_unwalk()
cave_type *c_ptr;
- bool_ more = FALSE;
+ bool more = false;
if (!get_rep_dir(&dir)) return;
@@ -2183,18 +1890,7 @@ static void do_cmd_unwalk()
/* Allow repeated command */
- if (command_arg)
- {
- /* Set repeat count */
- command_rep = command_arg - 1;
-
- /* Redraw the state */
- p_ptr->redraw |= (PR_FRAME);
-
- /* Cancel the arg */
- command_arg = 0;
- }
-
+ allow_repeat_command();
/* Attack monsters */
if (c_ptr->m_idx > 0)
@@ -2217,7 +1913,7 @@ static void do_cmd_unwalk()
p_ptr->wilderness_x--;
p_ptr->oldpy = cur_hgt - 2;
p_ptr->oldpx = cur_wid - 2;
- ambush_flag = FALSE;
+ ambush_flag = false;
}
else if ((y == 0) && (x == MAX_WID - 1))
@@ -2226,7 +1922,7 @@ static void do_cmd_unwalk()
p_ptr->wilderness_x++;
p_ptr->oldpy = cur_hgt - 2;
p_ptr->oldpx = 1;
- ambush_flag = FALSE;
+ ambush_flag = false;
}
else if ((y == MAX_HGT - 1) && (x == 0))
@@ -2235,7 +1931,7 @@ static void do_cmd_unwalk()
p_ptr->wilderness_x--;
p_ptr->oldpy = 1;
p_ptr->oldpx = cur_wid - 2;
- ambush_flag = FALSE;
+ ambush_flag = false;
}
else if ((y == MAX_HGT - 1) && (x == MAX_WID - 1))
@@ -2244,7 +1940,7 @@ static void do_cmd_unwalk()
p_ptr->wilderness_x++;
p_ptr->oldpy = 1;
p_ptr->oldpx = 1;
- ambush_flag = FALSE;
+ ambush_flag = false;
}
else if (y == 0)
@@ -2252,7 +1948,7 @@ static void do_cmd_unwalk()
p_ptr->wilderness_y--;
p_ptr->oldpy = cur_hgt - 2;
p_ptr->oldpx = x;
- ambush_flag = FALSE;
+ ambush_flag = false;
}
else if (y == cur_hgt - 1)
@@ -2260,7 +1956,7 @@ static void do_cmd_unwalk()
p_ptr->wilderness_y++;
p_ptr->oldpy = 1;
p_ptr->oldpx = x;
- ambush_flag = FALSE;
+ ambush_flag = false;
}
else if (x == 0)
@@ -2268,7 +1964,7 @@ static void do_cmd_unwalk()
p_ptr->wilderness_x--;
p_ptr->oldpx = cur_wid - 2;
p_ptr->oldpy = y;
- ambush_flag = FALSE;
+ ambush_flag = false;
}
else if (x == cur_wid - 1)
@@ -2276,10 +1972,10 @@ static void do_cmd_unwalk()
p_ptr->wilderness_x++;
p_ptr->oldpx = 1;
p_ptr->oldpy = y;
- ambush_flag = FALSE;
+ ambush_flag = false;
}
- p_ptr->leaving = TRUE;
+ p_ptr->leaving = true;
return;
}
@@ -2296,7 +1992,7 @@ static void do_cmd_unwalk()
((feat >= FEAT_LESS) && (feat <= FEAT_MORE)))
{
move_player(dir, options->always_pickup);
- more = FALSE;
+ more = false;
}
/* Hack -- Ignore wilderness mofe. */
@@ -2396,18 +2092,7 @@ void do_cmd_stay(int pickup)
/* Allow repeated command */
- if (command_arg)
- {
- /* Set repeat count */
- command_rep = command_arg - 1;
-
- /* Redraw the state */
- p_ptr->redraw |= (PR_FRAME);
-
- /* Cancel the arg */
- command_arg = 0;
- }
-
+ allow_repeat_command();
/* Take a turn */
energy_use = 100;
@@ -2441,8 +2126,9 @@ void do_cmd_rest()
flush_on_failure();
/* Tell the player why */
- msg_print(format("Resting on a %s is too dangerous!",
- f_info[cave[p_ptr->py][p_ptr->px].feat].name));
+ msg_print(fmt::format(
+ "Resting on a {} is too dangerous!",
+ f_info[cave[p_ptr->py][p_ptr->px].feat].name));
/* Done */
return;
@@ -2464,7 +2150,7 @@ void do_cmd_rest()
/* Prompt for time if needed */
if (command_arg <= 0)
{
- cptr p = "Rest (0-9999, '*' for HP/SP, '&' as needed): ";
+ const char *p = "Rest (0-9999, '*' for HP/SP, '&' as needed): ";
char out_val[80];
@@ -2683,7 +2369,7 @@ void do_cmd_fire()
object_type *j_ptr;
- bool_ hit_body = FALSE;
+ bool hit_body = false;
byte missile_attr;
@@ -2717,7 +2403,7 @@ void do_cmd_fire()
item = INVEN_AMMO;
/* If nothing correct try to choose from the backpack */
- if ((p_ptr->tval_ammo != o_ptr->tval) || (!o_ptr->k_idx))
+ if ((p_ptr->tval_ammo != o_ptr->tval) || (!o_ptr->k_ptr))
{
/* Get an item */
if (!get_item(&item,
@@ -2762,7 +2448,7 @@ void do_cmd_fire()
/* Describe the object */
- object_desc(o_name, q_ptr, FALSE, 3);
+ object_desc(o_name, q_ptr, false, 3);
/* Find the color and symbol for the object for throwing */
missile_attr = object_attr(q_ptr);
@@ -2831,7 +2517,7 @@ void do_cmd_fire()
handle_stuff();
oldtdam = tdam;
- while (TRUE)
+ while (true)
{
/* Reset after a piercing shot */
tdam = oldtdam;
@@ -2890,15 +2576,15 @@ void do_cmd_fire()
visible = m_ptr->ml;
/* Note the collision */
- hit_body = TRUE;
+ hit_body = true;
/* Did we hit it (penalize range) */
if (test_hit_fire(chance - cur_dis, m_ptr->ac, m_ptr->ml))
{
- bool_ fear = FALSE;
+ bool fear = false;
/* Assume a default death */
- cptr note_dies = " dies.";
+ const char *note_dies = " dies.";
/* Some monsters get "destroyed" */
if ((r_ptr->flags & RF_DEMON) ||
@@ -3046,7 +2732,7 @@ void do_cmd_fire()
(magik(45 + get_skill(SKILL_ARCHERY))))
{
num_pierce--;
- hit_body = FALSE;
+ hit_body = false;
/* If target isn't reached, continue moving to target */
if ( !((tx < x && x < bx) || (bx < x && x < tx)) &&
@@ -3092,8 +2778,6 @@ void do_cmd_fire()
*/
void do_cmd_throw()
{
- auto const &k_info = game->edit_data.k_info;
-
int dir;
s32b special = 0;
@@ -3113,9 +2797,9 @@ void do_cmd_throw()
object_type *q_ptr;
- bool_ hit_body = FALSE;
+ bool hit_body = false;
- bool_ hit_wall = FALSE;
+ bool hit_wall = false;
byte missile_attr;
@@ -3194,7 +2878,7 @@ void do_cmd_throw()
inc_stack_size(item, -1);
/* Description */
- object_desc(o_name, q_ptr, FALSE, 3);
+ object_desc(o_name, q_ptr, false, 3);
/* Find the color and symbol for the object for throwing */
missile_attr = object_attr(q_ptr);
@@ -3258,7 +2942,7 @@ void do_cmd_throw()
/* Stopped by walls/doors */
if (!cave_floor_bold(ny, nx))
{
- hit_wall = TRUE;
+ hit_wall = true;
break;
}
@@ -3302,15 +2986,15 @@ void do_cmd_throw()
visible = m_ptr->ml;
/* Note the collision */
- hit_body = TRUE;
+ hit_body = true;
/* Did we hit it (penalize range) */
if (test_hit_fire(chance - cur_dis, m_ptr->ac, m_ptr->ml))
{
- bool_ fear = FALSE;
+ bool fear = false;
/* Assume a default death */
- cptr note_dies = " dies.";
+ const char *note_dies = " dies.";
/* Some monsters get "destroyed" */
if ((r_ptr->flags & RF_DEMON) ||
@@ -3377,7 +3061,7 @@ void do_cmd_throw()
if (special) attack_special(m_ptr, special, tdam);
/* Anger friends */
- if (!(k_info[q_ptr->k_idx].tval == TV_POTION))
+ if (!(q_ptr->k_ptr->tval == TV_POTION))
{
char m_name[80];
monster_desc(m_name, m_ptr, 0);
@@ -3417,7 +3101,7 @@ void do_cmd_throw()
j = (hit_body ? breakage_chance(q_ptr) : 0);
/* Potions smash open */
- if (k_info[q_ptr->k_idx].tval == TV_POTION)
+ if (q_ptr->k_ptr->tval == TV_POTION)
{
if ((hit_body) || (hit_wall) || (randint(100) < j))
{
@@ -3468,8 +3152,6 @@ void do_cmd_throw()
*/
void do_cmd_boomerang()
{
- auto const &k_info = game->edit_data.k_info;
-
int dir;
int j, y, x, ny, nx, ty, tx;
@@ -3486,7 +3168,7 @@ void do_cmd_boomerang()
object_type *o_ptr;
- bool_ hit_body = FALSE;
+ bool hit_body = false;
byte missile_attr;
@@ -3517,7 +3199,7 @@ void do_cmd_boomerang()
q_ptr->number = 1;
/* Description */
- object_desc(o_name, q_ptr, FALSE, 3);
+ object_desc(o_name, q_ptr, false, 3);
/* Find the color and symbol for the object for throwing */
missile_attr = object_attr(q_ptr);
@@ -3628,15 +3310,15 @@ void do_cmd_boomerang()
visible = m_ptr->ml;
/* Note the collision */
- hit_body = TRUE;
+ hit_body = true;
/* Did we hit it (penalize range) */
if (test_hit_fire(chance - cur_dis, m_ptr->ac, m_ptr->ml))
{
- bool_ fear = FALSE;
+ bool fear = false;
/* Assume a default death */
- cptr note_dies = " dies.";
+ const char *note_dies = " dies.";
/* Some monsters get "destroyed" */
if ((r_ptr->flags & RF_DEMON) ||
@@ -3703,7 +3385,7 @@ void do_cmd_boomerang()
if (special) attack_special(m_ptr, special, tdam);
/* Anger friends */
- if (!(k_info[q_ptr->k_idx].tval == TV_POTION))
+ if (!(q_ptr->k_ptr->tval == TV_POTION))
{
char m_name[80];
monster_desc(m_name, m_ptr, 0);
@@ -3739,7 +3421,7 @@ void do_cmd_boomerang()
/* Break the boomerang */
if ((!artifact_p(o_ptr)) && (rand_int(100) < j))
{
- msg_print(format("Your %s is destroyed.", o_name));
+ msg_print(fmt::format("Your {} is destroyed.", o_name));
inc_stack_size_ex(INVEN_BOW, -1, OPTIMIZE, NO_DESCRIBE);
}
}
@@ -3790,21 +3472,22 @@ void do_cmd_boomerang()
}
-static bool_ tport_vertically(bool_ how)
+static bool tport_vertically(bool how)
{
auto const &d_info = game->edit_data.d_info;
+ auto const &dungeon_flags = game->dungeon_flags;
/* quest? */
if (p_ptr->inside_quest)
{
msg_print("There is no effect.");
- return (FALSE);
+ return false;
}
if (dungeon_flags & DF_NO_EASY_MOVE)
{
msg_print("Some powerful force prevents you from teleporting.");
- return FALSE;
+ return false;
}
/* Go down */
@@ -3813,27 +3496,27 @@ static bool_ tport_vertically(bool_ how)
if (dun_level >= d_info[dungeon_type].maxdepth)
{
msg_print("The floor is impermeable.");
- return (FALSE);
+ return false;
}
msg_print("You sink through the floor.");
dun_level++;
- p_ptr->leaving = TRUE;
+ p_ptr->leaving = true;
}
else
{
if (dun_level < d_info[dungeon_type].mindepth)
{
msg_print("There is nothing above you but air.");
- return (FALSE);
+ return false;
}
msg_print("You rise through the ceiling.");
dun_level--;
- p_ptr->leaving = TRUE;
+ p_ptr->leaving = true;
}
- return (TRUE);
+ return true;
}
@@ -3851,9 +3534,9 @@ void do_cmd_immovable_special()
int lose_hp = 0;
- bool_ did_act = FALSE;
+ bool did_act = false;
- bool_ did_load = FALSE;
+ bool did_load = false;
if (foo > 1)
@@ -3884,14 +3567,14 @@ void do_cmd_immovable_special()
}
/* Enter "icky" mode */
- character_icky = TRUE;
+ character_icky = true;
/* Save the screen */
Term_save();
/* Interact until done */
- while (1)
+ while (true)
{
/* Clear screen */
Term_clear();
@@ -3918,15 +3601,15 @@ void do_cmd_immovable_special()
if (i == 'a')
{
Term_load();
- character_icky = FALSE;
- did_load = TRUE;
+ character_icky = false;
+ did_load = true;
if (!tgt_pt(&ii, &ij)) break;
/* Teleport to the target */
teleport_player_to(ij, ii);
- did_act = TRUE;
+ did_act = true;
break;
}
@@ -3934,14 +3617,14 @@ void do_cmd_immovable_special()
else if (i == 'b')
{
Term_load();
- character_icky = FALSE;
- did_load = TRUE;
+ character_icky = false;
+ did_load = true;
if (!get_aim_dir(&dir)) return;
- fetch(dir, p_ptr->lev * 15, FALSE);
+ fetch(dir, p_ptr->lev * 15, false);
py_pickup_floor(options->always_pickup);
- did_act = TRUE;
+ did_act = true;
break;
}
@@ -3949,12 +3632,12 @@ void do_cmd_immovable_special()
else if (i == 'c')
{
Term_load();
- character_icky = FALSE;
- did_load = TRUE;
+ character_icky = false;
+ did_load = true;
- if (!tport_vertically(FALSE)) return;
+ if (!tport_vertically(false)) return;
- did_act = TRUE;
+ did_act = true;
break;
}
@@ -3962,12 +3645,12 @@ void do_cmd_immovable_special()
else if (i == 'd')
{
Term_load();
- character_icky = FALSE;
- did_load = TRUE;
+ character_icky = false;
+ did_load = true;
- if (!tport_vertically(TRUE)) return;
+ if (!tport_vertically(true)) return;
- did_act = TRUE;
+ did_act = true;
break;
}
@@ -3986,7 +3669,7 @@ void do_cmd_immovable_special()
Term_load();
/* Leave "icky" mode */
- character_icky = FALSE;
+ character_icky = false;
}
/* Apply stat losses if something was done */
@@ -4017,17 +3700,17 @@ static bool item_tester_hook_sacrificable(object_type const *o_ptr)
{
/* Corpses are */
if (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_CORPSE_CORPSE)
- return (TRUE);
+ return true;
/* Books without any udun spells */
if ((o_ptr->tval == TV_BOOK) && udun_in_book(o_ptr->sval, o_ptr->pval) <= 0)
{
- return TRUE;
+ return true;
}
}
/* Assume not */
- return (FALSE);
+ return false;
}
/*
@@ -4097,9 +3780,9 @@ void do_cmd_sacrifice()
if (deity_info[agod].desc[i] != NULL)
msg_print(deity_info[agod].desc[i]);
}
- if (get_check(format("Do you want to worship %s? ", deity_info[agod].name)))
+ if (get_check(fmt::format("Do you want to worship {}? ", deity_info[agod].name)))
{
- follow_god(agod, FALSE);
+ follow_god(agod, false);
p_ptr->grace = -200;
inc_piety(p_ptr->pgod, 0);
}
@@ -4230,7 +3913,7 @@ std::vector<s16b> show_monster_inven(int m_idx)
/* Describe the object */
char o_name[80];
- object_desc(o_name, o_ptr, TRUE, 3);
+ object_desc(o_name, o_ptr, true, 3);
/* Hack -- enforce max length */
o_name[lim] = '\0';
@@ -4264,18 +3947,15 @@ std::vector<s16b> show_monster_inven(int m_idx)
/* Clear the line */
prt("", i + 1, col ? col - 2 : col);
- /* Prepare an index --(-- */
- char tmp_val[80];
- strnfmt(tmp_val, 80, "%c)", index_to_label(i));
-
- /* Clear the line with the (possibly indented) index */
- put_str(tmp_val, i + 1, col);
+ /* Display index */
+ put_str(fmt::format("{})", index_to_label(i)), i + 1, col);
/* Display the entry itself */
c_put_str(out_color[i], out_desc[i], i + 1, col + 3);
/* Display the weight if needed */
{
+ char tmp_val[80];
int wgt = o_ptr->weight * o_ptr->number;
strnfmt(tmp_val, 80, "%3d.%1d lb", wgt / 10, wgt % 10);
put_str(tmp_val, i + 1, 71);
@@ -4301,7 +3981,7 @@ void do_cmd_steal()
int dir = 0, item = -1, k = -1;
- bool_ done = FALSE;
+ bool done = false;
/* Only works on adjacent monsters */
if (!get_rep_dir(&dir)) return;
@@ -4357,7 +4037,7 @@ void do_cmd_steal()
{
case ESCAPE:
{
- done = TRUE;
+ done = true;
break;
}
@@ -4381,14 +4061,14 @@ void do_cmd_steal()
/* Verify the item */
if (ver && !verify("Try", -objects[k]))
{
- done = TRUE;
+ done = true;
break;
}
/* Accept that choice */
item = objects[k];
- done = TRUE;
+ done = true;
break;
}
@@ -4463,11 +4143,11 @@ void do_cmd_steal()
{
object_copy(o_ptr, &o_list[item]);
- inven_carry(o_ptr, FALSE);
+ inven_carry(o_ptr, false);
}
/* Delete source item */
- o_list[item].k_idx = 0;
+ o_list[item].k_ptr.reset();
}
screen_load();