summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-pathfind.cc
diff options
context:
space:
mode:
authorRaphael Langella <raphael.langella@gmail.com>2011-04-20 15:43:50 +0200
committerRaphael Langella <raphael.langella@gmail.com>2011-04-20 23:23:59 +0200
commit319b30273689f7d03200a9c99bc70acf2431424c (patch)
tree526eae6074040bbe48ba32c108dd03922af9c54c /crawl-ref/source/mon-pathfind.cc
parent52db06e4672c7ae23cc8f166b49809d2116f55b8 (diff)
downloadcrawl-ref-319b30273689f7d03200a9c99bc70acf2431424c.tar.gz
crawl-ref-319b30273689f7d03200a9c99bc70acf2431424c.zip
New experimental compile time option: EUCLIDEAN.
Diagonal movements cost 1.4 more than orthogonal ones. Implemented: Player movement. Monster movement. Monster pathfinding. Not implemented: Stealth: no idea how to handle it properly since it ignores movement speed. Travel: it won't always use the shortest path but on the other hand, it already avoid useless zigzaging so it shouldn't be too bad. AI: Outside of pathfinding, it's not aware of it, but I'm not sure if it's really a problem. LOS: I considered reducing the LOS to 7, so that the diagonal distance and orthogonal distance of the los are equal (5 * 1.4 = 7), but I'm not sure it's worth it. Other edge cells will have a slightly different distance anyway. Changed: show_game_turns option default to true.
Diffstat (limited to 'crawl-ref/source/mon-pathfind.cc')
-rw-r--r--crawl-ref/source/mon-pathfind.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-pathfind.cc b/crawl-ref/source/mon-pathfind.cc
index 61eb187190..0de13394fa 100644
--- a/crawl-ref/source/mon-pathfind.cc
+++ b/crawl-ref/source/mon-pathfind.cc
@@ -421,10 +421,23 @@ bool monster_pathfind::mons_traversable(const coord_def& p)
int monster_pathfind::travel_cost(coord_def npos)
{
+#ifdef EUCLIDEAN
+ int cost = 1;
+ if (mons)
+ cost = mons_travel_cost(npos);
+
+ if ((pos - npos).abs() == 2)
+ cost *= 14;
+ else
+ cost *= 10;
+
+ return cost;
+#else
if (mons)
return mons_travel_cost(npos);
return (1);
+#endif
}
// Assumes that grids that really cannot be entered don't even get here.