summaryrefslogtreecommitdiff
path: root/npf.c
diff options
context:
space:
mode:
authormatthijs <matthijs@openttd.org>2005-06-16 17:53:40 +0000
committermatthijs <matthijs@openttd.org>2005-06-16 17:53:40 +0000
commitfc5784a3103d5e4fc0dbfec5f905a6ebbfd9c84b (patch)
treeb393c22d92fe82d6de7c2c0eef53d90bfd8e3430 /npf.c
parent085cc7ca0ef7e9ac88d197669177fc8d7d8266f8 (diff)
downloadopenttd-fc5784a3103d5e4fc0dbfec5f905a6ebbfd9c84b.tar.xz
(svn r2447) * Add: [NPF] Penalty for road vehicles making turns.
Diffstat (limited to 'npf.c')
-rw-r--r--npf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/npf.c b/npf.c
index c3d0f0bef..f8fb7ed0c 100644
--- a/npf.c
+++ b/npf.c
@@ -322,8 +322,10 @@ int32 NPFRoadPathCost(AyStar* as, AyStarNode* current, OpenListNode* parent) {
/* Check for slope */
cost += NPFSlopeCost(current);
- /* Check for turns */
- //TODO
+ /* Check for turns. Road vehicles only really drive diagonal, turns are
+ * represented by non-diagonal tracks */
+ if (!IsDiagonalTrackdir(current->direction))
+ cost += _patches.npf_road_curve_penalty;
NPFMarkTile(tile);
DEBUG(npf, 4)("Calculating G for: (%d, %d). Result: %d", TileX(current->tile), TileY(current->tile), cost);