From f1f703a9bec43282c25f93e97dab3706efe265fa Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Fri, 8 Jun 2012 06:15:15 +0200 Subject: Lua: Move "Fountain" help to C --- lib/mods/theme/scpt/help.lua | 11 ----------- lib/scpt/help.lua | 11 ----------- src/help.c | 15 ++++++++++++++- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/lib/mods/theme/scpt/help.lua b/lib/mods/theme/scpt/help.lua index ca6fa6c6..e1feea19 100644 --- a/lib/mods/theme/scpt/help.lua +++ b/lib/mods/theme/scpt/help.lua @@ -6,17 +6,6 @@ ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -ingame_help -{ - ["hook"] = HOOK_MOVE, - ["event"] = function(y, x) if cave(y, x).feat == FEAT_FOUNTAIN then return TRUE end end, - ["desc"] = - { - "Fountains are always magical. You can quaff from them by pressing H.", - "Beware that unlike potions they cannot be identified.", - } -} - ingame_help { ["hook"] = HOOK_MOVE, diff --git a/lib/scpt/help.lua b/lib/scpt/help.lua index 293de713..42fb9eeb 100644 --- a/lib/scpt/help.lua +++ b/lib/scpt/help.lua @@ -6,17 +6,6 @@ ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -ingame_help -{ - ["hook"] = HOOK_MOVE, - ["event"] = function(y, x) if cave(y, x).feat == FEAT_FOUNTAIN then return TRUE end end, - ["desc"] = - { - "Fountains are always magical. You can quaff from them by pressing H.", - "Beware that unlike potions they cannot be identified.", - } -} - ingame_help { ["hook"] = HOOK_MOVE, diff --git a/src/help.c b/src/help.c index a87a146a..edc61e53 100644 --- a/src/help.c +++ b/src/help.c @@ -14,9 +14,10 @@ #include "angband.h" #define DESC_MAX 10 -#define TRIGGERED_HELP_MAX 1 +#define TRIGGERED_HELP_MAX 2 #define HELP_VOID_JUMPGATE 0 +#define HELP_FOUNTAIN 1 /** * Struct for help triggered by a boolean condition @@ -42,6 +43,11 @@ static bool_ trigger_void_jumpgate(void *in, void *out) { return cave[p->y][p->x].feat == FEAT_BETWEEN; } +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; +} + /** * Trigger-based help items */ @@ -53,6 +59,13 @@ static triggered_help_type triggered_help[TRIGGERED_HELP_MAX] = { "Void Jumpgates can be entered by pressing the > key. They will transport", "you to another jumpgate, but beware of the cold damage that might kill you.", NULL } + }, + { HELP_FOUNTAIN, + HOOK_MOVE, + trigger_fountain, + { "Fountains are always magical. You can quaff from them by pressing H.", + "Beware that unlike potions they cannot be identified.", + NULL } } }; -- cgit v1.2.3