summaryrefslogtreecommitdiff
path: root/src/spells2.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/spells2.cc')
-rw-r--r--src/spells2.cc940
1 files changed, 343 insertions, 597 deletions
diff --git a/src/spells2.cc b/src/spells2.cc
index c0d435ea..cadaed2d 100644
--- a/src/spells2.cc
+++ b/src/spells2.cc
@@ -42,11 +42,10 @@
#include "stats.hpp"
#include "tables.hpp"
#include "util.hpp"
-#include "util.h"
-#include "variable.h"
#include "variable.hpp"
#include "xtra1.hpp"
#include "xtra2.hpp"
+#include "z-form.hpp"
#include "z-rand.hpp"
#include <boost/algorithm/string/predicate.hpp>
@@ -143,9 +142,9 @@ void grow_grass(int rad)
/*
* Increase players hit points, notice effects
*/
-bool_ hp_player(int num)
+void hp_player(int num)
{
- bool_ dead = p_ptr->chp < 0;
+ bool dead = p_ptr->chp < 0;
/* Healing needed */
if (p_ptr->chp < p_ptr->mhp)
@@ -191,13 +190,7 @@ bool_ hp_player(int num)
{
msg_print("You feel very good.");
}
-
- /* Notice */
- return (TRUE);
}
-
- /* Ignore */
- return (FALSE);
}
@@ -236,7 +229,7 @@ void explosive_rune()
/*
* Array of stat "descriptions"
*/
-static cptr desc_stat_pos[] =
+static const char *desc_stat_pos[] =
{
"strong",
"smart",
@@ -250,7 +243,7 @@ static cptr desc_stat_pos[] =
* Array of long descriptions of stat
*/
-static cptr long_desc_stat[] =
+static const char *long_desc_stat[] =
{
"strength",
"intelligence",
@@ -263,7 +256,7 @@ static cptr long_desc_stat[] =
/*
* Array of stat "descriptions"
*/
-static cptr desc_stat_neg[] =
+static const char *desc_stat_neg[] =
{
"weak",
"stupid",
@@ -277,30 +270,30 @@ static cptr desc_stat_neg[] =
/*
* Lose a "point"
*/
-bool_ do_dec_stat(int stat, int mode)
+void do_dec_stat(int stat, int mode)
{
- bool_ sust = FALSE;
+ bool sust = false;
/* Access the "sustain" */
switch (stat)
{
case A_STR:
- if (p_ptr->sustain_str) sust = TRUE;
+ if (p_ptr->sustain_str) sust = true;
break;
case A_INT:
- if (p_ptr->sustain_int) sust = TRUE;
+ if (p_ptr->sustain_int) sust = true;
break;
case A_WIS:
- if (p_ptr->sustain_wis) sust = TRUE;
+ if (p_ptr->sustain_wis) sust = true;
break;
case A_DEX:
- if (p_ptr->sustain_dex) sust = TRUE;
+ if (p_ptr->sustain_dex) sust = true;
break;
case A_CON:
- if (p_ptr->sustain_con) sust = TRUE;
+ if (p_ptr->sustain_con) sust = true;
break;
case A_CHR:
- if (p_ptr->sustain_chr) sust = TRUE;
+ if (p_ptr->sustain_chr) sust = true;
break;
}
@@ -310,9 +303,7 @@ bool_ do_dec_stat(int stat, int mode)
/* Message */
msg_format("You feel %s for a moment, but the feeling passes.",
desc_stat_neg[stat]);
-
- /* Notice effect */
- return (TRUE);
+ return;
}
/* Attempt to reduce the stat */
@@ -320,20 +311,15 @@ bool_ do_dec_stat(int stat, int mode)
{
/* Message */
msg_format("You feel very %s.", desc_stat_neg[stat]);
-
- /* Notice effect */
- return (TRUE);
+ return;
}
-
- /* Nothing obvious */
- return (FALSE);
}
/*
* Restore lost "points" in a stat
*/
-bool_ do_res_stat(int stat, bool_ full)
+bool do_res_stat(int stat, bool full)
{
/* Keep a copy of the current stat, so we can evaluate it if necessary */
int cur_stat = p_ptr->stat_cur[stat];
@@ -352,11 +338,11 @@ bool_ do_res_stat(int stat, bool_ full)
}
/* Notice */
- return (TRUE);
+ return true;
}
/* Nothing obvious */
- return (FALSE);
+ return false;
}
@@ -366,7 +352,7 @@ bool_ do_res_stat(int stat, bool_ full)
* Note that this function (used by stat potions) now restores
* the stat BEFORE increasing it.
*/
-static bool_ inc_stat(int stat)
+static bool inc_stat(int stat)
{
int value, gain;
@@ -418,23 +404,23 @@ static bool_ inc_stat(int stat)
p_ptr->update |= (PU_BONUS);
/* Success */
- return (TRUE);
+ return true;
}
/* Nothing to gain */
- return (FALSE);
+ return false;
}
/*
* Gain a "point" in a stat
*/
-bool_ do_inc_stat(int stat)
+bool do_inc_stat(int stat)
{
- bool_ res;
+ bool res;
/* Restore strength */
- res = res_stat(stat, TRUE);
+ res = res_stat(stat, true);
/* Attempt to increase */
if (inc_stat(stat))
@@ -443,7 +429,7 @@ bool_ do_inc_stat(int stat)
msg_format("Wow! You feel very %s!", desc_stat_pos[stat]);
/* Notice */
- return (TRUE);
+ return true;
}
/* Restoration worked */
@@ -453,21 +439,21 @@ bool_ do_inc_stat(int stat)
msg_format("You feel less %s.", desc_stat_neg[stat]);
/* Notice */
- return (TRUE);
+ return true;
}
/* Nothing obvious */
- return (FALSE);
+ return false;
}
/*
* Process all identify hooks
*/
-void identify_hooks(int i, object_type *o_ptr, identify_mode mode)
+void identify_hooks(object_type *o_ptr)
{
/* Process the appropriate hooks */
- hook_identify_in in = { o_ptr, mode };
+ hook_identify_in in = { o_ptr };
process_hooks_new(HOOK_IDENTIFY, &in, NULL);
}
@@ -476,42 +462,27 @@ void identify_hooks(int i, object_type *o_ptr, identify_mode mode)
* Identify everything being carried.
* Done by a potion of "self knowledge".
*/
-bool_ identify_pack()
+bool identify_pack()
{
- int i;
-
/* Simply identify and know every item */
- for (i = 0; i < INVEN_TOTAL; i++)
+ for (int i = 0; i < INVEN_TOTAL; i++)
{
object_type *o_ptr = &p_ptr->inventory[i];
/* Skip non-objects */
- if (!o_ptr->k_idx) continue;
+ if (!o_ptr->k_ptr)
+ {
+ continue;
+ }
/* Aware and Known */
object_aware(o_ptr);
object_known(o_ptr);
-
- /* Process the appropriate hooks */
- identify_hooks(i, o_ptr, IDENT_NORMAL);
}
p_ptr->notice |= (PN_COMBINE | PN_REORDER);
p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
- return TRUE;
-}
-
-/*
- * common portions of identify_fully and identify_pack_fully
- */
-static void make_item_fully_identified(object_type *o_ptr)
-{
- /* Identify it fully */
- object_aware(o_ptr);
- object_known(o_ptr);
-
- /* Mark the item as fully known */
- o_ptr->ident |= (IDENT_MENTAL);
+ return true;
}
/*
@@ -528,12 +499,13 @@ void identify_pack_fully()
object_type *o_ptr = &p_ptr->inventory[i];
/* Skip non-objects */
- if (!o_ptr->k_idx) continue;
-
- make_item_fully_identified(o_ptr);
+ if (!o_ptr->k_ptr)
+ {
+ continue;
+ }
- /* Process the appropriate hooks */
- identify_hooks(i, o_ptr, IDENT_FULL);
+ object_aware(o_ptr);
+ object_known(o_ptr);
}
p_ptr->update |= (PU_BONUS);
@@ -553,36 +525,27 @@ static int enchant_table[16] =
1000
};
-static bool_ remove_curse_object(object_type *o_ptr, bool_ all)
+static bool remove_curse_object(object_type *o_ptr, bool all)
{
/* Skip non-objects */
- if (!o_ptr->k_idx) return FALSE;
+ if (!o_ptr->k_ptr) return false;
/* Uncursed already */
- if (!cursed_p(o_ptr)) return FALSE;
+ if (!cursed_p(o_ptr)) return false;
/* Extract the flags */
auto const flags = object_flags(o_ptr);
/* Heavily Cursed Items need a special spell */
- if (!all && (flags & TR_HEAVY_CURSE)) return FALSE;
+ if (!all && (flags & TR_HEAVY_CURSE)) return false;
/* Perma-Cursed Items can NEVER be uncursed */
- if (flags & TR_PERMA_CURSE) return FALSE;
-
- /* Uncurse it */
- o_ptr->ident &= ~(IDENT_CURSED);
-
- /* Hack -- Assume felt */
- o_ptr->ident |= (IDENT_SENSE);
+ if (flags & TR_PERMA_CURSE) return false;
/* Strip curse flags */
o_ptr->art_flags &= ~TR_CURSED;
o_ptr->art_flags &= ~TR_HEAVY_CURSE;
- /* Take note */
- o_ptr->sense = SENSE_UNCURSED;
-
/* Reverse the curse effect */
/* jk - scrolls of *remove curse* have a 1 in (55-level chance to */
/* reverse the curse effects - a ring of damage(-15) {cursed} then */
@@ -605,7 +568,7 @@ static bool_ remove_curse_object(object_type *o_ptr, bool_ all)
/* Window stuff */
p_ptr->window |= (PW_EQUIP);
- return TRUE;
+ return true;
}
/*
@@ -614,7 +577,7 @@ static bool_ remove_curse_object(object_type *o_ptr, bool_ all)
* Note that Items which are "Perma-Cursed" (The One Ring,
* The Crown of Morgoth) can NEVER be uncursed.
*
- * Note that if "all" is FALSE, then Items which are
+ * Note that if "all" is false, then Items which are
* "Heavy-Cursed" (Mormegil, Calris, and Weapons of Morgul)
* will not be uncursed.
*/
@@ -641,17 +604,17 @@ static int remove_curse_aux(int all)
/*
* Remove most curses
*/
-bool_ remove_curse()
+bool remove_curse()
{
- return (remove_curse_aux(FALSE) ? TRUE : FALSE);
+ return (remove_curse_aux(false) ? true : false);
}
/*
* Remove all curses
*/
-bool_ remove_all_curse()
+bool remove_all_curse()
{
- return (remove_curse_aux(TRUE) ? TRUE : FALSE);
+ return (remove_curse_aux(true) ? true : false);
}
@@ -659,7 +622,7 @@ bool_ remove_all_curse()
/*
* Restores any drained experience
*/
-bool_ restore_level()
+bool restore_level()
{
/* Restore experience */
if (p_ptr->exp < p_ptr->max_exp)
@@ -674,25 +637,25 @@ bool_ restore_level()
check_experience();
/* Did something */
- return (TRUE);
+ return true;
}
/* No effect */
- return (FALSE);
+ return false;
}
-bool_ alchemy() /* Turns an object into gold, gain some of its value in a shop */
+void alchemy()
{
int item, amt = 1;
int old_number;
long price;
- bool_ force = FALSE;
+ bool force = false;
char o_name[80];
char out_val[160];
/* Hack -- force destruction */
- if (command_arg > 0) force = TRUE;
+ if (command_arg > 0) force = true;
/* Get an item */
if (!get_item(&item,
@@ -701,7 +664,7 @@ bool_ alchemy() /* Turns an object into gold, gain some of its value in a shop *
(USE_INVEN | USE_FLOOR),
object_filter::True()))
{
- return (FALSE);
+ return;
}
/* Get the item */
@@ -714,14 +677,17 @@ bool_ alchemy() /* Turns an object into gold, gain some of its value in a shop *
amt = get_quantity(NULL, o_ptr->number);
/* Allow user abort */
- if (amt <= 0) return FALSE;
+ if (amt <= 0)
+ {
+ return;
+ }
}
/* Describe the object */
old_number = o_ptr->number;
o_ptr->number = amt;
- object_desc(o_name, o_ptr, TRUE, 3);
+ object_desc(o_name, o_ptr, true, 3);
o_ptr->number = old_number;
/* Verify unless quantity given */
@@ -729,34 +695,20 @@ bool_ alchemy() /* Turns an object into gold, gain some of its value in a shop *
{
/* Make a verification */
sprintf(out_val, "Really turn %s to gold? ", o_name);
- if (!get_check(out_val)) return FALSE;
+ if (!get_check(out_val))
+ {
+ return;
+ }
}
/* Artifacts cannot be destroyed */
if (artifact_p(o_ptr))
{
- byte feel = SENSE_SPECIAL;
-
/* Message */
msg_format("You fail to turn %s to gold!", o_name);
- /* Hack -- Handle icky artifacts */
- if (cursed_p(o_ptr)) feel = SENSE_TERRIBLE;
-
- /* Hack -- inscribe the artifact */
- o_ptr->sense = feel;
-
- /* We have "felt" it (again) */
- o_ptr->ident |= (IDENT_SENSE);
-
- /* Combine the pack */
- p_ptr->notice |= (PN_COMBINE);
-
- /* Window stuff */
- p_ptr->window |= (PW_INVEN | PW_EQUIP);
-
/* Done */
- return FALSE;
+ return;
}
price = object_value_real(o_ptr);
@@ -783,8 +735,6 @@ bool_ alchemy() /* Turns an object into gold, gain some of its value in a shop *
/* Eliminate the item */
inc_stack_size(item, -amt);
-
- return TRUE;
}
@@ -821,7 +771,7 @@ static int report_magics_aux(int dur)
}
}
-static cptr report_magic_durations[] =
+static const char *report_magic_durations[] =
{
"for a short time",
"for a little while",
@@ -840,7 +790,7 @@ void report_magics()
char Dummy[80];
- cptr info[128];
+ const char *info[128];
int info2[128];
if (p_ptr->blind)
@@ -941,8 +891,7 @@ void report_magics()
}
/* Save the screen */
- character_icky = TRUE;
- Term_save();
+ screen_save_no_flush();
/* Erase the screen */
for (k = 1; k < 24; k++) prt("", k, 13);
@@ -972,8 +921,7 @@ void report_magics()
inkey();
/* Restore the screen */
- Term_load();
- character_icky = FALSE;
+ screen_load_no_flush();
}
@@ -981,34 +929,8 @@ void report_magics()
/*
* Forget everything
*/
-bool_ lose_all_info()
+bool lose_all_info()
{
- int i;
-
- /* Forget info about objects */
- for (i = 0; i < INVEN_TOTAL; i++)
- {
- object_type *o_ptr = &p_ptr->inventory[i];
-
- /* Skip non-objects */
- if (!o_ptr->k_idx) continue;
-
- /* Allow "protection" by the MENTAL flag */
- if (o_ptr->ident & (IDENT_MENTAL)) continue;
-
- /* Remove sensing */
- o_ptr->sense = SENSE_NONE;
-
- /* Hack -- Clear the "empty" flag */
- o_ptr->ident &= ~(IDENT_EMPTY);
-
- /* Hack -- Clear the "known" flag */
- o_ptr->ident &= ~(IDENT_KNOWN);
-
- /* Hack -- Clear the "felt" flag */
- o_ptr->ident &= ~(IDENT_SENSE);
- }
-
/* Recalculate bonuses */
p_ptr->update |= (PU_BONUS);
@@ -1022,18 +944,18 @@ bool_ lose_all_info()
wiz_dark();
/* It worked */
- return (TRUE);
+ return true;
}
/*
* Detect all doors on current panel
*/
-bool_ detect_doors(int rad)
+bool detect_doors(int rad)
{
int y, x;
- bool_ detect = FALSE;
+ bool detect = false;
cave_type *c_ptr;
@@ -1075,7 +997,7 @@ bool_ detect_doors(int rad)
lite_spot(y, x);
/* Obvious */
- detect = TRUE;
+ detect = true;
}
}
}
@@ -1094,11 +1016,11 @@ bool_ detect_doors(int rad)
/*
* Detect all stairs on current panel
*/
-bool_ detect_stairs(int rad)
+bool detect_stairs(int rad)
{
int y, x;
- bool_ detect = FALSE;
+ bool detect = false;
cave_type *c_ptr;
@@ -1129,7 +1051,7 @@ bool_ detect_stairs(int rad)
lite_spot(y, x);
/* Obvious */
- detect = TRUE;
+ detect = true;
}
}
}
@@ -1148,11 +1070,11 @@ bool_ detect_stairs(int rad)
/*
* Detect any treasure on the current panel
*/
-bool_ detect_treasure(int rad)
+bool detect_treasure(int rad)
{
int y, x;
- bool_ detect = FALSE;
+ bool detect = false;
cave_type *c_ptr;
@@ -1193,7 +1115,7 @@ bool_ detect_treasure(int rad)
lite_spot(y, x);
/* Detect */
- detect = TRUE;
+ detect = true;
}
}
}
@@ -1244,19 +1166,19 @@ template<typename P> static bool detect_monsters_fn(int radius, P p) {
if (p(r_ptr.get()))
{
/* Repair visibility later */
- repair_monsters = TRUE;
+ repair_monsters = true;
/* Hack -- Detect monster */
m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW);
/* Hack -- See monster */
- m_ptr->ml = TRUE;
+ m_ptr->ml = true;
/* Redraw */
if (panel_contains(y, x)) lite_spot(y, x);
/* Detect */
- flag = TRUE;
+ flag = true;
}
}
/* Result */
@@ -1266,7 +1188,7 @@ template<typename P> static bool detect_monsters_fn(int radius, P p) {
/*
* Detect all (string) monsters on current panel
*/
-static bool_ detect_monsters_string(cptr chars, int rad)
+static bool detect_monsters_string(const char *chars, int rad)
{
auto predicate = [chars](monster_race *r_ptr) -> bool {
return strchr(chars, r_ptr->d_char);
@@ -1277,11 +1199,11 @@ static bool_ detect_monsters_string(cptr chars, int rad)
{
/* Describe result */
msg_print("You sense the presence of monsters!");
- return TRUE;
+ return true;
}
else
{
- return FALSE;
+ return false;
}
}
@@ -1299,7 +1221,7 @@ template <typename P> bool detect_objects_fn(int radius, const char *object_mess
object_type *o_ptr = &o_list[i];
/* Skip dead objects */
- if (!o_ptr->k_idx) continue;
+ if (!o_ptr->k_ptr) continue;
/* Location */
int y, x;
@@ -1339,13 +1261,13 @@ template <typename P> bool detect_objects_fn(int radius, const char *object_mess
if (p(o_ptr))
{
/* Hack -- memorize it */
- o_ptr->marked = TRUE;
+ o_ptr->marked = true;
/* Redraw */
if (panel_contains(y, x)) lite_spot(y, x);
/* Detect */
- detect = TRUE;
+ detect = true;
}
}
@@ -1404,7 +1326,7 @@ bool detect_objects_normal(int rad)
/*
* Detect all "normal" monsters on the current panel
*/
-bool_ detect_monsters_normal(int rad)
+bool detect_monsters_normal(int rad)
{
auto predicate = [](monster_race *r_ptr) -> bool {
return (!(r_ptr->flags & RF_INVISIBLE)) ||
@@ -1415,11 +1337,11 @@ bool_ detect_monsters_normal(int rad)
{
/* Describe result */
msg_print("You sense the presence of monsters!");
- return TRUE;
+ return true;
}
else
{
- return FALSE;
+ return false;
}
}
@@ -1427,7 +1349,7 @@ bool_ detect_monsters_normal(int rad)
/*
* Detect all "invisible" monsters on current panel
*/
-bool_ detect_monsters_invis(int rad)
+bool detect_monsters_invis(int rad)
{
auto predicate = [](monster_race *r_ptr) -> bool {
return bool(r_ptr->flags & RF_INVISIBLE);
@@ -1437,11 +1359,11 @@ bool_ detect_monsters_invis(int rad)
{
/* Describe result */
msg_print("You sense the presence of invisible creatures!");
- return TRUE;
+ return true;
}
else
{
- return FALSE;
+ return false;
}
}
@@ -1467,18 +1389,18 @@ void detect_monsters_orcs(int rad)
/*
* Detect everything
*/
-bool_ detect_all(int rad)
+bool detect_all(int rad)
{
- bool_ detect = FALSE;
+ bool detect = false;
/* Detect everything */
- if (detect_doors(rad)) detect = TRUE;
- if (detect_stairs(rad)) detect = TRUE;
- if (detect_treasure(rad)) detect = TRUE;
- if (detect_objects_gold(rad)) detect = TRUE;
- if (detect_objects_normal(rad)) detect = TRUE;
- if (detect_monsters_invis(rad)) detect = TRUE;
- if (detect_monsters_normal(rad)) detect = TRUE;
+ if (detect_doors(rad)) detect = true;
+ if (detect_stairs(rad)) detect = true;
+ if (detect_treasure(rad)) detect = true;
+ if (detect_objects_gold(rad)) detect = true;
+ if (detect_objects_normal(rad)) detect = true;
+ if (detect_monsters_invis(rad)) detect = true;
+ if (detect_monsters_normal(rad)) detect = true;
/* Result */
return (detect);
@@ -1491,6 +1413,8 @@ bool_ detect_all(int rad)
*/
void stair_creation()
{
+ auto const &dungeon_flags = game->dungeon_flags;
+
/* XXX XXX XXX */
if (!cave_valid_bold(p_ptr->py, p_ptr->px))
{
@@ -1629,10 +1553,10 @@ object_filter_t const &item_tester_hook_artifactable()
* Note that this function can now be used on "piles" of items, and
* the larger the pile, the lower the chance of success.
*/
-bool_ enchant(object_type *o_ptr, int n, int eflag)
+bool enchant(object_type *o_ptr, int n, int eflag)
{
int i, chance, prob;
- bool_ res = FALSE;
+ bool res = false;
auto const a = artifact_p(o_ptr);
/* Extract the flags */
@@ -1644,15 +1568,7 @@ bool_ enchant(object_type *o_ptr, int n, int eflag)
if (cursed_p(o_ptr) && (!(flags & TR_PERMA_CURSE)))
{
msg_print("The curse is broken!");
- o_ptr->ident &= ~(IDENT_CURSED);
- o_ptr->ident |= (IDENT_SENSE);
-
- if (o_ptr->art_flags & TR_CURSED)
- o_ptr->art_flags &= ~TR_CURSED;
- if (o_ptr->art_flags & TR_HEAVY_CURSE)
- o_ptr->art_flags &= ~TR_HEAVY_CURSE;
-
- o_ptr->sense = SENSE_UNCURSED;
+ o_ptr->art_flags &= ~(TR_CURSED | TR_HEAVY_CURSE);
}
};
@@ -1683,7 +1599,7 @@ bool_ enchant(object_type *o_ptr, int n, int eflag)
if ((randint(1000) > chance) && (!a || (rand_int(100) < 50)))
{
o_ptr->to_h++;
- res = TRUE;
+ res = true;
/* break curse? */
if ((o_ptr->to_h >= 0) && (rand_int(100) < 25))
@@ -1703,7 +1619,7 @@ bool_ enchant(object_type *o_ptr, int n, int eflag)
if ((randint(1000) > chance) && (!a || (rand_int(100) < 50)))
{
o_ptr->to_d++;
- res = TRUE;
+ res = true;
/* break curse? */
if ((o_ptr->to_d >= 0) && (rand_int(100) < 25))
@@ -1724,7 +1640,7 @@ bool_ enchant(object_type *o_ptr, int n, int eflag)
if ((randint(1000) > chance) && (!a || (rand_int(100) < 50)))
{
o_ptr->pval++;
- res = TRUE;
+ res = true;
/* break curse? */
if ((o_ptr->pval >= 0) && (rand_int(100) < 25))
@@ -1744,7 +1660,7 @@ bool_ enchant(object_type *o_ptr, int n, int eflag)
if ((randint(1000) > chance) && (!a || (rand_int(100) < 50)))
{
o_ptr->to_a++;
- res = TRUE;
+ res = true;
/* break curse? */
if ((o_ptr->to_a >= 0) && (rand_int(100) < 25))
@@ -1756,7 +1672,7 @@ bool_ enchant(object_type *o_ptr, int n, int eflag)
}
/* Failure */
- if (!res) return (FALSE);
+ if (!res) return false;
/* Recalculate bonuses */
p_ptr->update |= (PU_BONUS);
@@ -1768,7 +1684,7 @@ bool_ enchant(object_type *o_ptr, int n, int eflag)
p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
/* Success */
- return (TRUE);
+ return true;
}
@@ -1776,14 +1692,15 @@ bool_ enchant(object_type *o_ptr, int n, int eflag)
/*
* Enchant an item (in the inventory or on the floor)
* Note that "num_ac" requires armour, else weapon
- * Returns TRUE if attempted, FALSE if cancelled
+ * Returns true if attempted, false if cancelled
*/
-bool_ enchant_spell(int num_hit, int num_dam, int num_ac, int num_pval)
+bool enchant_spell(int num_hit, int num_dam, int num_ac, int num_pval)
{
int item;
- bool_ okay = FALSE;
+ bool okay = false;
char o_name[80];
- cptr q, s;
+ const char *q;
+ const char *s;
/* Assume enchant weapon */
@@ -1798,13 +1715,13 @@ bool_ enchant_spell(int num_hit, int num_dam, int num_ac, int num_pval)
/* Get an item */
q = "Enchant which item? ";
s = "You have nothing to enchant.";
- if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR), object_filter)) return (FALSE);
+ if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR), object_filter)) return false;
/* Get the item */
object_type *o_ptr = get_object(item);
/* Description */
- object_desc(o_name, o_ptr, FALSE, 0);
+ object_desc(o_name, o_ptr, false, 0);
/* Describe */
msg_format("%s %s glow%s brightly!",
@@ -1812,10 +1729,10 @@ bool_ enchant_spell(int num_hit, int num_dam, int num_ac, int num_pval)
((o_ptr->number > 1) ? "" : "s"));
/* Enchant */
- if (enchant(o_ptr, num_hit, ENCH_TOHIT)) okay = TRUE;
- if (enchant(o_ptr, num_dam, ENCH_TODAM)) okay = TRUE;
- if (enchant(o_ptr, num_ac, ENCH_TOAC)) okay = TRUE;
- if (enchant(o_ptr, num_pval, ENCH_PVAL)) okay = TRUE;
+ if (enchant(o_ptr, num_hit, ENCH_TOHIT)) okay = true;
+ if (enchant(o_ptr, num_dam, ENCH_TODAM)) okay = true;
+ if (enchant(o_ptr, num_ac, ENCH_TOAC)) okay = true;
+ if (enchant(o_ptr, num_pval, ENCH_PVAL)) okay = true;
/* Failure */
if (!okay)
@@ -1828,7 +1745,7 @@ bool_ enchant_spell(int num_hit, int num_dam, int num_ac, int num_pval)
}
/* Something happened */
- return (TRUE);
+ return true;
}
void curse_artifact(object_type * o_ptr)
@@ -1844,7 +1761,6 @@ void curse_artifact(object_type * o_ptr)
if (randint(3) == 1) o_ptr-> art_flags |= TR_BLACK_BREATH;
if (randint(2) == 1) o_ptr-> art_flags |= TR_TELEPORT;
else if (randint(3) == 1) o_ptr->art_flags |= TR_NO_TELE;
- o_ptr->ident |= IDENT_CURSED;
}
@@ -2165,7 +2081,7 @@ static void note_found_object(object_type *o_ptr)
if (artifact_p(o_ptr))
{
- object_desc(item_name, o_ptr, FALSE, 0);
+ object_desc(item_name, o_ptr, false, 0);
/* Build note and write */
sprintf(note, "Found The %s", item_name);
@@ -2179,9 +2095,9 @@ static void note_found_object(object_type *o_ptr)
/*
* Identify an object in the inventory (or on the floor)
* This routine does *not* automatically combine objects.
- * Returns TRUE if something was identified, else FALSE.
+ * Returns true if something was identified, else false.
*/
-bool_ ident_spell()
+bool ident_spell()
{
/* Get an item */
int item;
@@ -2189,7 +2105,7 @@ bool_ ident_spell()
"Identify which item? ",
"You have nothing to identify.",
(USE_EQUIP | USE_INVEN | USE_FLOOR),
- object_filter::Not(object_known_p))) return (FALSE);
+ object_filter::Not(object_known_p))) return false;
/* Get the item */
object_type *o_ptr = get_object(item);
@@ -2209,7 +2125,7 @@ bool_ ident_spell()
/* Description */
char o_name[80];
- object_desc(o_name, o_ptr, TRUE, 3);
+ object_desc(o_name, o_ptr, true, 3);
/* Describe */
if (item >= INVEN_WIELD)
@@ -2231,17 +2147,14 @@ bool_ ident_spell()
/* Make note of found artifacts */
note_found_object(o_ptr);
- /* Process the appropriate hooks */
- identify_hooks(item, o_ptr, IDENT_NORMAL);
-
/* Something happened */
- return (TRUE);
+ return true;
}
/*
* Identify all objects in the level
*/
-bool_ ident_all()
+bool ident_all()
{
int i;
@@ -2258,94 +2171,14 @@ bool_ ident_all()
/* Make note of found artifacts */
note_found_object(o_ptr);
-
- /* Process the appropriate hooks */
- identify_hooks(-i, o_ptr, IDENT_NORMAL);
}
/* Something happened */
- return (TRUE);
-}
-
-
-
-/*
- * Determine if an object is not fully identified
- */
-static bool item_tester_hook_no_mental(object_type const *o_ptr)
-{
- return ((o_ptr->ident & (IDENT_MENTAL)) ? false : true);
-}
-
-/*
- * Fully "identify" an object in the inventory -BEN-
- * This routine returns TRUE if an item was identified.
- */
-bool_ identify_fully()
-{
- /* Get an item */
- int item;
- if (!get_item(&item,
- "Identify which item? ",
- "You have nothing to identify.",
- (USE_EQUIP | USE_INVEN | USE_FLOOR),
- item_tester_hook_no_mental))
- {
- return (FALSE);
- }
-
- /* Get the item */
- object_type *o_ptr = get_object(item);
-
- /* Do the identification */
- make_item_fully_identified(o_ptr);
-
- /* Recalculate bonuses */
- p_ptr->update |= (PU_BONUS);
-
- /* Combine / Reorder the pack (later) */
- p_ptr->notice |= (PN_COMBINE | PN_REORDER);
-
- /* Window stuff */
- p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
-
- /* Description */
- char o_name[80];
- object_desc(o_name, o_ptr, TRUE, 3);
-
- /* Describe */
- if (item >= INVEN_WIELD)
- {
- msg_format("%^s: %s (%c).",
- describe_use(item), o_name, index_to_label(item));
- }
- else if (item >= 0)
- {
- msg_format("In your pack: %s (%c).",
- o_name, index_to_label(item));
- }
- else
- {
- msg_format("On the ground: %s.",
- o_name);
- }
-
- /* Make note of found artifacts */
- note_found_object(o_ptr);
-
- /* Describe it fully */
- object_out_desc(o_ptr, NULL, FALSE, TRUE);
-
- /* Process the appropriate hooks */
- identify_hooks(item, o_ptr, IDENT_FULL);
-
- /* Success */
- return (TRUE);
+ return true;
}
-
/*
* Hook for "get_item()". Determine if something is rechargable.
*/
@@ -2385,13 +2218,11 @@ object_filter_t const &item_tester_hook_recharge()
*
* XXX XXX XXX Beware of "sliding index errors".
*/
-bool_ recharge(int power)
+bool recharge(int power)
{
- auto const &k_info = game->edit_data.k_info;
-
int recharge_strength, recharge_amount;
int lev;
- bool_ fail = FALSE;
+ bool fail = false;
byte fail_type = 1;
char o_name[80];
@@ -2404,7 +2235,7 @@ bool_ recharge(int power)
(USE_INVEN | USE_FLOOR),
item_tester_hook_recharge()))
{
- return (FALSE);
+ return false;
}
/* Get the item */
@@ -2414,7 +2245,7 @@ bool_ recharge(int power)
auto const flags = object_flags(o_ptr);
/* Extract the object "level" */
- lev = k_info[o_ptr->k_idx].level;
+ lev = o_ptr->k_ptr->level;
/* Recharge a rod */
if (o_ptr->tval == TV_ROD_MAIN)
@@ -2429,7 +2260,7 @@ bool_ recharge(int power)
if ((rand_int(recharge_strength) == 0) && (!(flags & TR_RECHARGE)))
{
/* Activate the failure code. */
- fail = TRUE;
+ fail = true;
}
/* Recharge */
@@ -2467,7 +2298,7 @@ bool_ recharge(int power)
(flags & TR_NO_RECHARGE))
{
/* Activate the failure code. */
- fail = TRUE;
+ fail = true;
}
/* If the spell didn't backfire, recharge the wand or staff. */
@@ -2496,15 +2327,6 @@ bool_ recharge(int power)
/* Recharge the wand or staff. */
o_ptr->pval += recharge_amount;
-
- if (!(flags & TR_RECHARGE))
- {
- /* Hack -- we no longer "know" the item */
- o_ptr->ident &= ~(IDENT_KNOWN);
- }
-
- /* Hack -- we no longer think the item is empty */
- o_ptr->ident &= ~(IDENT_EMPTY);
}
}
@@ -2517,7 +2339,7 @@ bool_ recharge(int power)
/* Artifacts are never destroyed. */
if (artifact_p(o_ptr))
{
- object_desc(o_name, o_ptr, TRUE, 0);
+ object_desc(o_name, o_ptr, true, 0);
msg_format("The recharging backfires - %s is completely drained!", o_name);
/* Artifact rods. */
@@ -2531,7 +2353,7 @@ bool_ recharge(int power)
else
{
/* Get the object description */
- object_desc(o_name, o_ptr, FALSE, 0);
+ object_desc(o_name, o_ptr, false, 0);
/*** Determine Seriousness of Failure ***/
@@ -2637,7 +2459,7 @@ bool_ recharge(int power)
p_ptr->window |= (PW_INVEN);
/* Something was done */
- return (TRUE);
+ return true;
}
@@ -2647,11 +2469,11 @@ bool_ recharge(int power)
*
* Note that affected monsters are NOT auto-tracked by this usage.
*/
-bool_ project_hack(int typ, int dam)
+bool project_hack(int typ, int dam)
{
int i, x, y;
int flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
- bool_ obvious = FALSE;
+ bool obvious = false;
/* Affect all (nearby) monsters */
@@ -2670,7 +2492,7 @@ bool_ project_hack(int typ, int dam)
if (!player_has_los_bold(y, x)) continue;
/* Jump directly to the target monster */
- if (project(0, 0, y, x, dam, typ, flg)) obvious = TRUE;
+ if (project(0, 0, y, x, dam, typ, flg)) obvious = true;
}
/* Result */
@@ -2715,7 +2537,7 @@ void project_meteor(int radius, int typ, int dam, u32b flg)
/*
* Banish evil monsters
*/
-bool_ banish_evil(int dist)
+bool banish_evil(int dist)
{
return (project_hack(GF_AWAY_EVIL, dist));
}
@@ -2725,33 +2547,33 @@ bool_ banish_evil(int dist)
/*
* Dispel undead monsters
*/
-bool_ dispel_undead(int dam)
+void dispel_undead(int dam)
{
- return (project_hack(GF_DISP_UNDEAD, dam));
+ project_hack(GF_DISP_UNDEAD, dam);
}
/*
* Dispel evil monsters
*/
-bool_ dispel_evil(int dam)
+void dispel_evil(int dam)
{
- return (project_hack(GF_DISP_EVIL, dam));
+ project_hack(GF_DISP_EVIL, dam);
}
/*
* Dispel good monsters
*/
-bool_ dispel_good(int dam)
+void dispel_good(int dam)
{
- return (project_hack(GF_DISP_GOOD, dam));
+ project_hack(GF_DISP_GOOD, dam);
}
/*
* Dispel all monsters
*/
-bool_ dispel_monsters(int dam)
+void dispel_monsters(int dam)
{
- return (project_hack(GF_DISP_ALL, dam));
+ project_hack(GF_DISP_ALL, dam);
}
@@ -2761,8 +2583,8 @@ bool_ dispel_monsters(int dam)
void aggravate_monsters(int who)
{
int i;
- bool_ sleep = FALSE;
- bool_ speed = FALSE;
+ bool sleep = false;
+ bool speed = false;
/* Aggravate everyone nearby */
@@ -2784,7 +2606,7 @@ void aggravate_monsters(int who)
{
/* Wake up */
m_ptr->csleep = 0;
- sleep = TRUE;
+ sleep = true;
}
}
@@ -2798,7 +2620,7 @@ void aggravate_monsters(int who)
{
/* Speed up */
m_ptr->mspeed = r_ptr->speed + 10;
- speed = TRUE;
+ speed = true;
}
/* Pets may get angry (50% chance) */
@@ -2820,13 +2642,13 @@ void aggravate_monsters(int who)
/*
* Generic genocide race selection
*/
-static bool get_genocide_race(cptr msg, char *typ)
+static bool get_genocide_race(const char *msg, char *typ)
{
int i, j;
cave_type *c_ptr;
msg_print(msg);
- if (!tgt_pt(&i, &j)) return FALSE;
+ if (!tgt_pt(&i, &j)) return false;
c_ptr = &cave[j][i];
@@ -2847,10 +2669,9 @@ static bool get_genocide_race(cptr msg, char *typ)
/*
* Delete all non-unique/non-quest monsters of a given "type" from the level
*/
-bool_ genocide_aux(bool_ player_cast, char typ)
+static void genocide_aux(char typ)
{
int i;
- bool_ result = FALSE;
auto const msec = options->delay_factor_ms();
int dam = 0;
@@ -2887,22 +2708,19 @@ bool_ genocide_aux(bool_ player_cast, char typ)
}
while (!(in_bounds(wy, wx) && cave_floor_bold(wy, wx)) && --attempts);
- if (place_monster_aux(wy, wx, m_ptr->r_idx, FALSE, TRUE, MSTATUS_ENEMY))
+ if (place_monster_aux(wy, wx, m_ptr->r_idx, false, true, MSTATUS_ENEMY))
{
cmsg_format(TERM_L_BLUE, "The spell seems to produce an ... interesting effect on the %s.", buf);
}
- return TRUE;
+ return;
}
/* Delete the monster */
delete_monster_idx(i);
- if (player_cast)
- {
- /* Keep track of damage */
- dam += randint(4);
- }
+ /* Keep track of damage */
+ dam += randint(4);
/* Handle */
handle_stuff();
@@ -2912,62 +2730,62 @@ bool_ genocide_aux(bool_ player_cast, char typ)
/* Delay */
sleep_for(milliseconds(msec));
-
- /* Take note */
- result = TRUE;
}
- if (player_cast)
- {
- /* Take damage */
- take_hit(dam, "the strain of casting Genocide");
-
- /* Visual feedback */
- move_cursor_relative(p_ptr->py, p_ptr->px);
+ /* Take damage */
+ take_hit(dam, "the strain of casting Genocide");
- /* Redraw */
- p_ptr->redraw |= (PR_FRAME);
+ /* Visual feedback */
+ move_cursor_relative(p_ptr->py, p_ptr->px);
- /* Window stuff */
- p_ptr->window |= (PW_PLAYER);
+ /* Redraw */
+ p_ptr->redraw |= (PR_FRAME);
- /* Handle */
- handle_stuff();
+ /* Window stuff */
+ p_ptr->window |= (PW_PLAYER);
- /* Fresh */
- Term_fresh();
- }
+ /* Handle */
+ handle_stuff();
- return (result);
+ /* Fresh */
+ Term_fresh();
}
-bool_ genocide(bool_ player_cast)
+void genocide()
{
- char typ;
+ auto const &dungeon_flags = game->dungeon_flags;
- if (dungeon_flags & DF_NO_GENO) return (FALSE);
+ if (dungeon_flags & DF_NO_GENO)
+ {
+ return;
+ }
/* Hack -- when you are fated to die, you cant cheat :) */
if (dungeon_type == DUNGEON_DEATH)
{
msg_print("A mysterious force stops the genocide.");
- return FALSE;
+ return;
}
/* Mega-Hack -- Get a monster symbol */
- if (!get_genocide_race("Target a monster to select the race to genocide.", &typ)) return FALSE;
+ char typ;
+ if (!get_genocide_race("Target a monster to select the race to genocide.", &typ))
+ {
+ return;
+ }
- return (genocide_aux(player_cast, typ));
+ genocide_aux(typ);
}
/*
* Delete all nearby (non-unique) monsters
*/
-bool_ mass_genocide(bool_ player_cast)
+void mass_genocide()
{
+ auto const &dungeon_flags = game->dungeon_flags;
+
int i;
- bool_ result = FALSE;
auto const msec = options->delay_factor_ms();
int dam = 0;
@@ -2975,7 +2793,7 @@ bool_ mass_genocide(bool_ player_cast)
if ((dungeon_flags & DF_NO_GENO) || (dungeon_type == DUNGEON_DEATH))
{
msg_print("A mysterious force stops the genocide.");
- return FALSE;
+ return;
}
/* Delete the (nearby) monsters */
@@ -3011,22 +2829,19 @@ bool_ mass_genocide(bool_ player_cast)
}
while (!(in_bounds(wy, wx) && cave_floor_bold(wy, wx)) && --attempts);
- if (place_monster_aux(wy, wx, m_ptr->r_idx, FALSE, TRUE, MSTATUS_ENEMY))
+ if (place_monster_aux(wy, wx, m_ptr->r_idx, false, true, MSTATUS_ENEMY))
{
cmsg_format(TERM_L_BLUE, "The spell seems to produce an ... interesting effect on the %s.", buf);
}
- return TRUE;
+ return;
}
/* Delete the monster */
delete_monster_idx(i);
- if (player_cast)
- {
- /* Keep track of damage. */
- dam += randint(3);
- }
+ /* Keep track of damage. */
+ dam += randint(3);
/* Handle */
handle_stuff();
@@ -3036,33 +2851,25 @@ bool_ mass_genocide(bool_ player_cast)
/* Delay */
sleep_for(milliseconds(msec));
-
- /* Note effect */
- result = TRUE;
}
- if (player_cast)
- {
- /* Take damage */
- take_hit(dam, "the strain of casting Mass Genocide");
-
- /* Visual feedback */
- move_cursor_relative(p_ptr->py, p_ptr->px);
+ /* Take damage */
+ take_hit(dam, "the strain of casting Mass Genocide");
- /* Redraw */
- p_ptr->redraw |= (PR_FRAME);
+ /* Visual feedback */
+ move_cursor_relative(p_ptr->py, p_ptr->px);
- /* Window stuff */
- p_ptr->window |= (PW_PLAYER);
+ /* Redraw */
+ p_ptr->redraw |= (PR_FRAME);
- /* Handle */
- handle_stuff();
+ /* Window stuff */
+ p_ptr->window |= (PW_PLAYER);
- /* Fresh */
- Term_fresh();
- }
+ /* Handle */
+ handle_stuff();
- return (result);
+ /* Fresh */
+ Term_fresh();
}
@@ -3076,11 +2883,13 @@ bool_ mass_genocide(bool_ player_cast)
*/
void destroy_area(int y1, int x1, int r)
{
+ auto const &dungeon_flags = game->dungeon_flags;
+
int y, x, k, t;
cave_type *c_ptr;
- bool_ flag = FALSE;
+ bool flag = false;
if (dungeon_flags & DF_NO_GENO)
@@ -3120,7 +2929,7 @@ void destroy_area(int y1, int x1, int r)
if ((x == p_ptr->px) && (y == p_ptr->py))
{
/* Hurt the player later */
- flag = TRUE;
+ flag = true;
/* Do not hurt this grid */
continue;
@@ -3231,9 +3040,9 @@ void earthquake(int cy, int cx, int r)
int i, t, y, x, yy, xx, dy, dx, oy, ox;
int damage = 0;
int sn = 0, sy = 0, sx = 0;
- bool_ hurt = FALSE;
+ bool hurt = false;
cave_type *c_ptr;
- bool_ map[32][32];
+ bool map[32][32];
if (p_ptr->inside_quest)
{
@@ -3248,7 +3057,7 @@ void earthquake(int cy, int cx, int r)
{
for (x = 0; x < 32; x++)
{
- map[y][x] = FALSE;
+ map[y][x] = false;
}
}
@@ -3283,10 +3092,10 @@ void earthquake(int cy, int cx, int r)
if (rand_int(100) < 85) continue;
/* Damage this grid */
- map[16 + yy - cy][16 + xx - cx] = TRUE;
+ map[16 + yy - cy][16 + xx - cx] = true;
/* Hack -- Take note of player damage */
- if ((yy == p_ptr->py) && (xx == p_ptr->px)) hurt = TRUE;
+ if ((yy == p_ptr->py) && (xx == p_ptr->px)) hurt = true;
}
}
@@ -3392,7 +3201,7 @@ void earthquake(int cy, int cx, int r)
}
/* Important -- no wall on player */
- map[16 + p_ptr->py - cy][16 + p_ptr->px - cx] = FALSE;
+ map[16 + p_ptr->py - cy][16 + p_ptr->px - cx] = false;
/* Semi-wraiths have to be hurt *some*, says DG */
if (race_flags_p(PR_SEMI_WRAITH))
@@ -3450,11 +3259,6 @@ void earthquake(int cy, int cx, int r)
if (cave[y][x].feat == FEAT_GLYPH) continue;
if (cave[y][x].feat == FEAT_MINOR_GLYPH) continue;
- /* ... nor on the Pattern */
- if ((cave[y][x].feat <= FEAT_PATTERN_XTRA2) &&
- (cave[y][x].feat >= FEAT_PATTERN_START))
- continue;
-
/* Important -- Skip "quake" grids */
if (map[16 + y - cy][16 + x - cx]) continue;
@@ -3514,7 +3318,7 @@ void earthquake(int cy, int cx, int r)
m_ptr->fx = sx;
/* Update the monster (new location) */
- update_mon(m_idx, TRUE);
+ update_mon(m_idx, true);
/* Redraw the old grid */
lite_spot(yy, xx);
@@ -3549,7 +3353,7 @@ void earthquake(int cy, int cx, int r)
/* Destroy location (if valid) */
if (cave_valid_bold(yy, xx))
{
- bool_ floor = cave_floor_bold(yy, xx);
+ bool floor = cave_floor_bold(yy, xx);
/* Delete objects */
delete_object(yy, xx);
@@ -3673,7 +3477,7 @@ static void cave_temp_room_lite()
auto const r_ptr = m_ptr->race();
/* Update the monster */
- update_mon(c_ptr->m_idx, FALSE);
+ update_mon(c_ptr->m_idx, false);
/* Stupid monsters rarely wake up */
if (r_ptr->flags & RF_STUPID) chance = 10;
@@ -3876,7 +3680,7 @@ void unlite_room(int y1, int x1)
* Hack -- call light around the player
* Affect all monsters in the projection radius
*/
-bool_ lite_area(int dam, int rad)
+void lite_area(int dam, int rad)
{
int flg = PROJECT_GRID | PROJECT_KILL;
@@ -3891,9 +3695,6 @@ bool_ lite_area(int dam, int rad)
/* Lite up the room */
lite_room(p_ptr->py, p_ptr->px);
-
- /* Assume seen */
- return (TRUE);
}
@@ -3901,7 +3702,7 @@ bool_ lite_area(int dam, int rad)
* Hack -- call darkness around the player
* Affect all monsters in the projection radius
*/
-bool_ unlite_area(int dam, int rad)
+void unlite_area(int dam, int rad)
{
int flg = PROJECT_GRID | PROJECT_KILL;
@@ -3916,9 +3717,6 @@ bool_ unlite_area(int dam, int rad)
/* Lite up the room */
unlite_room(p_ptr->py, p_ptr->px);
-
- /* Assume seen */
- return (TRUE);
}
@@ -3928,7 +3726,7 @@ bool_ unlite_area(int dam, int rad)
* Allow "target" mode to pass over monsters
* Affect grids, objects, and monsters
*/
-bool_ fire_ball(int typ, int dir, int dam, int rad)
+bool fire_ball(int typ, int dir, int dam, int rad)
{
int tx, ty;
@@ -3956,7 +3754,7 @@ bool_ fire_ball(int typ, int dir, int dam, int rad)
* Allow "target" mode to pass over monsters
* Affect grids, objects, and monsters
*/
-bool_ fire_cloud(int typ, int dir, int dam, int rad, int time)
+void fire_cloud(int typ, int dir, int dam, int rad, int time)
{
int tx, ty;
@@ -3976,7 +3774,7 @@ bool_ fire_cloud(int typ, int dir, int dam, int rad, int time)
project_time = time;
/* Analyze the "dir" and the "target". Hurt items on floor. */
- return (project(0, (rad > 16) ? 16 : rad, ty, tx, dam, typ, flg));
+ project(0, (rad > 16) ? 16 : rad, ty, tx, dam, typ, flg);
}
/*
@@ -3985,10 +3783,10 @@ bool_ fire_cloud(int typ, int dir, int dam, int rad, int time)
* Allow "target" mode to pass over monsters
* Affect grids, objects, and monsters
*/
-bool_ fire_wave(int typ, int dir, int dam, int rad, int time, s32b eff)
+void fire_wave(int typ, int dir, int dam, int rad, int time, s32b eff)
{
project_time_effect = eff;
- return (fire_cloud(typ, dir, dam, rad, time));
+ fire_cloud(typ, dir, dam, rad, time);
}
/*
@@ -3996,11 +3794,11 @@ bool_ fire_wave(int typ, int dir, int dam, int rad, int time, s32b eff)
* Pass through monsters, as a "beam"
* Affect monsters (not grids or objects)
*/
-bool_ fire_wall(int typ, int dir, int dam, int time)
+void fire_wall(int typ, int dir, int dam, int time)
{
int flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_STAY | PROJECT_GRID;
project_time = time;
- return (project_hook(typ, dir, dam, flg));
+ project_hook(typ, dir, dam, flg);
}
@@ -4059,7 +3857,7 @@ void teleport_swap(int dir)
ty = m_ptr->fy;
/* Update the monster (new location) */
- update_mon(cave[ty][tx].m_idx, TRUE);
+ update_mon(cave[ty][tx].m_idx, true);
/* Redraw the old grid */
lite_spot(ty, tx);
@@ -4170,7 +3968,7 @@ void swap_position(int lty, int ltx)
ty = m_ptr->fy;
/* Update the monster (new location) */
- update_mon(cave[ty][tx].m_idx, TRUE);
+ update_mon(cave[ty][tx].m_idx, true);
/* Redraw the old grid */
lite_spot(ty, tx);
@@ -4199,7 +3997,7 @@ void swap_position(int lty, int ltx)
/*
* Hack -- apply a "projection()" in a direction (or at the target)
*/
-bool_ project_hook(int typ, int dir, int dam, int flg)
+bool project_hook(int typ, int dir, int dam, int flg)
{
int tx, ty;
@@ -4227,10 +4025,9 @@ bool_ project_hook(int typ, int dir, int dam, int flg)
* Stop if we hit a monster, as a "bolt"
* Affect monsters (not grids or objects)
*/
-bool_ fire_bolt(int typ, int dir, int dam)
+void fire_bolt(int typ, int dir, int dam)
{
- int flg = PROJECT_STOP | PROJECT_KILL;
- return (project_hook(typ, dir, dam, flg));
+ project_hook(typ, dir, dam, PROJECT_STOP | PROJECT_KILL);
}
@@ -4239,25 +4036,24 @@ bool_ fire_bolt(int typ, int dir, int dam)
* Pass through monsters, as a "beam"
* Affect monsters (not grids or objects)
*/
-bool_ fire_beam(int typ, int dir, int dam)
+void fire_beam(int typ, int dir, int dam)
{
- int flg = PROJECT_BEAM | PROJECT_KILL;
- return (project_hook(typ, dir, dam, flg));
+ project_hook(typ, dir, dam, PROJECT_BEAM | PROJECT_KILL);
}
/*
* Cast a bolt spell, or rarely, a beam spell
*/
-bool_ fire_bolt_or_beam(int prob, int typ, int dir, int dam)
+void fire_bolt_or_beam(int prob, int typ, int dir, int dam)
{
if (rand_int(100) < prob)
{
- return (fire_beam(typ, dir, dam));
+ fire_beam(typ, dir, dam);
}
else
{
- return (fire_bolt(typ, dir, dam));
+ fire_bolt(typ, dir, dam);
}
}
@@ -4265,82 +4061,77 @@ bool_ fire_bolt_or_beam(int prob, int typ, int dir, int dam)
/*
* Some of the old functions
*/
-bool_ lite_line(int dir)
+void lite_line(int dir)
{
int flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
- return (project_hook(GF_LITE_WEAK, dir, damroll(6, 8), flg));
+ project_hook(GF_LITE_WEAK, dir, damroll(6, 8), flg);
}
-bool_ drain_life(int dir, int dam)
+bool drain_life(int dir, int dam)
{
int flg = PROJECT_STOP | PROJECT_KILL;
return (project_hook(GF_OLD_DRAIN, dir, dam, flg));
}
-bool_ wall_to_mud(int dir)
+void wall_to_mud(int dir)
{
- int flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
- return (project_hook(GF_KILL_WALL, dir, 20 + randint(30), flg));
+ project_hook(GF_KILL_WALL, dir, 20 + randint(30),
+ PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL);
}
-bool_ wizard_lock(int dir)
+void wizard_lock(int dir)
{
- int flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
- return (project_hook(GF_JAM_DOOR, dir, 20 + randint(30), flg));
+ project_hook(GF_JAM_DOOR, dir, 20 + randint(30),
+ PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL);
}
-bool_ slow_monster(int dir)
+void slow_monster(int dir)
{
- int flg = PROJECT_STOP | PROJECT_KILL;
- return (project_hook(GF_OLD_SLOW, dir, p_ptr->lev, flg));
+ project_hook(GF_OLD_SLOW, dir, p_ptr->lev, PROJECT_STOP | PROJECT_KILL);
}
-bool_ sleep_monster(int dir)
+void sleep_monster(int dir)
{
- int flg = PROJECT_STOP | PROJECT_KILL;
- return (project_hook(GF_OLD_SLEEP, dir, p_ptr->lev, flg));
+ project_hook(GF_OLD_SLEEP, dir, p_ptr->lev, PROJECT_STOP | PROJECT_KILL);
}
-bool_ confuse_monster(int dir, int plev)
+void confuse_monster(int dir, int plev)
{
- int flg = PROJECT_STOP | PROJECT_KILL;
- return (project_hook(GF_OLD_CONF, dir, plev, flg));
+ project_hook(GF_OLD_CONF, dir, plev, PROJECT_STOP | PROJECT_KILL);
}
-bool_ poly_monster(int dir)
+void poly_monster(int dir)
{
- int flg = PROJECT_STOP | PROJECT_KILL;
- return (project_hook(GF_OLD_POLY, dir, p_ptr->lev, flg));
+ project_hook(GF_OLD_POLY, dir, p_ptr->lev, PROJECT_STOP | PROJECT_KILL);
}
-bool_ fear_monster(int dir, int plev)
+void fear_monster(int dir, int plev)
{
- int flg = PROJECT_STOP | PROJECT_KILL;
- return (project_hook(GF_TURN_ALL, dir, plev, flg));
+ project_hook(GF_TURN_ALL, dir, plev, PROJECT_STOP | PROJECT_KILL);
}
-bool_ teleport_monster(int dir)
+void teleport_monster(int dir)
{
int flg = PROJECT_BEAM | PROJECT_KILL;
if (p_ptr->resist_continuum)
{
msg_print("The space-time continuum can't be disrupted.");
- return FALSE;
+ return;
}
- return (project_hook(GF_AWAY_ALL, dir, MAX_SIGHT * 5, flg));
+ project_hook(GF_AWAY_ALL, dir, MAX_SIGHT * 5, flg);
}
-bool_ wall_stone(int y, int x)
+void wall_stone(int y, int x)
{
auto const &f_info = game->edit_data.f_info;
@@ -4348,7 +4139,7 @@ bool_ wall_stone(int y, int x)
int flg = PROJECT_GRID | PROJECT_ITEM;
auto const featflags = f_info[c_ptr->feat].flags;
- bool_ dummy = (project(0, 1, y, x, 0, GF_STONE_WALL, flg));
+ project(0, 1, y, x, 0, GF_STONE_WALL, flg);
if (!(featflags & FF_PERMANENT) && !(featflags & FF_WALL))
cave_set_feat(y, x, FEAT_FLOOR);
@@ -4364,21 +4155,18 @@ bool_ wall_stone(int y, int x)
/* Window stuff */
p_ptr->window |= (PW_OVERHEAD);
-
- return dummy;
}
-bool_ destroy_doors_touch()
+void destroy_doors_touch()
{
- int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
- return (project(0, 1, p_ptr->py, p_ptr->px, 0, GF_KILL_DOOR, flg));
+ project(0, 1, p_ptr->py, p_ptr->px, 0, GF_KILL_DOOR,
+ PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE);
}
-bool_ sleep_monsters_touch()
+void sleep_monsters_touch()
{
- int flg = PROJECT_KILL | PROJECT_HIDE;
- return (project(0, 1, p_ptr->py, p_ptr->px, p_ptr->lev, GF_OLD_SLEEP, flg));
+ project(0, 1, p_ptr->py, p_ptr->px, p_ptr->lev, GF_OLD_SLEEP, PROJECT_KILL | PROJECT_HIDE);
}
@@ -4386,7 +4174,7 @@ void call_chaos()
{
int Chaos_type, dummy, dir;
int plev = p_ptr->lev;
- bool_ line_chaos = FALSE;
+ bool line_chaos = false;
int hurt_types[30] =
{
@@ -4401,7 +4189,7 @@ void call_chaos()
};
Chaos_type = hurt_types[randint(30) - 1];
- if (randint(4) == 1) line_chaos = TRUE;
+ if (randint(4) == 1) line_chaos = true;
if (randint(6) == 1)
{
@@ -4505,7 +4293,7 @@ static void activate_hi_summon()
void activate_ty_curse()
{
int i = 0;
- bool_ stop_ty = FALSE;
+ bool stop_ty = false;
do
{
@@ -4542,7 +4330,7 @@ case 13: case 14: case 15: case 19: case 20:
set_paralyzed(randint(3));
else
set_paralyzed(randint(13));
- stop_ty = TRUE;
+ stop_ty = true;
}
if (randint(6) != 1) break;
case 21: case 22: case 23:
@@ -4559,7 +4347,7 @@ case 21: case 22: case 23:
if ((dun_level > 65) && !stop_ty)
{
summon_cyber();
- stop_ty = TRUE;
+ stop_ty = true;
break;
}
default:
@@ -4584,7 +4372,7 @@ case 21: case 22: case 23:
void activate_dg_curse()
{
int i = 0;
- bool_ stop_dg = FALSE;
+ bool stop_dg = false;
do
{
@@ -4617,7 +4405,7 @@ void activate_dg_curse()
if (rand_int(2))
{
msg_print("You feel the coldness of the Black Breath attacking you!");
- p_ptr->black_breath = TRUE;
+ p_ptr->black_breath = true;
}
if (randint(8) != 1) break;
case 13:
@@ -4634,7 +4422,7 @@ void activate_dg_curse()
set_paralyzed(randint(3));
else
set_paralyzed(randint(13));
- stop_dg = TRUE;
+ stop_dg = true;
}
if (randint(7) != 1) break;
case 19:
@@ -4642,7 +4430,7 @@ void activate_dg_curse()
{
msg_print("Woah! You see 10 little Morgoths dancing before you!");
set_confused(p_ptr->confused + randint(13 * 2));
- if (rand_int(2)) stop_dg = TRUE;
+ if (rand_int(2)) stop_dg = true;
}
if (randint(7) != 1) break;
case 21:
@@ -4655,7 +4443,7 @@ void activate_dg_curse()
lose_all_info();
break;
case 27: case 28: case 29:
- if (p_ptr->inventory[INVEN_WIELD].k_idx)
+ if (p_ptr->inventory[INVEN_WIELD].k_ptr)
{
msg_print("Your weapon now seems useless...");
p_ptr->inventory[INVEN_WIELD].art_flags = TR_NEVER_BLOW;
@@ -4671,7 +4459,7 @@ case 27: case 28: case 29:
summon_dragon_riders();
/* This is evil -- DG */
- if (rand_int(2)) stop_dg = TRUE;
+ if (rand_int(2)) stop_dg = true;
break;
}
default:
@@ -4713,88 +4501,54 @@ static void summon_dragon_riders()
}
}
-
-
-/*
- * Confuse monsters
- */
-bool_ confuse_monsters(int dam)
+void confuse_monsters(int dam)
{
- return (project_hack(GF_OLD_CONF, dam));
+ project_hack(GF_OLD_CONF, dam);
}
-
-/*
- * Charm monsters
- */
-bool_ charm_monsters(int dam)
+void charm_monsters(int dam)
{
- return (project_hack(GF_CHARM, dam));
+ project_hack(GF_CHARM, dam);
}
-
-/*
- * Charm animals
- */
-bool_ charm_animals(int dam)
+void charm_animals(int dam)
{
- return (project_hack(GF_CONTROL_ANIMAL, dam));
+ project_hack(GF_CONTROL_ANIMAL, dam);
}
-
-/*
- * Stun monsters
- */
-bool_ stun_monsters(int dam)
+void stun_monsters(int dam)
{
- return (project_hack(GF_STUN, dam));
+ project_hack(GF_STUN, dam);
}
-
-/*
- * Mindblast monsters
- */
-bool_ mindblast_monsters(int dam)
+void mindblast_monsters(int dam)
{
- return (project_hack(GF_PSI, dam));
+ project_hack(GF_PSI, dam);
}
-
-/*
- * Banish all monsters
- */
-bool_ banish_monsters(int dist)
+void banish_monsters(int dist)
{
- return (project_hack(GF_AWAY_ALL, dist));
+ project_hack(GF_AWAY_ALL, dist);
}
-
-/*
- * Turn everyone
- */
-bool_ turn_monsters(int dam)
+void turn_monsters(int dam)
{
- return (project_hack(GF_TURN_ALL, dam));
+ project_hack(GF_TURN_ALL, dam);
}
-
-bool_ charm_monster(int dir, int plev)
+void charm_monster(int dir, int plev)
{
- int flg = PROJECT_STOP | PROJECT_KILL;
- return (project_hook(GF_CHARM, dir, plev, flg));
+ project_hook(GF_CHARM, dir, plev, PROJECT_STOP | PROJECT_KILL);
}
-bool_ control_one_undead(int dir, int plev)
+void control_one_undead(int dir, int plev)
{
- int flg = PROJECT_STOP | PROJECT_KILL;
- return (project_hook(GF_CONTROL_UNDEAD, dir, plev, flg));
+ project_hook(GF_CONTROL_UNDEAD, dir, plev, PROJECT_STOP | PROJECT_KILL);
}
-
-bool_ charm_animal(int dir, int plev)
+void charm_animal(int dir, int plev)
{
- int flg = PROJECT_STOP | PROJECT_KILL;
- return (project_hook(GF_CONTROL_ANIMAL, dir, plev, flg));
+ project_hook(GF_CONTROL_ANIMAL, dir, plev, PROJECT_STOP | PROJECT_KILL);
}
void change_wild_mode()
@@ -4815,7 +4569,7 @@ void change_wild_mode()
autosave_checkpoint();
/* Leaving */
- p_ptr->leaving = TRUE;
+ p_ptr->leaving = true;
}
@@ -4826,11 +4580,10 @@ void alter_reality()
autosave_checkpoint();
/* Leaving */
- p_ptr->leaving = TRUE;
+ p_ptr->leaving = true;
}
-/* Heal insanity. */
-bool_ heal_insanity(int val)
+void heal_insanity(int val)
{
if (p_ptr->csane < p_ptr->msane)
{
@@ -4861,20 +4614,17 @@ bool_ heal_insanity(int val)
{
msg_print("You feel very good.");
}
-
- return TRUE;
}
-
- return FALSE;
}
/*
* Send the player shooting through walls in the given direction until
* they reach a non-wall space, or a monster, or a permanent wall.
*/
-bool_ passwall(int dir, bool_ safe)
+bool passwall(int dir, bool safe)
{
auto const &f_info = game->edit_data.f_info;
+ auto const &dungeon_flags = game->dungeon_flags;
int x = p_ptr->px;
int y = p_ptr->py;
@@ -4883,16 +4633,16 @@ bool_ passwall(int dir, bool_ safe)
int lx = p_ptr->px;
int ly = p_ptr->py;
cave_type *c_ptr;
- bool_ ok = FALSE;
+ bool ok = false;
- if (p_ptr->wild_mode) return FALSE;
- if (p_ptr->inside_quest) return FALSE;
- if (dungeon_flags & DF_NO_TELEPORT) return FALSE;
+ if (p_ptr->wild_mode) return false;
+ if (p_ptr->inside_quest) return false;
+ if (dungeon_flags & DF_NO_TELEPORT) return false;
/* Must go somewhere */
- if (dir == 5) return FALSE;
+ if (dir == 5) return false;
- while (TRUE)
+ while (true)
{
x += ddx[dir];
y += ddy[dir];
@@ -4904,7 +4654,7 @@ bool_ passwall(int dir, bool_ safe)
/* get the last working position */
x -= ddx[dir];
y -= ddy[dir];
- ok = FALSE;
+ ok = false;
break;
}
@@ -4922,7 +4672,7 @@ bool_ passwall(int dir, bool_ safe)
if (f_info[c_ptr->feat].flags & FF_WALL) continue;
/* So it must be ok */
- ok = TRUE;
+ ok = true;
break;
}
@@ -4964,7 +4714,7 @@ bool_ passwall(int dir, bool_ safe)
/* Handle stuff XXX XXX XXX */
handle_stuff();
- return (TRUE);
+ return true;
}
/*
@@ -4972,7 +4722,7 @@ bool_ passwall(int dir, bool_ safe)
*/
static void print_dungeon_batch(std::vector<int> const &dungeon_idxs,
int start,
- bool_ mode)
+ bool mode)
{
auto const &d_info = game->edit_data.d_info;
@@ -5029,7 +4779,7 @@ static int reset_recall_aux()
char which;
int start = 0;
int ret;
- bool_ mode = FALSE;
+ bool mode = false;
// Dungeons available for recall
std::vector<int> dungeons;
@@ -5044,10 +4794,9 @@ static int reset_recall_aux()
}
}
- character_icky = TRUE;
- Term_save();
+ screen_save_no_flush();
- while (1)
+ while (true)
{
print_dungeon_batch(dungeons, start, mode);
which = inkey();
@@ -5060,9 +4809,8 @@ static int reset_recall_aux()
else if (which == '*' || which == '?' || which == ' ')
{
- mode = (mode) ? FALSE : TRUE;
- Term_load();
- character_icky = FALSE;
+ mode = (mode) ? false : true;
+ screen_load_no_flush();
}
else if (which == '+')
@@ -5073,8 +4821,7 @@ static int reset_recall_aux()
{
start -= 20;
}
- Term_load();
- character_icky = FALSE;
+ screen_load_no_flush();
}
else if (which == '-')
@@ -5084,8 +4831,7 @@ static int reset_recall_aux()
{
start += 20;
}
- Term_load();
- character_icky = FALSE;
+ screen_load_no_flush();
}
else if (which == '@')
@@ -5143,13 +4889,12 @@ static int reset_recall_aux()
}
}
- Term_load();
- character_icky = FALSE;
+ screen_load_no_flush();
return ret;
}
-bool_ reset_recall(bool_ no_trepas_max_depth)
+bool reset_recall(bool no_trepas_max_depth)
{
auto const &d_info = game->edit_data.d_info;
@@ -5158,7 +4903,7 @@ bool_ reset_recall(bool_ no_trepas_max_depth)
/* Choose dungeon */
dun = reset_recall_aux();
- if (dun < 1) return FALSE;
+ if (dun < 1) return false;
/* Choose depth */
if (!no_trepas_max_depth)
@@ -5171,7 +4916,7 @@ bool_ reset_recall(bool_ no_trepas_max_depth)
d_info[dun].mindepth, max),
max);
- if (depth < 1) return FALSE;
+ if (depth < 1) return false;
/* Enforce minimum level */
if (depth < d_info[dun].mindepth) depth = d_info[dun].mindepth;
@@ -5182,7 +4927,7 @@ bool_ reset_recall(bool_ no_trepas_max_depth)
p_ptr->recall_dungeon = dun;
max_dlv[p_ptr->recall_dungeon] = depth;
- return TRUE;
+ return true;
}
/*
@@ -5191,6 +4936,7 @@ bool_ reset_recall(bool_ no_trepas_max_depth)
void create_between_gate(int dist, int y, int x)
{
auto const &f_info = game->edit_data.f_info;
+ auto const &dungeon_flags = game->dungeon_flags;
int ii, ij, plev = get_skill(SKILL_CONVEYANCE);
@@ -5325,7 +5071,7 @@ void geomancy_random_wall(int y, int x)
#undef TABLE_SIZE
}
-void geomancy_random_floor(int y, int x, bool_ kill_wall)
+void geomancy_random_floor(int y, int x, bool kill_wall)
{
auto const &f_info = game->edit_data.f_info;
@@ -5364,7 +5110,7 @@ void geomancy_random_floor(int y, int x, bool_ kill_wall)
#undef TABLE_SIZE
}
-static bool_ geomancy_can_tunnel(int y, int x)
+static bool geomancy_can_tunnel(int y, int x)
{
switch (cave[y][x].feat)
{
@@ -5384,9 +5130,9 @@ static bool_ geomancy_can_tunnel(int y, int x)
case FEAT_SANDWALL_H:
case FEAT_SANDWALL_K:
case FEAT_ICE_WALL:
- return TRUE;
+ return true;
default:
- return FALSE;
+ return false;
}
}
@@ -5425,7 +5171,7 @@ void geomancy_dig(int oy, int ox, int dir, int length)
x = x - dx;
while ((y != oy) || (x != ox))
{
- geomancy_random_floor(y, x, TRUE);
+ geomancy_random_floor(y, x, true);
/* Should we branch ? */
if (magik(20))