(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.
This commit is contained in:
KUDr
2007-07-15 11:45:38 +00:00
parent 9f2ca45987
commit 3df88dada8
2 changed files with 23 additions and 7 deletions

View File

@@ -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;