diff options
-rw-r--r-- | lib/core/util.lua | 9 | ||||
-rw-r--r-- | lib/mods/theme/core/util.lua | 9 | ||||
-rw-r--r-- | lib/mods/theme/scpt/help.lua | 11 | ||||
-rw-r--r-- | lib/scpt/help.lua | 11 | ||||
-rw-r--r-- | src/help.c | 31 |
5 files changed, 30 insertions, 41 deletions
diff --git a/lib/core/util.lua b/lib/core/util.lua index 7729ac35..2d437d61 100644 --- a/lib/core/util.lua +++ b/lib/core/util.lua @@ -118,12 +118,3 @@ end function msg_format(...) msg_print(call(format, arg)) end - --- A way to check if the game is now running(as opposed to initialization/character gen) -game = {} -add_hooks -{ - [HOOK_GAME_START] = function () - game.started = TRUE - end -} diff --git a/lib/mods/theme/core/util.lua b/lib/mods/theme/core/util.lua index 7729ac35..2d437d61 100644 --- a/lib/mods/theme/core/util.lua +++ b/lib/mods/theme/core/util.lua @@ -118,12 +118,3 @@ end function msg_format(...) msg_print(call(format, arg)) end - --- A way to check if the game is now running(as opposed to initialization/character gen) -game = {} -add_hooks -{ - [HOOK_GAME_START] = function () - game.started = TRUE - end -} diff --git a/lib/mods/theme/scpt/help.lua b/lib/mods/theme/scpt/help.lua index d9f637bd..d8900d6c 100644 --- a/lib/mods/theme/scpt/help.lua +++ b/lib/mods/theme/scpt/help.lua @@ -218,14 +218,3 @@ ingame_help end end, } - -ingame_help -{ - ["hook"] = HOOK_RECALC_SKILLS, - ["event"] = function() if game.started and (get_melee_skills() > 1) then return TRUE end end, - ["desc"] = - { - "Ah, you now possess more than one melee type. To switch between them press m", - "and select the switch melee type option.", - } -} diff --git a/lib/scpt/help.lua b/lib/scpt/help.lua index 0ee307cb..734747ed 100644 --- a/lib/scpt/help.lua +++ b/lib/scpt/help.lua @@ -184,14 +184,3 @@ ingame_help end end, } - -ingame_help -{ - ["hook"] = HOOK_RECALC_SKILLS, - ["event"] = function() if game.started and (get_melee_skills() > 1) then return TRUE end end, - ["desc"] = - { - "Ah, you now possess more than one melee type. To switch between them press m", - "and select the switch melee type option.", - } -} @@ -14,7 +14,7 @@ #include "angband.h" #define DESC_MAX 14 -#define TRIGGERED_HELP_MAX 17 +#define TRIGGERED_HELP_MAX 18 #define HELP_VOID_JUMPGATE 0 #define HELP_FOUNTAIN 1 @@ -33,6 +33,12 @@ #define HELP_1ST_LEVEL 14 #define HELP_20TH_LEVEL 15 #define HELP_ID_SPELL_ITM 16 +#define HELP_MELEE_SKILLS 17 + +/** + * Game started? + */ +static bool_ game_started = FALSE; /** * Struct for help triggered by a boolean condition @@ -148,6 +154,10 @@ static bool_ trigger_identify_spell_item(void *in_, void *out) { return FALSE; } +static bool_ trigger_melee_skills(void *in, void *out) { + return (game_started && (get_melee_skills() > 1)); +} + /** * Trigger-based help items */ @@ -322,6 +332,14 @@ static triggered_help_type triggered_help[TRIGGERED_HELP_MAX] = "is permanent; the spell cannot be removed or changed later.", NULL } + }, + { HELP_MELEE_SKILLS, + HOOK_RECALC_SKILLS, + trigger_melee_skills, + { "Ah, you now possess more than one melee type. To switch between them press m", + "and select the switch melee type option.", + NULL + } } }; @@ -348,6 +366,12 @@ static bool_ triggered_help_hook(void *data, void *in, void *out) return FALSE; } +static bool_ hook_game_start(void *data, void *in, void *out) +{ + game_started = TRUE; + return FALSE; +} + static void setup_triggered_help_hook(int i) { static int counter = 0; @@ -373,6 +397,11 @@ static void setup_triggered_help_hooks() { setup_triggered_help_hook(i); } + + add_hook_new(HOOK_GAME_START, + hook_game_start, + "help_game_start", + NULL); } /* |