summaryrefslogtreecommitdiff
path: root/src/yapf/yapf_ship.cpp
diff options
context:
space:
mode:
authorKUDr <kudr@openttd.org>2007-07-15 11:45:38 +0000
committerKUDr <kudr@openttd.org>2007-07-15 11:45:38 +0000
commitd71d48434dee0c4f9435a25d15aefe4ee1e41b91 (patch)
treebae1861670a97c0f24e67a5fc511e59727e3768a /src/yapf/yapf_ship.cpp
parent6474a5a95759641feb93edf7cc34c2f58bb23eb2 (diff)
downloadopenttd-d71d48434dee0c4f9435a25d15aefe4ee1e41b91.tar.xz
(svn r10578) -Fix [YAPF, ships]: Ships received curve penalty for non-diagonal straight move. (JazzyJaffa)
-The fix in cost calculation uncovered bug in estimate calculation. Ships now use the same estimate algorithm as trains.
Diffstat (limited to 'src/yapf/yapf_ship.cpp')
-rw-r--r--src/yapf/yapf_ship.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/yapf/yapf_ship.cpp b/src/yapf/yapf_ship.cpp
index b3cee7aa6..f1c456dcd 100644
--- a/src/yapf/yapf_ship.cpp
+++ b/src/yapf/yapf_ship.cpp
@@ -105,7 +105,10 @@ public:
// base tile cost depending on distance
int c = IsDiagonalTrackdir(n.GetTrackdir()) ? 10 : 7;
// additional penalty for curves
- if (n.m_parent != NULL && n.GetTrackdir() != n.m_parent->GetTrackdir()) c += 3;
+ if (n.m_parent != NULL && n.GetTrackdir() != NextTrackdir(n.m_parent->GetTrackdir())) {
+ /* new trackdir does not match the next one when going straight */
+ c += 10;
+ }
// apply it
n.m_cost = n.m_parent->m_cost + c;
return true;