diff options
author | Bardur Arantsson <bardur@scientician.net> | 2016-09-17 09:58:14 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2016-09-17 09:58:14 +0200 |
commit | 4f1abfbf1a70f4dcc4e360a68b71b27e867d561d (patch) | |
tree | ab35f6ec61730c74b7e16cc055cd4dc3954710d6 /src | |
parent | d9d9d8c5e96eadbefb2c8506a387fc282c2fe8b5 (diff) |
Split "inscription known" game state from inscription definitions
Diffstat (limited to 'src')
-rw-r--r-- | src/birth.cc | 4 | ||||
-rw-r--r-- | src/cmd1.cc | 5 | ||||
-rw-r--r-- | src/cmd6.cc | 3 | ||||
-rw-r--r-- | src/inscription_info_type.hpp | 1 | ||||
-rw-r--r-- | src/loadsave.cc | 2 | ||||
-rw-r--r-- | src/player_type.hpp | 4 | ||||
-rw-r--r-- | src/tables.cc | 10 |
7 files changed, 13 insertions, 16 deletions
diff --git a/src/birth.cc b/src/birth.cc index a49db966..086f932f 100644 --- a/src/birth.cc +++ b/src/birth.cc @@ -868,9 +868,9 @@ static void player_wipe(void) } /* Wipe the known inscription list */ - for (i = 0; i < MAX_INSCRIPTIONS; i++) + for (auto &inscription_known: p_ptr->inscriptions) { - inscription_info[i].know = FALSE; + inscription_known = false; } /* Wipe the known traps list */ diff --git a/src/cmd1.cc b/src/cmd1.cc index f8e064c2..642c9df8 100644 --- a/src/cmd1.cc +++ b/src/cmd1.cc @@ -4746,13 +4746,14 @@ void do_cmd_engrave() { if (!strcmp(inscription_info[i].text, buf)) { - if (inscription_info[i].know) + if (p_ptr->inscriptions[i]) { - /* Save the inscription */ cave[p_ptr->py][p_ptr->px].inscription = i; } else + { msg_print("You can't use this inscription for now."); + } } } diff --git a/src/cmd6.cc b/src/cmd6.cc index 1663b5c1..9c71584b 100644 --- a/src/cmd6.cc +++ b/src/cmd6.cc @@ -3582,9 +3582,10 @@ void do_cmd_read_scroll(void) /* Load screen */ screen_load(); + /* Inscriptions become known upon reading */ if (o_ptr->sval >= 100) { - inscription_info[o_ptr->sval - 100].know = TRUE; + p_ptr->inscriptions[o_ptr->sval - 100] = TRUE; } used_up = FALSE; diff --git a/src/inscription_info_type.hpp b/src/inscription_info_type.hpp index 6dbb67f1..4e1e4c32 100644 --- a/src/inscription_info_type.hpp +++ b/src/inscription_info_type.hpp @@ -9,6 +9,5 @@ struct inscription_info_type { char text[40]; /* The inscription itself */ byte when; /* When it is executed */ - bool_ know; /* Is the inscription know ? */ byte mana; /* Grid mana needed */ }; diff --git a/src/loadsave.cc b/src/loadsave.cc index c31aeccc..5fb4bada 100644 --- a/src/loadsave.cc +++ b/src/loadsave.cc @@ -2450,7 +2450,7 @@ static bool do_floor_inscriptions(ls_flag_t flag) for (std::size_t i = 0; i < n_inscriptions; i++) { - do_bool(&inscription_info[i].know, flag); + do_std_bool(&p_ptr->inscriptions[i], flag); } return true; diff --git a/src/player_type.hpp b/src/player_type.hpp index 8f3c06dc..20fa81a4 100644 --- a/src/player_type.hpp +++ b/src/player_type.hpp @@ -1,6 +1,7 @@ #pragma once #include "corrupt.hpp" +#include "defines.h" #include "h-basic.h" #include "help_info.hpp" #include "inventory.hpp" @@ -381,6 +382,9 @@ struct player_type /* Acquired abilities; indexes into ab_info[] */ std::vector<u16b> abilities; + /* Known inscriptions; true if known, false otherwise. */ + std::array<bool, MAX_INSCRIPTIONS> inscriptions; + /* Skills */ s16b skill_points = 0; s16b skill_last_level = 0; /* Prevents gaining skills by losing level and regaining them */ diff --git a/src/tables.cc b/src/tables.cc index de8215da..7f7a7b8e 100644 --- a/src/tables.cc +++ b/src/tables.cc @@ -2353,52 +2353,44 @@ move_info_type move_info[9] = */ inscription_info_type inscription_info[MAX_INSCRIPTIONS] = { - { /* Nothing */ + { /* Padding; 0 index is used to signify "no inscription" */ "", 0, - TRUE, 0, }, { /* Light up the room(Adunaic) */ "ure nimir", /* sun shine */ INSCRIP_EXEC_ENGRAVE | INSCRIP_EXEC_WALK | INSCRIP_EXEC_MONST_WALK, - FALSE, 30, }, { /* Darkness in room(Adunaic) */ "lomi gimli", /* night stars */ INSCRIP_EXEC_ENGRAVE | INSCRIP_EXEC_WALK | INSCRIP_EXEC_MONST_WALK, - FALSE, 10, }, { /* Storm(Adunaic) */ "dulgi bawiba", /* black winds */ INSCRIP_EXEC_ENGRAVE | INSCRIP_EXEC_WALK | INSCRIP_EXEC_MONST_WALK, - FALSE, 40, }, { /* Protection(Sindarin) */ "pedo mellon a minno", /* say friend and enter */ INSCRIP_EXEC_MONST_WALK, - FALSE, 8, }, { /* Dwarves summoning(Khuzdul) */ "Baruk Khazad! Khazad aimenu!", /* Axes of the Dwarves, the Dwarves are upon you! */ INSCRIP_EXEC_ENGRAVE, - FALSE, 100, }, { /* Open Chasm(Nandorin) */ "dunna hrassa", /* black precipice */ INSCRIP_EXEC_MONST_WALK, - FALSE, 50, }, { /* Blast of Black Fire(Orcish) */ "burz ghash ronk", /* black fire pool */ INSCRIP_EXEC_ENGRAVE | INSCRIP_EXEC_WALK | INSCRIP_EXEC_MONST_WALK, - FALSE, 60, }, }; |