diff options
author | Bardur Arantsson <bardur@scientician.net> | 2018-03-25 20:07:31 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2018-03-25 20:07:31 +0200 |
commit | b2e4e8a78cc85a6af67e4af4557b4699f3889874 (patch) | |
tree | 2c5e7d139ac849aaf9d2139e1c96976dcdbd6f05 | |
parent | a140cb693bf84a33bd1751a19ba76b45ed7dea73 (diff) |
Eliminate uses of bool_
39 files changed, 350 insertions, 327 deletions
diff --git a/src/cave.cc b/src/cave.cc index 7e9f98e2..f5395e33 100644 --- a/src/cave.cc +++ b/src/cave.cc @@ -1701,8 +1701,8 @@ void display_map(int *cy, int *cx) auto const old_view_granite_lite = options->view_granite_lite; /* Disable lighting effects */ - options->view_special_lite = FALSE; - options->view_granite_lite = FALSE; + options->view_special_lite = false; + options->view_granite_lite = false; /* Set up initial maps */ diff --git a/src/cmd2.cc b/src/cmd2.cc index 0dab2cb6..8af4c9c3 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" diff --git a/src/cmd2.hpp b/src/cmd2.hpp index 9641dc72..c7fe38c2 100644 --- a/src/cmd2.hpp +++ b/src/cmd2.hpp @@ -27,6 +27,5 @@ void do_cmd_fire(); void do_cmd_throw(); void do_cmd_boomerang(); void do_cmd_immovable_special(); -void fetch(int dir, int wgt, bool_ require_los); void do_cmd_sacrifice(); void do_cmd_steal(); diff --git a/src/cmd3.cc b/src/cmd3.cc index 1215b4ce..c8237a27 100644 --- a/src/cmd3.cc +++ b/src/cmd3.cc @@ -1560,7 +1560,7 @@ void do_cmd_query_symbol() /* * Try to "sense" the grid's mana */ -bool_ do_cmd_sense_grid_mana() +void do_cmd_sense_grid_mana() { int chance, i; @@ -1588,7 +1588,7 @@ bool_ do_cmd_sense_grid_mana() { flush_on_failure(); msg_print("You failed to sense the grid's mana."); - return FALSE; + return; } /* Try to give an "average" value */ @@ -1604,7 +1604,6 @@ bool_ do_cmd_sense_grid_mana() { msg_format("Average Area's mana: %d", (cave[p_ptr->py][p_ptr->px].mana / i) * i); } - return TRUE; } diff --git a/src/cmd3.hpp b/src/cmd3.hpp index 90044671..d52837c1 100644 --- a/src/cmd3.hpp +++ b/src/cmd3.hpp @@ -20,4 +20,4 @@ void do_cmd_target(); void do_cmd_look(); void do_cmd_locate(); void do_cmd_query_symbol(); -bool_ do_cmd_sense_grid_mana(); +void do_cmd_sense_grid_mana(); diff --git a/src/cmd5.cc b/src/cmd5.cc index 657b7f48..c4238ac5 100644 --- a/src/cmd5.cc +++ b/src/cmd5.cc @@ -91,29 +91,32 @@ static object_filter_t const &item_tester_hook_browsable() /* * Are we using a mage staff */ -bool_ is_magestaff() +bool is_magestaff() { - int i; - - - i = 0; + int i = 0; while (p_ptr->body_parts[i] == INVEN_WIELD) { object_type *o_ptr = &p_ptr->inventory[INVEN_WIELD + i]; /* Wielding a mage staff */ - if ((o_ptr->k_ptr) && (o_ptr->tval == TV_MSTAFF)) return (TRUE); + if ((o_ptr->k_ptr) && (o_ptr->tval == TV_MSTAFF)) + { + return true; + } /* Next slot */ i++; /* Paranoia */ - if (i >= (INVEN_TOTAL - INVEN_WIELD)) break; + if (i >= (INVEN_TOTAL - INVEN_WIELD)) + { + break; + } } /* Not wielding a mage staff */ - return (FALSE); + return false; } @@ -131,11 +134,9 @@ static int print_book(s16b sval, s32b spell_idx, object_type *obj) for (auto spell_idx : school_book->spell_idxs) { byte color = TERM_L_DARK; - bool_ is_ok; char label[8]; - is_ok = is_ok_spell(spell_idx, obj->pval); - if (is_ok) + if (is_ok_spell(spell_idx, obj->pval)) { color = (get_mana(spell_idx) > get_power(spell_idx)) ? TERM_ORANGE : TERM_L_GREEN; } @@ -450,7 +451,7 @@ void do_poly_self() /* * Fetch an item (teleport it right underneath the caster) */ -void fetch(int dir, int wgt, bool_ require_los) +void fetch(int dir, int wgt, bool require_los) { /* Check to see if an object is already there */ if (!cave[p_ptr->py][p_ptr->px].o_idxs.empty()) @@ -1867,26 +1868,26 @@ boost::optional<int> get_item_hook_find_spell(object_filter_t const &) /* * Is the spell castable? */ -bool_ is_ok_spell(s32b spell_idx, s32b pval) +bool is_ok_spell(s32b spell_idx, s32b pval) { spell_type *spell = spell_at(spell_idx); // Calculate availability based on caster's skill level. s32b level; - bool_ na; + bool na; get_level_school(spell, 50, 0, &level, &na); if (na || (level == 0)) { - return FALSE; + return false; } // Are we permitted to cast based on item pval? Only music // spells have non-zero minimum PVAL. if (pval < spell_type_minimum_pval(spell)) { - return FALSE; + return false; } // OK, we're permitted to cast it. - return TRUE; + return true; } @@ -2032,16 +2033,11 @@ s32b get_school_spell(const char *do_what, s16b force_book) } else { - bool_ ok; - /* Save the spell index */ spell = spell_x(sval, pval, i); - /* Do we need to do some pre test */ - ok = is_ok_spell(spell, o_ptr->pval); - /* Require "okay" spells */ - if (!ok) + if (!is_ok_spell(spell, o_ptr->pval)) { bell(); msg_format("You may not %s that spell.", do_what); @@ -2056,11 +2052,8 @@ s32b get_school_spell(const char *do_what, s16b force_book) } else { - bool_ ok; - /* Require "okay" spells */ - ok = is_ok_spell(hack_force_spell, hack_force_spell_pval); - if (ok) + if (is_ok_spell(hack_force_spell, hack_force_spell_pval)) { flag = TRUE; spell = hack_force_spell; diff --git a/src/cmd5.hpp b/src/cmd5.hpp index f70c7932..527b0411 100644 --- a/src/cmd5.hpp +++ b/src/cmd5.hpp @@ -8,15 +8,15 @@ #include <string> #include <vector> -bool_ is_magestaff(); +bool is_magestaff(); void do_cmd_browse_aux(object_type *o_ptr); void do_cmd_browse(); -void fetch(int dir, int wgt, bool_ require_los); +void fetch(int dir, int wgt, bool require_los); void do_poly_self(); std::string symbiote_name(bool capitalize); int use_symbiotic_power(int r_idx, bool great); void use_monster_power(int r_idx, bool great); -bool_ is_ok_spell(s32b spell_idx, s32b pval); +bool is_ok_spell(s32b spell_idx, s32b pval); s32b get_school_spell(const char *do_what, s16b force_book); void do_cmd_copy_spell(); void cast_school_spell(); diff --git a/src/cmd7.cc b/src/cmd7.cc index bc9cdbff..bc08c571 100644 --- a/src/cmd7.cc +++ b/src/cmd7.cc @@ -221,7 +221,7 @@ static void display_magic_powers( * when you run it. It's probably easy to fix but I haven't tried, * sorry. */ -static bool_ get_magic_power(int *sn, magic_power *powers, int max_powers, +static bool get_magic_power(int *sn, magic_power *powers, int max_powers, void (*power_info)(char *p, int power), int plev, int cast_stat) { int i; @@ -255,7 +255,7 @@ static bool_ get_magic_power(int *sn, magic_power *powers, int max_powers, if (powers[*sn].min_lev <= plev) { /* Success */ - return (TRUE); + return true; } } @@ -328,7 +328,10 @@ static bool_ get_magic_power(int *sn, magic_power *powers, int max_powers, character_icky = FALSE; /* Abort if needed */ - if (!flag) return (FALSE); + if (!flag) + { + return false; + } /* Save the choice */ (*sn) = i; @@ -337,7 +340,7 @@ static bool_ get_magic_power(int *sn, magic_power *powers, int max_powers, repeat_push(*sn); /* Success */ - return (TRUE); + return true; } diff --git a/src/dungeon.cc b/src/dungeon.cc index d341eb94..d126c94f 100644 --- a/src/dungeon.cc +++ b/src/dungeon.cc @@ -1488,7 +1488,7 @@ static void process_world() /* Dead player */ if (p_ptr->chp < 0) { - bool_ old_quick = options->quick_messages; + bool old_quick = options->quick_messages; /* Hack -- Note death */ if (!options->last_words) @@ -1520,7 +1520,7 @@ static void process_world() /* Note death */ death = TRUE; - options->quick_messages = FALSE; + options->quick_messages = false; if (get_check("Make a last screenshot? ")) { do_cmd_html_dump(); @@ -2788,7 +2788,7 @@ static void process_world() /* * Verify use of "wizard" mode */ -static bool_ enter_wizard_mode() +static bool enter_wizard_mode() { /* Ask first time, but not while loading a dead char with the -w option */ if (!noscore && !(p_ptr->chp < 0)) @@ -2801,7 +2801,7 @@ static bool_ enter_wizard_mode() /* Verify request */ if (!get_check("Are you sure you want to enter wizard mode? ")) { - return (FALSE); + return false; } /* Mark savefile */ @@ -2809,14 +2809,14 @@ static bool_ enter_wizard_mode() } /* Success */ - return (TRUE); + return true; } /* * Verify use of "debug" commands */ -static bool_ enter_debug_mode() +static bool enter_debug_mode() { /* Ask first time */ if (!noscore && !wizard) @@ -2829,7 +2829,7 @@ static bool_ enter_debug_mode() /* Verify request */ if (!get_check("Are you sure you want to use debug commands? ")) { - return (FALSE); + return false; } /* Mark savefile */ @@ -2837,7 +2837,7 @@ static bool_ enter_debug_mode() } /* Success */ - return (TRUE); + return true; } @@ -4529,7 +4529,10 @@ static void dungeon() /* Make it pulsate and live !!!! */ if ((dungeon_flags & DF_EVOLVE) && dun_level) { - if (!(turn % 10)) evolve_level(TRUE); + if (!(turn % 10)) + { + evolve_level(true); + } } /* Notice stuff */ @@ -4770,8 +4773,8 @@ void play_game() load_all_pref_files(); /* Set or clear "rogue_like_commands" if requested */ - if (arg_force_original) options->rogue_like_commands = FALSE; - if (arg_force_roguelike) options->rogue_like_commands = TRUE; + if (arg_force_original) options->rogue_like_commands = false; + if (arg_force_roguelike) options->rogue_like_commands = true; /* Initialize vault info */ if (init_v_info()) quit("Cannot initialize vaults"); diff --git a/src/ego_item_type.hpp b/src/ego_item_type.hpp index 9d09d18a..65c9465b 100644 --- a/src/ego_item_type.hpp +++ b/src/ego_item_type.hpp @@ -20,7 +20,7 @@ struct ego_item_type { std::string name; /* Name */ - bool_ before = FALSE; /* Before or after the object name ? */ + bool before = false; /* Before or after the object name ? */ byte tval[10] = { 0 }; byte min_sval[10] = { 0 }; diff --git a/src/gen_evol.cc b/src/gen_evol.cc index 7dca5b9a..0b56c03d 100644 --- a/src/gen_evol.cc +++ b/src/gen_evol.cc @@ -22,7 +22,7 @@ /* * Generate a game of life level :) and make it evolve */ -void evolve_level(bool_ noise) +void evolve_level(bool noise) { auto const &f_info = game->edit_data.f_info; @@ -152,9 +152,9 @@ bool_ level_generate_life() } } - evolve_level(FALSE); - evolve_level(FALSE); - evolve_level(FALSE); + evolve_level(false); + evolve_level(false); + evolve_level(false); /* Determine the character location */ if (!new_player_spot(get_branch())) diff --git a/src/gen_evol.hpp b/src/gen_evol.hpp index 6e5087c8..e3ceec98 100644 --- a/src/gen_evol.hpp +++ b/src/gen_evol.hpp @@ -3,4 +3,4 @@ #include "h-basic.h" bool_ level_generate_life(); -void evolve_level(bool_ noise); +void evolve_level(bool noise); diff --git a/src/help.cc b/src/help.cc index b59a6fcf..6befe3c7 100644 --- a/src/help.cc +++ b/src/help.cc @@ -46,7 +46,7 @@ /** * Game started? */ -static bool_ game_started = FALSE; +static bool game_started = false; /** * Struct for help triggered by a boolean condition @@ -59,7 +59,7 @@ struct triggered_help_type /* Hook type */ int hook_type; /* Trigger function */ - bool_ (*trigger_func)(void *in, void *out); + bool (*trigger_func)(void *in, void *out); /* Description; NULL terminated */ const char *desc[DESC_MAX]; }; @@ -304,88 +304,88 @@ context_help_type ability_table[] = /** * Trigger functions */ -static bool_ trigger_void_jumpgate(void *in, void *out) { +static bool trigger_void_jumpgate(void *in, void *out) { hook_move_in *p = (hook_move_in *) in; return cave[p->y][p->x].feat == FEAT_BETWEEN; } -static bool_ trigger_fountain(void *in, void *out) { +static bool trigger_fountain(void *in, void *out) { hook_move_in *p = (hook_move_in *) in; return cave[p->y][p->x].feat == FEAT_FOUNTAIN; } -static bool_ trigger_found_object(void *in, void *out) { +static bool trigger_found_object(void *in, void *out) { hook_move_in *p = (hook_move_in *) in; return !cave[p->y][p->x].o_idxs.empty(); } -static bool_ trigger_found_altar(void *in, void *out) { +static bool trigger_found_altar(void *in, void *out) { hook_move_in *p = (hook_move_in *) in; return ((cave[p->y][p->x].feat >= FEAT_ALTAR_HEAD) && (cave[p->y][p->x].feat <= FEAT_ALTAR_TAIL)); } -static bool_ trigger_found_stairs(void *in, void *out) { +static bool trigger_found_stairs(void *in, void *out) { hook_move_in *p = (hook_move_in *) in; return (cave[p->y][p->x].feat == FEAT_MORE); } -static bool_ trigger_get_rod(void *in, void *out) { +static bool trigger_get_rod(void *in, void *out) { hook_get_in *g = (hook_get_in *) in; return (g->o_ptr->tval == TV_ROD_MAIN); } -static bool_ trigger_get_rod_tip(void *in, void *out) { +static bool trigger_get_rod_tip(void *in, void *out) { hook_get_in *g = (hook_get_in *) in; return (g->o_ptr->tval == TV_ROD); } -static bool_ trigger_get_magic_device(void *in, void *out) { +static bool trigger_get_magic_device(void *in, void *out) { hook_get_in *g = (hook_get_in *) in; return ((g->o_ptr->tval == TV_WAND) || (g->o_ptr->tval == TV_STAFF)); } -static bool_ trigger_end_turn_wilderness(void *in, void *out) { +static bool trigger_end_turn_wilderness(void *in, void *out) { return (((p_ptr->wilderness_x != 34) || (p_ptr->wilderness_y != 21)) && (!p_ptr->astral)); } -static bool_ trigger_game_theme(void *in, void *out) { +static bool trigger_game_theme(void *in, void *out) { return (game_module_idx == MODULE_THEME); } -static bool_ trigger_game_tome(void *in, void *out) { +static bool trigger_game_tome(void *in, void *out) { return (game_module_idx == MODULE_TOME); } -static bool_ trigger_1st_level(void *in, void *out) { +static bool trigger_1st_level(void *in, void *out) { return (p_ptr->lev > 1); } -static bool_ trigger_20th_level(void *in, void *out) { +static bool trigger_20th_level(void *in, void *out) { return (p_ptr->lev >= 20); } -static bool_ trigger_identify_spell_item(void *in_, void *out) { +static bool trigger_identify_spell_item(void *in_, void *out) { hook_identify_in *in = (hook_identify_in *) in_; auto const f = object_flags(in->o_ptr); if (f & TR_SPELL_CONTAIN) { - return TRUE; + return true; } - return FALSE; + return false; } -static bool_ trigger_melee_skills(void *in, void *out) { +static bool trigger_melee_skills(void *in, void *out) { return (game_started && (get_melee_skills() > 1)); } -static bool_ trigger_always(void *in, void *out) { - return TRUE; +static bool trigger_always(void *in, void *out) { + return true; } /** @@ -579,7 +579,7 @@ static bool triggered_help_hook(void *data, void *in, void *out) static bool hook_game_start(void *data, void *in, void *out) { - game_started = TRUE; + game_started = true; return false; } diff --git a/src/init1.cc b/src/init1.cc index 29135c7a..58d74d41 100644 --- a/src/init1.cc +++ b/src/init1.cc @@ -3563,7 +3563,7 @@ errr init_e_info_txt(FILE *fp) /* Save the values */ /* e_ptr->slot = slot; */ e_ptr->rating = rating; - e_ptr->before = (pos == 'B') ? TRUE : FALSE; + e_ptr->before = (pos == 'B'); /* Next... */ continue; diff --git a/src/levels.cc b/src/levels.cc index 2a1bb3ab..cb189c4a 100644 --- a/src/levels.cc +++ b/src/levels.cc @@ -134,7 +134,7 @@ int get_flevel() /* * Return the extension of the savefile for the level */ -bool_ get_dungeon_save(char *buf) +bool get_dungeon_save(char *buf) { auto const &d_info = game->edit_data.d_info; @@ -144,14 +144,13 @@ bool_ get_dungeon_save(char *buf) /* Get and return the level */ start_line = -1; - if (get_command(file, 'S', buf)) return (TRUE); - else return FALSE; + return get_command(file, 'S', buf); } /* * Return the level generator */ -bool_ get_dungeon_generator(char *buf) +bool get_dungeon_generator(char *buf) { auto const &d_info = game->edit_data.d_info; @@ -160,14 +159,13 @@ bool_ get_dungeon_generator(char *buf) /* Get and return the level */ start_line = -1; - if (get_command(file, 'G', buf)) return (TRUE); - else return FALSE; + return get_command(file, 'G', buf); } /* * Return the special level */ -bool_ get_dungeon_special(char *buf) +bool get_dungeon_special(char *buf) { auto const &d_info = game->edit_data.d_info; @@ -176,14 +174,13 @@ bool_ get_dungeon_special(char *buf) /* Get and return the level */ start_line = -1; - if (get_command(file, 'U', buf)) return (TRUE); - else return FALSE; + return get_command(file, 'U', buf); } /* * Return the special level name */ -bool_ get_dungeon_name(char *buf) +bool get_dungeon_name(char *buf) { auto const &d_info = game->edit_data.d_info; @@ -238,7 +235,7 @@ void get_level_flags() /* * Return the special level desc */ -bool_ get_level_desc(char *buf) +bool get_level_desc(char *buf) { auto const &d_info = game->edit_data.d_info; @@ -247,6 +244,5 @@ bool_ get_level_desc(char *buf) /* Get and return the level */ start_line = -1; - if (get_command(file, 'D', buf)) return (TRUE); - else return FALSE; + return get_command(file, 'D', buf); } diff --git a/src/levels.hpp b/src/levels.hpp index a48f1d95..da0a6d17 100644 --- a/src/levels.hpp +++ b/src/levels.hpp @@ -2,12 +2,12 @@ #include "h-basic.h" -bool_ get_dungeon_generator(char *buf); -bool_ get_level_desc(char *buf); +bool get_dungeon_generator(char *buf); +bool get_level_desc(char *buf); void get_level_flags(); -bool_ get_dungeon_name(char *buf); -bool_ get_dungeon_special(char *buf); +bool get_dungeon_name(char *buf); +bool get_dungeon_special(char *buf); int get_branch(); int get_fbranch(); int get_flevel(); -bool_ get_dungeon_save(char *buf); +bool get_dungeon_save(char *buf); diff --git a/src/loadsave.cc b/src/loadsave.cc index b2bfb55d..f5300ba5 100644 --- a/src/loadsave.cc +++ b/src/loadsave.cc @@ -80,7 +80,7 @@ namespace { struct option_value { std::string name; - bool_ value; + bool value; }; } // namespace (anonymous) @@ -281,7 +281,7 @@ static void do_std_string(std::string &s, ls_flag_t flag) static void do_option_value(option_value *option_value, ls_flag_t flag) { do_std_string(option_value->name, flag); - do_bool(&option_value->value, flag); + do_std_bool(&option_value->value, flag); } @@ -1698,15 +1698,15 @@ static void do_options(ls_flag_t flag) /*** Cheating options ***/ do_bool(&wizard, flag); - do_bool(&options->cheat_peek, flag); - do_bool(&options->cheat_hear, flag); - do_bool(&options->cheat_room, flag); - do_bool(&options->cheat_xtra, flag); - do_bool(&options->cheat_live, flag); + do_std_bool(&options->cheat_peek, flag); + do_std_bool(&options->cheat_hear, flag); + do_std_bool(&options->cheat_room, flag); + do_std_bool(&options->cheat_xtra, flag); + do_std_bool(&options->cheat_live, flag); /*** Autosave options */ - do_bool(&options->autosave_l, flag); - do_bool(&options->autosave_t, flag); + do_std_bool(&options->autosave_l, flag); + do_std_bool(&options->autosave_t, flag); do_s16b(&options->autosave_freq, flag); // Standard options @@ -1829,7 +1829,7 @@ static void do_options(ls_flag_t flag) * Handle player inventory. Note that the inventory is * "re-sorted" later by "dungeon()". */ -static bool_ do_inventory(ls_flag_t flag) +static bool do_inventory(ls_flag_t flag) { auto const &a_info = game->edit_data.a_info; @@ -1865,7 +1865,7 @@ static bool_ do_inventory(ls_flag_t flag) do_item(q_ptr, ls_flag_t::LOAD); /* Hack -- verify item */ - if (!q_ptr->k_ptr) return (FALSE); + if (!q_ptr->k_ptr) return false; /* Wield equipment */ if (n >= INVEN_WIELD) @@ -1890,7 +1890,7 @@ static bool_ do_inventory(ls_flag_t flag) note("Too many items in the inventory!"); /* Fail */ - return (FALSE); + return false; } /* Carry inventory */ @@ -1921,7 +1921,7 @@ static bool_ do_inventory(ls_flag_t flag) do_u16b(&sent, ls_flag_t::SAVE); } /* Success */ - return (TRUE); + return true; } diff --git a/src/lua_bind.cc b/src/lua_bind.cc index cc7476d3..e4db2afe 100644 --- a/src/lua_bind.cc +++ b/src/lua_bind.cc @@ -99,7 +99,7 @@ static s32b get_level_school_1(spell_type *spell, s32b max, s32b min) { // Delegate s32b level; - bool_ na; + bool na; get_level_school(spell, max, min, &level, &na); // Note: It is tempting to add an assertion here for "na == FALSE" here, // but there are cases where we haven't actually checked if the spell is diff --git a/src/lua_bind.hpp b/src/lua_bind.hpp index 39fc2159..08b26175 100644 --- a/src/lua_bind.hpp +++ b/src/lua_bind.hpp @@ -16,7 +16,7 @@ int get_mana(s32b s); s32b get_power(s32b s); s32b get_level(s32b s, s32b max); s32b get_level_s(int sp, int max); -void get_level_school(struct spell_type *spell, s32b max, s32b min, s32b *level, bool_ *na); +void get_level_school(struct spell_type *spell, s32b max, s32b min, s32b *level, bool *na); extern s32b get_level_max_stick; extern s32b get_level_use_stick; diff --git a/src/magic_power.hpp b/src/magic_power.hpp index 4a7d37ad..bf61f012 100644 --- a/src/magic_power.hpp +++ b/src/magic_power.hpp @@ -1,7 +1,5 @@ #pragma once -#include "h-basic.h" - /** * Powers, used by Mindcrafters and Necromancers */ diff --git a/src/melee2.cc b/src/melee2.cc index 891b643d..533f5720 100644 --- a/src/melee2.cc +++ b/src/melee2.cc @@ -6169,7 +6169,8 @@ static void process_monster(int m_idx, bool_ is_frien) if ((o_ptr->tval == TV_CORPSE) && (r_ptr->flags & RF_POSSESSOR) && ((o_ptr->sval == SV_CORPSE_CORPSE) || (o_ptr->sval == SV_CORPSE_SKELETON))) { - if (ai_possessor(m_idx, this_o_idx)) return; + ai_possessor(m_idx, this_o_idx); + return; } /* Take or Kill objects on the floor */ diff --git a/src/monster3.cc b/src/monster3.cc index 6dd1f74e..c27b597b 100644 --- a/src/monster3.cc +++ b/src/monster3.cc @@ -59,27 +59,40 @@ int is_friend(monster_type *m_ptr) } /* Should they attack each others */ -bool_ is_enemy(monster_type *m_ptr, monster_type *t_ptr) +bool is_enemy(monster_type *m_ptr, monster_type *t_ptr) { auto const &r_info = game->edit_data.r_info; auto r_ptr = &r_info[m_ptr->r_idx]; auto rt_ptr = &r_info[t_ptr->r_idx]; - int s1 = is_friend(m_ptr), s2 = is_friend(t_ptr); - /* Monsters hates breeders */ - if ((m_ptr->status != MSTATUS_NEUTRAL) && (rt_ptr->spells & SF_MULTIPLY) && (num_repro > MAX_REPRO * 2 / 3) && (r_ptr->d_char != rt_ptr->d_char)) return TRUE; - if ((t_ptr->status != MSTATUS_NEUTRAL) && (r_ptr->spells & SF_MULTIPLY) && (num_repro > MAX_REPRO * 2 / 3) && (r_ptr->d_char != rt_ptr->d_char)) return TRUE; + if ((m_ptr->status != MSTATUS_NEUTRAL) && + (rt_ptr->spells & SF_MULTIPLY) && + (num_repro > MAX_REPRO * 2 / 3) && + (r_ptr->d_char != rt_ptr->d_char)) { + return true; + } + if ((t_ptr->status != MSTATUS_NEUTRAL) && + (r_ptr->spells & SF_MULTIPLY) && + (num_repro > MAX_REPRO * 2 / 3) && + (r_ptr->d_char != rt_ptr->d_char)) { + return true; + } - /* No special conditions, lets test normal flags */ - if (s1 && s2 && (s1 == -s2)) return TRUE; + /* No special conditions, test normal flags */ + int const s1 = is_friend(m_ptr); + int const s2 = is_friend(t_ptr); + if (s1 && s2 && (s1 == -s2)) + { + return true; + } - /* Not ennemy */ - return (FALSE); + /* Not enemy */ + return false; } -bool_ change_side(monster_type *m_ptr) +bool change_side(monster_type *m_ptr) { auto const r_ptr = m_ptr->race(); @@ -103,15 +116,14 @@ bool_ change_side(monster_type *m_ptr) inc_piety(GOD_YAVANNA, -m_ptr->level * 4); break; case MSTATUS_COMPANION: - return FALSE; - break; + return false; } /* changed */ - return TRUE; + return true; } /* Multiply !! */ -bool_ ai_multiply(int m_idx) +bool ai_multiply(int m_idx) { monster_type *m_ptr = &m_list[m_idx]; int k, y, x, oy = m_ptr->fy, ox = m_ptr->fx; @@ -142,14 +154,15 @@ bool_ ai_multiply(int m_idx) if (multiply_monster(m_idx, (is_frien), FALSE)) { /* Multiplying takes energy */ - return TRUE; + return true; } } - return FALSE; + + return false; } /* Possessor incarnates */ -bool_ ai_possessor(int m_idx, int o_idx) +void ai_possessor(int m_idx, int o_idx) { auto &r_info = game->edit_data.r_info; @@ -163,7 +176,10 @@ bool_ ai_possessor(int m_idx, int o_idx) monster_desc(m_name, m_ptr, 0x00); monster_race_desc(m_name2, r2_idx, 0); - if (m_ptr->ml) msg_format("%^s incarnates into a %s!", m_name, m_name2); + if (m_ptr->ml) + { + msg_format("%^s incarnates into a %s!", m_name, m_name2); + } /* Remove the old one */ delete_object_idx(o_idx); @@ -227,8 +243,6 @@ bool_ ai_possessor(int m_idx, int o_idx) /* Update the monster */ update_mon(m_idx, TRUE); - - return TRUE; } void ai_deincarnate(int m_idx) @@ -307,28 +321,33 @@ void ai_deincarnate(int m_idx) } /* Returns if a new companion is allowed */ -bool_ can_create_companion() +bool can_create_companion() { - int i, mcnt = 0; + int mcnt = 0; - for (i = m_max - 1; i >= 1; i--) + for (int i = m_max - 1; i >= 1; i--) { /* Access the monster */ monster_type *m_ptr = &m_list[i]; /* Ignore "dead" monsters */ - if (!m_ptr->r_idx) continue; + if (!m_ptr->r_idx) + { + continue; + } - if (m_ptr->status == MSTATUS_COMPANION) mcnt++; + if (m_ptr->status == MSTATUS_COMPANION) + { + mcnt++; + } } - if (mcnt < (1 + get_skill_scale(SKILL_LORE, 6))) return (TRUE); - else return (FALSE); + return mcnt < (1 + get_skill_scale(SKILL_LORE, 6)); } /* Player controlled monsters */ -bool_ do_control_walk() +bool do_control_walk() { /* Get a "repeated" direction */ if (p_ptr->control) @@ -343,26 +362,37 @@ bool_ do_control_walk() /* Actually move the monster */ p_ptr->control_dir = dir; } - return TRUE; + + return true; } else - return FALSE; + { + return false; + } } -bool_ do_control_inven() +bool do_control_inven() { - if (!p_ptr->control) return FALSE; + if (!p_ptr->control) + { + return false; + } + screen_save(); prt("Carried items", 0, 0); show_monster_inven(p_ptr->control); inkey(); screen_load(); - return TRUE; + + return true; } -bool_ do_control_pickup() +bool do_control_pickup() { - if (!p_ptr->control) return FALSE; + if (!p_ptr->control) + { + return false; + } monster_type *m_ptr = &m_list[p_ptr->control]; @@ -408,19 +438,19 @@ bool_ do_control_pickup() msg_print("You pick up all objects on the floor."); } - return TRUE; + return true; } -bool_ do_control_drop() +bool do_control_drop() { monster_type *m_ptr = &m_list[p_ptr->control]; - if (!p_ptr->control) return FALSE; + if (!p_ptr->control) return false; monster_drop_carried_objects(m_ptr); - return TRUE; + return true; } -bool_ do_control_magic() +bool do_control_magic() { auto const &r_info = game->edit_data.r_info; @@ -432,14 +462,17 @@ bool_ do_control_magic() auto r_ptr = &r_info[m_list[p_ptr->control].r_idx]; int label; - if (!p_ptr->control) return FALSE; + if (!p_ptr->control) + { + return false; + } if (get_check("Do you want to abandon the creature?")) { if (get_check("Abandon it permanently?")) delete_monster_idx(p_ptr->control); p_ptr->control = 0; - return TRUE; + return true; } /* Extract available monster powers */ @@ -450,7 +483,7 @@ bool_ do_control_magic() if (!num) { msg_print("You have no powers you can use."); - return (TRUE); + return true; } /* Nothing chosen yet */ @@ -601,11 +634,12 @@ bool_ do_control_magic() energy_use = 100; monst_spell_monst_spell = power->monster_spell_index; } - return TRUE; + + return true; } /* Finds the controlled monster and "reconnect" to it */ -bool_ do_control_reconnect() +bool do_control_reconnect() { int i; @@ -620,10 +654,10 @@ bool_ do_control_reconnect() if (m_ptr->mflag & MFLAG_CONTROL) { p_ptr->control = i; - return TRUE; + return true; } } - return FALSE; + return false; } /* diff --git a/src/monster3.hpp b/src/monster3.hpp index ac26b102..2d4b2073 100644 --- a/src/monster3.hpp +++ b/src/monster3.hpp @@ -5,16 +5,16 @@ void dump_companions(FILE *outfile); void do_cmd_companion(); -bool_ do_control_reconnect(); -bool_ do_control_drop(); -bool_ do_control_magic(); -bool_ do_control_pickup(); -bool_ do_control_inven(); -bool_ do_control_walk(); -bool_ can_create_companion(); +bool do_control_reconnect(); +bool do_control_drop(); +bool do_control_magic(); +bool do_control_pickup(); +bool do_control_inven(); +bool do_control_walk(); +bool can_create_companion(); void ai_deincarnate(int m_idx); -bool_ ai_possessor(int m_idx, int o_idx); -bool_ ai_multiply(int m_idx); -bool_ change_side(monster_type *m_ptr); +void ai_possessor(int m_idx, int o_idx); +bool ai_multiply(int m_idx); +bool change_side(monster_type *m_ptr); int is_friend(monster_type *m_ptr); -bool_ is_enemy(monster_type *m_ptr, monster_type *t_ptr); +bool is_enemy(monster_type *m_ptr, monster_type *t_ptr); diff --git a/src/option_type.hpp b/src/option_type.hpp index fe1316b0..cfe2eb9b 100644 --- a/src/option_type.hpp +++ b/src/option_type.hpp @@ -10,7 +10,7 @@ struct option_type /** * Address of actual option variable. */ - bool_ *o_var; + bool *o_var; /** * Option page number. diff --git a/src/options.cc b/src/options.cc index ea2f3172..9f5a09f7 100644 --- a/src/options.cc +++ b/src/options.cc @@ -2,9 +2,9 @@ void options::reset_cheat_options() { - cheat_peek = FALSE; - cheat_hear = FALSE; - cheat_room = FALSE; - cheat_xtra = FALSE; - cheat_live = FALSE; + cheat_peek = false; + cheat_hear = false; + cheat_room = false; + cheat_xtra = false; + cheat_live = false; } diff --git a/src/options.hpp b/src/options.hpp index c1ac35a9..19e2766f 100644 --- a/src/options.hpp +++ b/src/options.hpp @@ -13,102 +13,102 @@ struct options { // // Option Set 1 -- User Interface // - bool_ rogue_like_commands = FALSE; /* Rogue-like commands */ - bool_ quick_messages = TRUE; /* Activate quick messages */ - bool_ carry_query_flag = FALSE; /* Prompt before picking things up */ - bool_ use_old_target = FALSE; /* Use old target by default */ - bool_ always_pickup = FALSE; /* Pick things up by default */ - bool_ always_repeat = TRUE; /* Repeat obvious commands */ - bool_ ring_bell = FALSE; /* Ring the bell (on errors, etc) */ + bool rogue_like_commands = false; /* Rogue-like commands */ + bool quick_messages = true; /* Activate quick messages */ + bool carry_query_flag = false; /* Prompt before picking things up */ + bool use_old_target = false; /* Use old target by default */ + bool always_pickup = false; /* Pick things up by default */ + bool always_repeat = true; /* Repeat obvious commands */ + bool ring_bell = false; /* Ring the bell (on errors, etc) */ // // Option Set 2 -- Disturbance // - bool_ find_ignore_stairs = FALSE; /* Run past stairs */ - bool_ find_ignore_doors = TRUE; /* Run through open doors */ - bool_ find_cut = FALSE; /* Run past known corners */ - bool_ find_examine = TRUE; /* Run into potential corners */ - bool_ disturb_move = FALSE; /* Disturb whenever any monster moves */ - bool_ disturb_near = TRUE; /* Disturb whenever viewable monster moves */ - bool_ disturb_panel = TRUE; /* Disturb whenever map panel changes */ - bool_ disturb_state = TRUE; /* Disturn whenever player state changes */ - bool_ disturb_minor = TRUE; /* Disturb whenever boring things happen */ - bool_ disturb_other = FALSE; /* Disturb whenever various things happen */ - bool_ last_words = TRUE; /* Get last words upon dying */ - bool_ wear_confirm = TRUE; /* Confirm before putting on known cursed items */ - bool_ confirm_stairs = FALSE; /* Prompt before staircases... */ - bool_ disturb_pets = FALSE; /* Pets moving nearby disturb us */ + bool find_ignore_stairs = false; /* Run past stairs */ + bool find_ignore_doors = true; /* Run through open doors */ + bool find_cut = false; /* Run past known corners */ + bool find_examine = true; /* Run into potential corners */ + bool disturb_move = false; /* Disturb whenever any monster moves */ + bool disturb_near = true; /* Disturb whenever viewable monster moves */ + bool disturb_panel = true; /* Disturb whenever map panel changes */ + bool disturb_state = true; /* Disturn whenever player state changes */ + bool disturb_minor = true; /* Disturb whenever boring things happen */ + bool disturb_other = false; /* Disturb whenever various things happen */ + bool last_words = true; /* Get last words upon dying */ + bool wear_confirm = true; /* Confirm before putting on known cursed items */ + bool confirm_stairs = false; /* Prompt before staircases... */ + bool disturb_pets = false; /* Pets moving nearby disturb us */ // // Option Set 3 -- Game-Play // - bool_ auto_scum = TRUE; /* Auto-scum for good levels */ - bool_ view_perma_grids = TRUE; /* Map remembers all perma-lit grids */ - bool_ view_torch_grids = FALSE; /* Map remembers all torch-lit grids */ - bool_ dungeon_align = TRUE; /* Generate dungeons with aligned rooms */ - bool_ dungeon_stair = TRUE; /* Generate dungeons with connected stairs */ - bool_ flow_by_sound = FALSE; /* Monsters track new player location */ - bool_ smart_learn = FALSE; /* Monsters learn from their mistakes */ - bool_ small_levels = TRUE; /* Allow unusually small dungeon levels */ - bool_ empty_levels = TRUE; /* Allow empty 'arena' levels */ + bool auto_scum = true; /* Auto-scum for good levels */ + bool view_perma_grids = true; /* Map remembers all perma-lit grids */ + bool view_torch_grids = false; /* Map remembers all torch-lit grids */ + bool dungeon_align = true; /* Generate dungeons with aligned rooms */ + bool dungeon_stair = true; /* Generate dungeons with connected stairs */ + bool flow_by_sound = false; /* Monsters track new player location */ + bool smart_learn = false; /* Monsters learn from their mistakes */ + bool small_levels = true; /* Allow unusually small dungeon levels */ + bool empty_levels = true; /* Allow empty 'arena' levels */ // // Option Set 4 -- Efficiency // - bool_ view_reduce_lite = FALSE; /* Reduce lite-radius when running */ - bool_ avoid_abort = FALSE; /* Avoid checking for user abort */ - bool_ avoid_shimmer = FALSE; /* Avoid processing extra shimmering */ - bool_ avoid_other = FALSE; /* Avoid processing special colors */ - bool_ flush_failure = TRUE; /* Flush input on any failure */ - bool_ flush_disturb = FALSE; /* Flush input on disturbance */ - bool_ flush_command = FALSE; /* Flush input before every command */ - bool_ fresh_before = TRUE; /* Flush output before normal commands */ - bool_ fresh_after = FALSE; /* Flush output after normal commands */ - bool_ fresh_message = FALSE; /* Flush output after all messages */ - bool_ hilite_player = FALSE; /* Hilite the player with the cursor */ - bool_ view_yellow_lite = FALSE; /* Use special colors for torch-lit grids */ - bool_ view_bright_lite = FALSE; /* Use special colors for 'viewable' grids */ - bool_ view_granite_lite = FALSE; /* Use special colors for wall grids (slow) */ - bool_ view_special_lite = FALSE; /* Use special colors for floor grids (slow) */ - bool_ center_player = FALSE; /* Center view on player */ + bool view_reduce_lite = false; /* Reduce lite-radius when running */ + bool avoid_abort = false; /* Avoid checking for user abort */ + bool avoid_shimmer = false; /* Avoid processing extra shimmering */ + bool avoid_other = false; /* Avoid processing special colors */ + bool flush_failure = true; /* Flush input on any failure */ + bool flush_disturb = false; /* Flush input on disturbance */ + bool flush_command = false; /* Flush input before every command */ + bool fresh_before = true; /* Flush output before normal commands */ + bool fresh_after = false; /* Flush output after normal commands */ + bool fresh_message = false; /* Flush output after all messages */ + bool hilite_player = false; /* Hilite the player with the cursor */ + bool view_yellow_lite = false; /* Use special colors for torch-lit grids */ + bool view_bright_lite = false; /* Use special colors for 'viewable' grids */ + bool view_granite_lite = false; /* Use special colors for wall grids (slow) */ + bool view_special_lite = false; /* Use special colors for floor grids (slow) */ + bool center_player = false; /* Center view on player */ // // Option Set 5 - ToME options // - bool_ ingame_help = TRUE; /* In-game contextual help? */ - bool_ auto_more = FALSE; /* Auto more */ - bool_ player_char_health = TRUE; /* Display the player as a special symbol when in bad health ? */ - bool_ linear_stats = TRUE; + bool ingame_help = true; /* In-game contextual help? */ + bool auto_more = false; /* Auto more */ + bool player_char_health = true; /* Display the player as a special symbol when in bad health ? */ + bool linear_stats = true; // // Option Set 6 - Birth options // - bool_ preserve = TRUE; /* Preserve artifacts */ - bool_ autoroll = TRUE; /* Specify 'minimal' stats to roll */ - bool_ point_based = FALSE; /* Generate character using a point system */ - bool_ ironman_rooms = FALSE; /* Always generate very unusual rooms */ - bool_ joke_monsters = FALSE; /* Allow 'joke' monsters */ - bool_ always_small_level = FALSE; /* Force small levels */ - bool_ fate_option = TRUE; /* Player can receive fates */ - bool_ no_selling = FALSE; /* Player cannot sell items */ + bool preserve = true; /* Preserve artifacts */ + bool autoroll = true; /* Specify 'minimal' stats to roll */ + bool point_based = false; /* Generate character using a point system */ + bool ironman_rooms = false; /* Always generate very unusual rooms */ + bool joke_monsters = false; /* Allow 'joke' monsters */ + bool always_small_level = false; /* Force small levels */ + bool fate_option = true; /* Player can receive fates */ + bool no_selling = false; /* Player cannot sell items */ // // Other options // - bool_ cheat_peek = FALSE; /* Peek into object creation */ - bool_ cheat_hear = FALSE; /* Peek into monster creation */ - bool_ cheat_room = FALSE; /* Peek into dungeon creation */ - bool_ cheat_xtra = FALSE; /* Peek into something else */ - bool_ cheat_live = FALSE; /* Allow player to avoid death */ + bool cheat_peek = false; /* Peek into object creation */ + bool cheat_hear = false; /* Peek into monster creation */ + bool cheat_room = false; /* Peek into dungeon creation */ + bool cheat_xtra = false; /* Peek into something else */ + bool cheat_live = false; /* Allow player to avoid death */ byte hitpoint_warn = 0; /* Hitpoint warning (0 to 9) */ byte delay_factor = 0; /* Delay factor (0 to 9) */ s16b autosave_freq = 100; /* Autosave frequency */ - bool_ autosave_t = FALSE; /* Timed autosave */ - bool_ autosave_l = FALSE; /* Autosave before entering new levels */ + bool autosave_t = false; /* Timed autosave */ + bool autosave_l = false; /* Autosave before entering new levels */ /** * Option groups diff --git a/src/powers.cc b/src/powers.cc index 8496e2e6..0906bb30 100644 --- a/src/powers.cc +++ b/src/powers.cc @@ -12,6 +12,7 @@ #include "cave_type.hpp" #include "cmd1.hpp" #include "cmd2.hpp" +#include "cmd5.hpp" #include "cmd7.hpp" #include "dungeon_flag.hpp" #include "feature_flag.hpp" diff --git a/src/q_bounty.cc b/src/q_bounty.cc index ca90bfc6..4d1c64e8 100644 --- a/src/q_bounty.cc +++ b/src/q_bounty.cc @@ -82,7 +82,7 @@ void quest_bounty_init_hook() // Initialized by building action } -bool_ quest_bounty_drop_item() +void quest_bounty_drop_item() { char mdesc[512]; char msg[512]; @@ -102,29 +102,27 @@ bool_ quest_bounty_drop_item() snprintf(msg, sizeof(msg), "You still must bring me back %s corpse.", mdesc); msg_print(msg); } - return FALSE; } -bool_ quest_bounty_get_item() +void quest_bounty_get_item() { auto &s_info = game->s_info; if (cquest.status != QUEST_STATUS_TAKEN) { msg_print("You do not have any bounty quest yet."); - return FALSE; + return; } // Get the corpse. int item = -1; - bool_ ret = - get_item(&item, - "What corpse to return?", - "You have no corpse to return.", - USE_INVEN, - bounty_item_tester_hook); - if (!ret) { - return FALSE; + if (!get_item(&item, + "What corpse to return?", + "You have no corpse to return.", + USE_INVEN, + bounty_item_tester_hook)) + { + return; } // Take the corpse from the inventory @@ -156,7 +154,6 @@ bool_ quest_bounty_get_item() // Need to ask for new quest. cquest.status = QUEST_STATUS_UNTAKEN; bounty_quest_monster = 0; - return FALSE; } std::string quest_bounty_describe() diff --git a/src/q_bounty.hpp b/src/q_bounty.hpp index fe9742ef..87fa73fd 100644 --- a/src/q_bounty.hpp +++ b/src/q_bounty.hpp @@ -5,6 +5,6 @@ #include <string> void quest_bounty_init_hook(); -bool_ quest_bounty_drop_item(); -bool_ quest_bounty_get_item(); +void quest_bounty_drop_item(); +void quest_bounty_get_item(); std::string quest_bounty_describe(); diff --git a/src/q_ultrag.cc b/src/q_ultrag.cc index fa4355a9..1e800c77 100644 --- a/src/q_ultrag.cc +++ b/src/q_ultrag.cc @@ -51,7 +51,7 @@ static bool quest_ultra_good_move_hook(void *, void *in_, void *) } auto old_quick_messages = options->quick_messages; - options->quick_messages = FALSE; + options->quick_messages = false; cmsg_print(TERM_L_BLUE, "You meet Galadriel."); cmsg_print(TERM_YELLOW, "'I still cannot believe this is all over.'"); diff --git a/src/school_type.hpp b/src/school_type.hpp index 1c1703bc..62c98251 100644 --- a/src/school_type.hpp +++ b/src/school_type.hpp @@ -7,15 +7,15 @@ struct school_type { const char *name; /* Name */ s16b skill; /* Skill used for that school */ - bool_ spell_power; /* Does spell power affect spells in this school? */ - bool_ sorcery; /* Does Sorcery affect this school? */ + bool spell_power; /* Does spell power affect spells in this school? */ + bool sorcery; /* Does Sorcery affect this school? */ int deity_idx; /* Deity; if <=0, no deity required */ deity_type *deity; /* Direct pointer to deity */ int (*bonus_levels)(); /* Calculate number of bonus levels */ - bool_ (*depends_satisfied)(); /* Are dependendies satisfied? */ + bool (*depends_satisfied)(); /* Are dependendies satisfied? */ struct school_provider_list *providers; /* List of secondary providers of this school */ }; diff --git a/src/spell_type.cc b/src/spell_type.cc index db021b9c..a549412b 100644 --- a/src/spell_type.cc +++ b/src/spell_type.cc @@ -26,15 +26,15 @@ struct spell_type casting_result (*effect_func)(); /* Spell effect function */ const char* (*info_func)(); /* Information function */ int (*lasting_func)(); /* Lasting effect function */ - bool_ (*depend_func)(); /* Check dependencies */ + bool (*depend_func)(); /* Check dependencies */ s16b minimum_pval; /* Minimum required pval for item-based spells */ enum casting_type casting_type; /* Type of casting required */ s16b casting_stat; /* Stat used for casting */ - bool_ castable_while_blind; - bool_ castable_while_confused; + bool castable_while_blind; + bool castable_while_confused; dice_type device_charges; /* Number of charges for devices */ std::vector<device_allocation *> m_device_allocation; /* Allocation table for devices */ @@ -206,7 +206,7 @@ void spell_type_init_demonology(spell_type *spell, void spell_type_init_geomancy(spell_type *spell, const char* (*info_func)(), casting_result (*effect_func)(), - bool_ (*depend_func)()) + bool (*depend_func)()) { spell_type_init_mage(spell, NO_RANDOM, @@ -232,14 +232,14 @@ void spell_type_set_mana(spell_type *spell, s32b min, s32b max) range_init(&spell->mana_range, min, max); } -void spell_type_set_castable_while_blind(spell_type *spell, bool_ value) +void spell_type_set_castable_while_blind(spell_type *spell, bool value) { assert(spell != NULL); spell->castable_while_blind = value; } -void spell_type_set_castable_while_confused(spell_type *spell, bool_ value) +void spell_type_set_castable_while_confused(spell_type *spell, bool value) { assert(spell != NULL); @@ -331,19 +331,19 @@ device_allocation *spell_type_device_allocation(spell_type *spell, byte tval) return NULL; } -bool_ spell_type_uses_piety_to_cast(spell_type *spell) +bool spell_type_uses_piety_to_cast(spell_type *spell) { assert(spell != NULL); return spell->casting_type == USE_PIETY; } -bool_ spell_type_castable_while_blind(spell_type *spell) +bool spell_type_castable_while_blind(spell_type *spell) { assert(spell != NULL); return spell->castable_while_blind; } -bool_ spell_type_castable_while_confused(spell_type *spell) +bool spell_type_castable_while_confused(spell_type *spell) { assert(spell != NULL); return spell->castable_while_confused; @@ -369,7 +369,7 @@ std::vector<s32b> const spell_type_get_schools(spell_type *spell) return school_idxs; } -bool_ spell_type_inertia(spell_type *spell, s32b *difficulty, s32b *delay) +bool spell_type_inertia(spell_type *spell, s32b *difficulty, s32b *delay) { if ((spell->inertia_difficulty < 0) || (spell->inertia_delay < 0)) @@ -421,13 +421,13 @@ void spell_type_mana_range(spell_type *spell, range_type *range) } } -bool_ spell_type_dependencies_satisfied(spell_type *spell) +bool spell_type_dependencies_satisfied(spell_type *spell) { assert(spell != NULL); if (spell->depend_func != NULL) { return spell->depend_func(); } else { - return TRUE; + return true; } } diff --git a/src/spell_type.hpp b/src/spell_type.hpp index 7353bc84..89cdfd8e 100644 --- a/src/spell_type.hpp +++ b/src/spell_type.hpp @@ -49,13 +49,13 @@ void spell_type_init_demonology(spell_type *spell, void spell_type_init_geomancy(spell_type *spell, const char* (*info_func)(), casting_result (*effect_func)(), - bool_ (*depend_func)()); + bool (*depend_func)()); void spell_type_set_inertia(spell_type *spell, s32b difficulty, s32b delay); void spell_type_set_difficulty(spell_type *spell, byte skill_level, s32b failure_rate); void spell_type_set_mana(spell_type *spell, s32b min, s32b max); -void spell_type_set_castable_while_blind(spell_type *spell, bool_ value); -void spell_type_set_castable_while_confused(spell_type *spell, bool_ value); +void spell_type_set_castable_while_blind(spell_type *spell, bool value); +void spell_type_set_castable_while_confused(spell_type *spell, bool value); void spell_type_describe(spell_type *spell, const char *line); void spell_type_add_school(spell_type *spell, s32b school_idx); @@ -71,16 +71,16 @@ const char *spell_type_name(spell_type *spell); int spell_type_skill_level(spell_type *spell); long spell_type_roll_charges(spell_type *spell); struct device_allocation *spell_type_device_allocation(spell_type *spell, byte tval); -bool_ spell_type_uses_piety_to_cast(spell_type *spell); -bool_ spell_type_castable_while_blind(spell_type *spell); -bool_ spell_type_castable_while_confused(spell_type *spell); +bool spell_type_uses_piety_to_cast(spell_type *spell); +bool spell_type_castable_while_blind(spell_type *spell); +bool spell_type_castable_while_confused(spell_type *spell); s16b spell_type_minimum_pval(spell_type *spell); s16b spell_type_random_type(spell_type *spell); std::vector<s32b> const spell_type_get_schools(spell_type *spell); -bool_ spell_type_inertia(spell_type *spell, s32b *difficulty, s32b *delay); +bool spell_type_inertia(spell_type *spell, s32b *difficulty, s32b *delay); s32b spell_type_failure_rate(spell_type *spell); s16b spell_type_casting_stat(spell_type *spell); const char *spell_type_info(spell_type *spell); void spell_type_mana_range(spell_type *spell, struct range_type *range); -bool_ spell_type_dependencies_satisfied(spell_type *spell); +bool spell_type_dependencies_satisfied(spell_type *spell); void spell_type_description_foreach(spell_type *spell, std::function<void (std::string const &text)>); diff --git a/src/spells3.cc b/src/spells3.cc index 21ebe1bf..7ee8b654 100644 --- a/src/spells3.cc +++ b/src/spells3.cc @@ -475,11 +475,11 @@ casting_result convey_recall() // Fetch item if (get_level_s(RECALL, 50) >= 15) { - fetch(5, 10 + get_level_s(RECALL, 150), FALSE); + fetch(5, 10 + get_level_s(RECALL, 150), false); } else { - fetch(5, 10 + get_level_s(RECALL, 150), TRUE); + fetch(5, 10 + get_level_s(RECALL, 150), true); } return CAST; } @@ -1542,7 +1542,7 @@ const char *geomancy_vaporize_info() return buf; } -bool_ geomancy_vaporize_depends() +bool geomancy_vaporize_depends() { return get_skill(SKILL_AIR) >= 4; } @@ -1571,7 +1571,7 @@ const char *geomancy_geolysis_info() return buf; } -bool_ geomancy_geolysis_depends() +bool geomancy_geolysis_depends() { return get_skill(SKILL_EARTH) >= 7; } @@ -1601,7 +1601,7 @@ const char *geomancy_dripping_tread_info() return buf; } -bool_ geomancy_dripping_tread_depends() +bool geomancy_dripping_tread_depends() { return get_skill(SKILL_WATER) >= 10; } @@ -1622,7 +1622,7 @@ casting_result geomancy_grow_barrier() return CAST; } -bool_ geomancy_grow_barrier_depends() +bool geomancy_grow_barrier_depends() { return get_skill(SKILL_EARTH) >= 12; } diff --git a/src/spells3.hpp b/src/spells3.hpp index a698b6d5..ff1359db 100644 --- a/src/spells3.hpp +++ b/src/spells3.hpp @@ -140,15 +140,15 @@ casting_result geomancy_channel_elements(); casting_result geomancy_elemental_wave(); casting_result geomancy_vaporize(); const char *geomancy_vaporize_info(); -bool_ geomancy_vaporize_depends(); +bool geomancy_vaporize_depends(); casting_result geomancy_geolysis(); const char *geomancy_geolysis_info(); -bool_ geomancy_geolysis_depends(); +bool geomancy_geolysis_depends(); casting_result geomancy_dripping_tread(); const char *geomancy_dripping_tread_info(); -bool_ geomancy_dripping_tread_depends(); +bool geomancy_dripping_tread_depends(); casting_result geomancy_grow_barrier(); -bool_ geomancy_grow_barrier_depends(); +bool geomancy_grow_barrier_depends(); casting_result geomancy_elemental_minion(); const char *geomancy_elemental_minion_info(); diff --git a/src/spells4.cc b/src/spells4.cc index 33b2b24e..c061b86c 100644 --- a/src/spells4.cc +++ b/src/spells4.cc @@ -53,7 +53,7 @@ s32b SCHOOL_VARDA; s32b SCHOOL_WATER; s32b SCHOOL_YAVANNA; -static bool_ uses_piety_to_cast(int s) +static bool uses_piety_to_cast(int s) { return spell_type_uses_piety_to_cast(spell_at(s)); } @@ -147,7 +147,7 @@ int spell_x(int sval, int spell_idx, int i) } } -bool_ school_book_contains_spell(int sval, s32b spell_idx) +bool school_book_contains_spell(int sval, s32b spell_idx) { random_book_setup(sval, spell_idx); school_book *school_book = school_books_at(sval); @@ -416,7 +416,7 @@ static std::string spell_school_name(spell_type *spell) int print_spell(const char *label_, byte color, int y, s32b s) { s32b level; - bool_ na; + bool na; spell_type *spell = spell_at(s); const char *spell_info = spell_type_info(spell); const char *label = (label_ == NULL) ? "" : label_; diff --git a/src/spells4.hpp b/src/spells4.hpp index c0f7a736..6293202d 100644 --- a/src/spells4.hpp +++ b/src/spells4.hpp @@ -38,5 +38,5 @@ void random_book_setup(s16b sval, s32b spell_idx); int print_spell(const char *label, byte color, int y, s32b s); int school_book_length(int sval); int spell_x(int sval, int spell_idx, int i); -bool_ school_book_contains_spell(int sval, s32b spell_idx); +bool school_book_contains_spell(int sval, s32b spell_idx); void lua_cast_school_spell(s32b spell_idx, bool_ no_cost); diff --git a/src/spells5.cc b/src/spells5.cc index 53d7b8b2..bd04a0d2 100644 --- a/src/spells5.cc +++ b/src/spells5.cc @@ -1331,8 +1331,8 @@ void school_spells_init() spell_type_set_mana(spell, 30, 60); spell_type_set_inertia(spell, 1, 5); spell_type_set_difficulty(spell, 15, 40); - spell_type_set_castable_while_blind(spell, TRUE); - spell_type_set_castable_while_confused(spell, TRUE); + spell_type_set_castable_while_blind(spell, true); + spell_type_set_castable_while_confused(spell, true); spell_type_init_mage(spell, RANDOM, SCHOOL_META, @@ -1526,7 +1526,7 @@ void school_spells_init() spell_type_describe(spell, "At level 17 it can be targeted"); spell_type_set_mana(spell, 2, 20); spell_type_set_difficulty(spell, 1, 10); - spell_type_set_castable_while_blind(spell, TRUE); + spell_type_set_castable_while_blind(spell, true); spell_type_init_mage(spell, NO_RANDOM, SCHOOL_GEOMANCY, @@ -1551,7 +1551,7 @@ void school_spells_init() spell_type_describe(spell, "At Fire level 15, fire become hellfire."); spell_type_set_mana(spell, 3, 30); spell_type_set_difficulty(spell, 3, 20); - spell_type_set_castable_while_blind(spell, TRUE); + spell_type_set_castable_while_blind(spell, true); spell_type_init_mage(spell, NO_RANDOM, SCHOOL_GEOMANCY, @@ -1566,7 +1566,7 @@ void school_spells_init() spell_type_describe(spell, "Abyss squares cannot be channeled into a wave."); spell_type_set_mana(spell, 15, 50); spell_type_set_difficulty(spell, 15, 20); - spell_type_set_castable_while_blind(spell, TRUE); + spell_type_set_castable_while_blind(spell, true); spell_type_init_mage(spell, NO_RANDOM, SCHOOL_GEOMANCY, @@ -1579,7 +1579,7 @@ void school_spells_init() spell_type_describe(spell, "Draws upon your immediate environs to form a cloud of damaging vapors"); spell_type_set_mana(spell, 3, 30); spell_type_set_difficulty(spell, 4, 15); - spell_type_set_castable_while_blind(spell, TRUE); + spell_type_set_castable_while_blind(spell, true); spell_type_init_geomancy( spell, geomancy_vaporize_info, @@ -1593,7 +1593,7 @@ void school_spells_init() spell_type_describe(spell, "leaving behind tailings of various different sorts of walls in the passage."); spell_type_set_mana(spell, 15, 40); spell_type_set_difficulty(spell, 7, 15); - spell_type_set_castable_while_blind(spell, TRUE); + spell_type_set_castable_while_blind(spell, true); spell_type_init_geomancy( spell, geomancy_geolysis_info, @@ -1606,7 +1606,7 @@ void school_spells_init() spell_type_describe(spell, "Causes you to leave random elemental forms behind as you walk"); spell_type_set_mana(spell, 15, 25); spell_type_set_difficulty(spell, 10, 15); - spell_type_set_castable_while_blind(spell, TRUE); + spell_type_set_castable_while_blind(spell, true); spell_type_init_geomancy( spell, geomancy_dripping_tread_info, @@ -1620,7 +1620,7 @@ void school_spells_init() spell_type_describe(spell, "At level 20 it can be projected around another area."); spell_type_set_mana(spell, 30, 40); spell_type_set_difficulty(spell, 12, 15); - spell_type_set_castable_while_blind(spell, TRUE); + spell_type_set_castable_while_blind(spell, true); spell_type_init_geomancy( spell, no_info, @@ -1658,7 +1658,7 @@ void school_spells_init() SCHOOL_ERU, eru_see_the_music_info, eru_see_the_music); - spell_type_set_castable_while_blind(spell, TRUE); + spell_type_set_castable_while_blind(spell, true); } { @@ -2129,7 +2129,7 @@ void school_spells_init() spell_type_describe(spell, "Stops the current song, if any."); spell_type_set_mana(spell, 0, 0); spell_type_set_difficulty(spell, 1, -400); - spell_type_set_castable_while_blind(spell, TRUE); + spell_type_set_castable_while_blind(spell, true); spell_type_init_music(spell, 1, no_info, @@ -2142,7 +2142,7 @@ void school_spells_init() spell_type_describe(spell, "Consumes the amount of mana each turn."); spell_type_set_mana(spell, 1, 10); spell_type_set_difficulty(spell, 1, 20); - spell_type_set_castable_while_blind(spell, TRUE); + spell_type_set_castable_while_blind(spell, true); spell_type_init_music_lasting( spell, 1, @@ -2157,7 +2157,7 @@ void school_spells_init() spell_type_describe(spell, "Consumes the amount of mana each turn."); spell_type_set_mana(spell, 2, 15); spell_type_set_difficulty(spell, 5, 30); - spell_type_set_castable_while_blind(spell, TRUE); + spell_type_set_castable_while_blind(spell, true); spell_type_init_music_lasting( spell, 2, @@ -2172,7 +2172,7 @@ void school_spells_init() spell_type_describe(spell, "Consumes the amount of mana each turn."); spell_type_set_mana(spell, 3, 25); spell_type_set_difficulty(spell, 10, 45); - spell_type_set_castable_while_blind(spell, TRUE); + spell_type_set_castable_while_blind(spell, true); spell_type_init_music_lasting( spell, 4, @@ -2187,7 +2187,7 @@ void school_spells_init() spell_type_describe(spell, "Consumes the amount of mana each turn."); spell_type_set_mana(spell, 1, 1); spell_type_set_difficulty(spell, 1, 20); - spell_type_set_castable_while_blind(spell, TRUE); + spell_type_set_castable_while_blind(spell, true); spell_type_init_music_lasting( spell, 1, diff --git a/src/spells6.cc b/src/spells6.cc index 110f8e9c..c91b74cc 100644 --- a/src/spells6.cc +++ b/src/spells6.cc @@ -80,8 +80,8 @@ static school_type *school_new(s32b *school_idx, const char *name, s16b skill) static school_type *sorcery_school_new(s32b *school_idx, const char *name, s16b skill) { school_type *school = school_new(school_idx, name, skill); - school->spell_power = TRUE; - school->sorcery = TRUE; + school->spell_power = true; + school->sorcery = true; return school; } @@ -98,7 +98,7 @@ static school_type *god_school_new(s32b *school_idx, byte god) if (god_enabled(deity)) { school = school_new(school_idx, deity->name, SKILL_PRAY); - school->spell_power = TRUE; + school->spell_power = true; school->deity_idx = god; school->deity = deity; return school; @@ -128,22 +128,20 @@ static int udun_bonus_levels() return (p_ptr->lev * 2) / 3; } -static bool_ geomancy_depends_satisfied() +static bool geomancy_depends_satisfied() { - object_type *o_ptr = NULL; - /* Require at least one point in each school */ if ((get_skill(SKILL_FIRE) <= 0) || (get_skill(SKILL_AIR) <= 0) || (get_skill(SKILL_EARTH) <= 0) || (get_skill(SKILL_WATER) <= 0)) { - return FALSE; + return false; } /* Require to wield a Mage Staff, as the spells requries the * caster to stomp the floor with it. */ - o_ptr = get_object(INVEN_WIELD); + auto o_ptr = get_object(INVEN_WIELD); return ((o_ptr != NULL) && (o_ptr->k_ptr) && @@ -243,7 +241,7 @@ static bool get_level_school_callback(struct get_level_school_callback_data *dat return true; } -void get_level_school(spell_type *spell, s32b max, s32b min, s32b *level, bool_ *na) +void get_level_school(spell_type *spell, s32b max, s32b min, s32b *level, bool *na) { assert(level != NULL); assert(na != NULL); @@ -252,7 +250,7 @@ void get_level_school(spell_type *spell, s32b max, s32b min, s32b *level, bool_ if (!spell_type_dependencies_satisfied(spell)) { *level = min; - *na = TRUE; + *na = true; return; } @@ -270,7 +268,7 @@ void get_level_school(spell_type *spell, s32b max, s32b min, s32b *level, bool_ if (!get_level_school_callback(&data, school_idx)) { *level = min; - *na = TRUE; + *na = true; return; } } @@ -293,7 +291,7 @@ void get_level_school(spell_type *spell, s32b max, s32b min, s32b *level, bool_ /* Result */ *level = data.lvl; - *na = FALSE; + *na = false; } void schools_init() @@ -333,7 +331,7 @@ void schools_init() { school_type *school = school_new(&SCHOOL_GEOMANCY, "Geomancy", SKILL_GEOMANCY); - school->spell_power = TRUE; + school->spell_power = true; school->depends_satisfied = geomancy_depends_satisfied; } |