summaryrefslogtreecommitdiff
path: root/src/yapf
diff options
context:
space:
mode:
authorKUDr <KUDr@openttd.org>2007-06-29 23:55:16 +0000
committerKUDr <KUDr@openttd.org>2007-06-29 23:55:16 +0000
commit1e54937ee1761c7ab0a7cec8fa43abf77b8d2a96 (patch)
tree6bfd1b7246671cf9d8b58f3a3d8a3577a922380e /src/yapf
parent41b75d545e3fbcfa761cc70b6ce02e3b8ffbc253 (diff)
downloadopenttd-1e54937ee1761c7ab0a7cec8fa43abf77b8d2a96.tar.xz
(svn r10394) -Fix [YAPF]: MP desync caused by incorrect last-red-signal penalties applied when cached segment was reused. Players that connected more recently (didn't have these segments cached yet) calculated those penalties correctly. This caused different YAPF results.
Diffstat (limited to 'src/yapf')
-rw-r--r--src/yapf/yapf_costrail.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/yapf/yapf_costrail.hpp b/src/yapf/yapf_costrail.hpp
index 4fd541ce6..4fe1eb74f 100644
--- a/src/yapf/yapf_costrail.hpp
+++ b/src/yapf/yapf_costrail.hpp
@@ -295,6 +295,16 @@ public:
segment_cost = segment.m_cost;
/* We know also the reason why the segment ends. */
end_segment_reason = segment.m_end_segment_reason;
+ /* We will need also some information about the last signal (if it was red). */
+ if (segment.m_last_signal_tile != INVALID_TILE) {
+ assert(HasSignalOnTrackdir(segment.m_last_signal_tile, segment.m_last_signal_td));
+ SignalState sig_state = GetSignalStateByTrackdir(segment.m_last_signal_tile, segment.m_last_signal_td);
+ bool is_red = (sig_state == SIGNAL_STATE_RED);
+ n.flags_u.flags_s.m_last_signal_was_red = is_red;
+ if (is_red) {
+ n.m_last_red_signal_type = GetSignalType(segment.m_last_signal_tile, TrackdirToTrack(segment.m_last_signal_td));
+ }
+ }
/* No further calculation needed. */
cur = TILE(n.GetLastTile(), n.GetLastTrackdir());
break;