diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-07 14:00:30 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-07 14:00:30 +0000 |
commit | f051683f544f26da598a14007a8a1739226a2e5a (patch) | |
tree | 9b909a25321309e9fd642febe3f07ee956f65fa5 /crawl-ref/source/tags.cc | |
parent | bdf8da41d22e79b08e42615bb2bdadc47d2906a4 (diff) | |
download | crawl-ref-f051683f544f26da598a14007a8a1739226a2e5a.tar.gz crawl-ref-f051683f544f26da598a14007a8a1739226a2e5a.zip |
Enable pathfinding for patrolling monsters who lost their patrol point.
Fixed patrol definitions in maps not actually working.
Tested both by teleporting the minotaur in a labyrinth. About 50 turns
later it arrived back in its lair. :)
Since the minotaur proved to have a high magic resistance, it had plenty
of time to loot the stash at the labyrinth entrance once I'd woken it
before I finally managed to teleport it away (in wizmode you can force
monsters not noticing you).
This resulted in
"A minotaur, wielding the demon trident "Suyn Oma", and wearing a heavily
runed ring mail." o_O
It had also picked up a scroll and a wand. Ouch... (but cool!)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5536 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/tags.cc')
-rw-r--r-- | crawl-ref/source/tags.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc index 5e5cd91e76..77f024c952 100644 --- a/crawl-ref/source/tags.cc +++ b/crawl-ref/source/tags.cc @@ -1769,6 +1769,12 @@ static void marshall_monster(writer &th, const monsters &m) marshallByte(th, m.target_x); marshallByte(th, m.target_y); marshallCoord(th, m.patrol_point); + + // monster pathfinding (TAG_MINOR_PATHFIND) + marshallShort(th, m.travel_path.size()); + for (unsigned int i = 0; i < m.travel_path.size(); i++) + marshallCoord(th, m.travel_path[i]); + marshallLong(th, m.flags); marshallLong(th, m.experience); @@ -2034,6 +2040,17 @@ 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_PATHFIND) + { + const int len = unmarshallShort(th); + for (int i = 0; i < len; ++i) + { + coord_def c; + unmarshallCoord(th, c); + m.travel_path.push_back(c); + } + } + m.flags = unmarshallLong(th); m.experience = static_cast<unsigned long>(unmarshallLong(th)); |