summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2015-08-18 16:28:57 -0400
committermekolat <mekolat@users.noreply.github.com>2016-04-15 11:45:51 -0400
commit150e3098dee0b8e72238436f25c37b14c83410aa (patch)
treea67a3f5e0dcd49843065eeaed8c36bf6a9c1203e
parent879243c8661a346291b1ca57ffe6cdfdef90598f (diff)
downloadtmwa-150e3098dee0b8e72238436f25c37b14c83410aa.tar.gz
tmwa-150e3098dee0b8e72238436f25c37b14c83410aa.tar.bz2
tmwa-150e3098dee0b8e72238436f25c37b14c83410aa.tar.xz
tmwa-150e3098dee0b8e72238436f25c37b14c83410aa.zip
replicate magic-v2's line_of_sight
-rw-r--r--src/map/script-fun.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp
index 51039ad..0c6ebb8 100644
--- a/src/map/script-fun.cpp
+++ b/src/map/script-fun.cpp
@@ -601,7 +601,7 @@ void builtin_target(ScriptState *st)
val |= 0x04; // 0x04 target is walkable (has clear path to target)
}
- // TODO 0x08 target is visible (not behind collision) XXX maybe this is line of sight?
+ // TODO 0x08 target is visible (not behind collision)
if (flag & 0x10)
{
@@ -610,7 +610,11 @@ void builtin_target(ScriptState *st)
val |= 0x10; // 0x10 target can be attacked by source (killer, killable and so on)
}
- // TODO 0x20 target is in line of sight
+ if (flag & 0x20)
+ {
+ if (battle_check_range(source, target, 0))
+ val |= 0x20; // 0x20 target is in line of sight
+ }
push_int<ScriptDataInt>(st->stack, val);
}