mirror of https://github.com/OpenTTD/OpenTTD
(svn r15891) -Fix (r13464): YAPF used different penalties for aqueducts than for other water tiles.
parent
a052191aca
commit
c2ced41c04
|
@ -160,7 +160,7 @@ public:
|
||||||
int dy = abs(y1 - y2);
|
int dy = abs(y1 - y2);
|
||||||
int dmin = min(dx, dy);
|
int dmin = min(dx, dy);
|
||||||
int dxy = abs(dx - dy);
|
int dxy = abs(dx - dy);
|
||||||
int d = dmin * 7 + (dxy - 1) * (10 / 2);
|
int d = dmin * YAPF_TILE_CORNER_LENGTH + (dxy - 1) * (YAPF_TILE_LENGTH / 2);
|
||||||
n.m_estimate = n.m_cost + d;
|
n.m_estimate = n.m_cost + d;
|
||||||
assert(n.m_estimate >= n.m_parent->m_estimate);
|
assert(n.m_estimate >= n.m_parent->m_estimate);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -113,11 +113,11 @@ public:
|
||||||
FORCEINLINE bool PfCalcCost(Node& n, const TrackFollower *tf)
|
FORCEINLINE bool PfCalcCost(Node& n, const TrackFollower *tf)
|
||||||
{
|
{
|
||||||
/* base tile cost depending on distance */
|
/* base tile cost depending on distance */
|
||||||
int c = IsDiagonalTrackdir(n.GetTrackdir()) ? 10 : 7;
|
int c = IsDiagonalTrackdir(n.GetTrackdir()) ? YAPF_TILE_LENGTH : YAPF_TILE_CORNER_LENGTH;
|
||||||
/* additional penalty for curves */
|
/* additional penalty for curves */
|
||||||
if (n.m_parent != NULL && n.GetTrackdir() != NextTrackdir(n.m_parent->GetTrackdir())) {
|
if (n.m_parent != NULL && n.GetTrackdir() != NextTrackdir(n.m_parent->GetTrackdir())) {
|
||||||
/* new trackdir does not match the next one when going straight */
|
/* new trackdir does not match the next one when going straight */
|
||||||
c += 10;
|
c += YAPF_TILE_LENGTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
c += YAPF_TILE_LENGTH * tf->m_tiles_skipped;
|
c += YAPF_TILE_LENGTH * tf->m_tiles_skipped;
|
||||||
|
|
Loading…
Reference in New Issue