From ac8ef5f15e948e351ff4e92a4150ff6602dd680e Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Fri, 8 Jun 2012 16:34:39 +0200 Subject: Lua: Move "Found Altar" help to C --- lib/mods/theme/scpt/help.lua | 13 ------------- lib/scpt/help.lua | 13 ------------- src/help.c | 18 +++++++++++++++++- 3 files changed, 17 insertions(+), 27 deletions(-) diff --git a/lib/mods/theme/scpt/help.lua b/lib/mods/theme/scpt/help.lua index ff901650..1f260a96 100644 --- a/lib/mods/theme/scpt/help.lua +++ b/lib/mods/theme/scpt/help.lua @@ -6,19 +6,6 @@ ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -ingame_help -{ - ["hook"] = HOOK_MOVE, - ["event"] = function(y, x) if (cave(y, x).feat >= FEAT_ALTAR_HEAD) and (cave(y, x).feat <= FEAT_ALTAR_TAIL) then return TRUE end end, - ["desc"] = - { - "Altars are the way to reach the Valar, powers of the world,", - "usualy called Gods. You can press O to become a follower.", - "Beware that once you follow a god, you are not allowed to change.", - "For an exact description of what gods do and want, read the documentation." - } -} - -- Beware this one, if Bree is moved from 21, 34 (y, x) on the wilderness map it will break ingame_help { diff --git a/lib/scpt/help.lua b/lib/scpt/help.lua index 8c8ffd8d..aa6d11f5 100644 --- a/lib/scpt/help.lua +++ b/lib/scpt/help.lua @@ -6,19 +6,6 @@ ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -ingame_help -{ - ["hook"] = HOOK_MOVE, - ["event"] = function(y, x) if (cave(y, x).feat >= FEAT_ALTAR_HEAD) and (cave(y, x).feat <= FEAT_ALTAR_TAIL) then return TRUE end end, - ["desc"] = - { - "Altars are the way to reach the Valar, powers of the world,", - "usualy called Gods. You can press O to become a follower.", - "Beware that once you follow a god, you are not allowed to change.", - "For an exact description of what gods do and want, read the documentation." - } -} - -- Beware this one, if Bree is moved from 21, 34 (y, x) on the wilderness map it will break ingame_help { diff --git a/src/help.c b/src/help.c index 356228fb..db31e5e2 100644 --- a/src/help.c +++ b/src/help.c @@ -14,11 +14,12 @@ #include "angband.h" #define DESC_MAX 10 -#define TRIGGERED_HELP_MAX 3 +#define TRIGGERED_HELP_MAX 4 #define HELP_VOID_JUMPGATE 0 #define HELP_FOUNTAIN 1 #define HELP_FOUND_OBJECT 2 +#define HELP_FOUND_ALTAR 3 /** * Struct for help triggered by a boolean condition @@ -54,6 +55,12 @@ static bool_ trigger_found_object(void *in, void *out) { return cave[p->y][p->x].o_idx != 0; } +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)); +} + /** * Trigger-based help items */ @@ -82,6 +89,15 @@ static triggered_help_type triggered_help[TRIGGERED_HELP_MAX] = "some basic information. You may also want to identify them with scrolls,", "staves, rods or spells.", NULL } + }, + { HELP_FOUND_ALTAR, + HOOK_MOVE, + trigger_found_altar, + { "Altars are the way to reach the Valar, powers of the world,", + "usualy called Gods. You can press O to become a follower.", + "Beware that once you follow a god, you are not allowed to change.", + "For an exact description of what gods do and want, read the documentation.", + NULL } } }; -- cgit v1.2.3