summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tags.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-10 08:37:46 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-10 08:37:46 +0000
commitc48e3fbe888d67a5abf206614ca7655629840dda (patch)
tree8a296e06ee211e51f65e33548ab26800a59cf67b /crawl-ref/source/tags.cc
parentba35a3c7bbee2e937f3091002803476340d18787 (diff)
downloadcrawl-ref-c48e3fbe888d67a5abf206614ca7655629840dda.tar.gz
crawl-ref-c48e3fbe888d67a5abf206614ca7655629840dda.zip
Enable monsters to move around glass structures if they can see the
player through the walls. Don't use pathfinding to target other monsters, only the player! Monsters of different intelligence have different limits on the distance they may travel to circumvent an obstacle, i.e. zombies will only use a range of 2, whereas highly intelligent monsters can expertly find their way through (transparent) labyrinths, though there's a chance they'll forget their target if they don't see it, so for very long and winding paths it's likely they don't ever arrive. Will probably affect performance, though I did test on entire levels turned transparent with Vitrification and things seemed to run more or less smoothly. Ideally, monsters should also be able to move around other obstacles that don't affect visibility (such as water, lava, or statues) but that is currently not possible. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5700 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/tags.cc')
-rw-r--r--crawl-ref/source/tags.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index 77f024c952..caa83181df 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -1769,6 +1769,8 @@ static void marshall_monster(writer &th, const monsters &m)
marshallByte(th, m.target_x);
marshallByte(th, m.target_y);
marshallCoord(th, m.patrol_point);
+ int help = m.travel_target;
+ marshallByte(th, help);
// monster pathfinding (TAG_MINOR_PATHFIND)
marshallShort(th, m.travel_path.size());
@@ -2040,6 +2042,12 @@ static void unmarshall_monster(reader &th, monsters &m)
if (_tag_minor_version >= TAG_MINOR_MPATROL)
unmarshallCoord(th, m.patrol_point);
+ if (_tag_minor_version >= TAG_MINOR_TRTARGET)
+ {
+ int help = unmarshallByte(th);
+ m.travel_target = static_cast<montravel_target_type>(help);
+ }
+
if (_tag_minor_version >= TAG_MINOR_PATHFIND)
{
const int len = unmarshallShort(th);