summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFate <fate-tmw@googlemail.com>2008-11-29 19:27:13 -0700
committerFate <fate-tmw@googlemail.com>2008-11-29 19:27:13 -0700
commit41ad58a56c0f9d27ca61709141115981520fc9ea (patch)
treed5e1fcf4449710514f3392cd598161f61124843c
parent5eef103593c0fc649ed3db92fa104b1f7e5906d3 (diff)
downloadtmwa-41ad58a56c0f9d27ca61709141115981520fc9ea.tar.gz
tmwa-41ad58a56c0f9d27ca61709141115981520fc9ea.tar.bz2
tmwa-41ad58a56c0f9d27ca61709141115981520fc9ea.tar.xz
tmwa-41ad58a56c0f9d27ca61709141115981520fc9ea.zip
Added SLang function `is_dead'
-rw-r--r--doc/spell-language4
-rw-r--r--src/map/magic-expr.c9
2 files changed, 13 insertions, 0 deletions
diff --git a/doc/spell-language b/doc/spell-language
index 5b0e5bb..d5f99d8 100644
--- a/doc/spell-language
+++ b/doc/spell-language
@@ -550,6 +550,10 @@ The following functions are available:
otherwise NE, SE, NW, SW will also be used. The two locations must be
on the same map.
+ + is_dead : entity -> bool
+ Determines whether the specified entity is no longer alive.
+
+
Operations:
-----------
This section documents the operations API.
diff --git a/src/map/magic-expr.c b/src/map/magic-expr.c
index 0c5b9ce..7840941 100644
--- a/src/map/magic-expr.c
+++ b/src/map/magic-expr.c
@@ -723,6 +723,14 @@ fun_is_married(env_t *env, int args_nr, val_t *result, val_t *args)
}
static int
+fun_is_dead(env_t *env, int args_nr, val_t *result, val_t *args)
+{
+ RESULTINT = (ETY(0) == BL_PC
+ && pc_isdead(ARGPC(0)));
+ return 0;
+}
+
+static int
fun_partner(env_t *env, int args_nr, val_t *result, val_t *args)
{
if (ETY(0) == BL_PC
@@ -1164,6 +1172,7 @@ static fun_t functions[] = {
{ "map_level", "l", 'i', fun_map_level },
{ "map_nr", "l", 'i', fun_map_nr },
{ "dir_towards", "lli", 'd', fun_dir_towards },
+ { "is_dead", "e", 'i', fun_is_dead },
{ NULL, NULL, '.', NULL }
};