Mercurial > hg > openttd
changeset 7149:fd912fe20a6a draft
(svn r10423) -Fix [YAPF, r10301]: INVALID_TRACKDIR causing buffer overrun leading to desync in MP game (many thanks Rubidium)
author | KUDr <KUDr@openttd.org> |
---|---|
date | Wed, 04 Jul 2007 00:12:02 +0000 |
parents | bb5dfe7d8fcf |
children | 1abc5f2b5c81 |
files | src/yapf/yapf_costrail.hpp |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/yapf/yapf_costrail.hpp +++ b/src/yapf/yapf_costrail.hpp @@ -90,6 +90,8 @@ FORCEINLINE int CurveCost(Trackdir td1, Trackdir td2) { + assert(IsValidTrackdir(td1)); + assert(IsValidTrackdir(td2)); int cost = 0; if (TrackFollower::Allow90degTurns() && ((TrackdirToTrackdirBits(td2) & (TrackdirBits)TrackdirCrossesTrackdirs(td1)) != 0)) { @@ -265,7 +267,7 @@ TILE cur(n.m_key.m_tile, n.m_key.m_td); // the previous tile will be needed for transition cost calculations - TILE prev = has_parent ? TILE() : TILE(n.m_parent->GetLastTile(), n.m_parent->GetLastTrackdir()); + TILE prev = !has_parent ? TILE() : TILE(n.m_parent->GetLastTile(), n.m_parent->GetLastTrackdir()); EndSegmentReasonBits end_segment_reason = ESRB_NONE;