(svn r10491) -Fix [FS#988, YAPF]: When rail segment was cached using electric engine and it ended with non-electric rail it was incorrectly cached with the end reason ESRB_DEAD_END instead of ESRB_RAIL_TYPE. (Eddi)
- It caused YAPF to end prematurely there when it was searching for another path (for non-electric engine).
- It can lead to sub-optimal path taken or 'train is lost' message.
- In MP game it can also cause desync.
- Uses changes made in r10489.
--- a/src/yapf/yapf_costrail.hpp Mon Jul 09 18:53:43 2007 +0000
+++ b/src/yapf/yapf_costrail.hpp Mon Jul 09 18:57:12 2007 +0000
@@ -378,7 +378,11 @@
if (!tf_local.Follow(cur.tile, cur.td)) {
assert(tf_local.m_err != TrackFollower::EC_NONE);
/* Can't move to the next tile (EOL?). */
- end_segment_reason |= ESRB_DEAD_END;
+ if (tf_local.m_err == TrackFollower::EC_RAIL_TYPE) {
+ end_segment_reason |= ESRB_RAIL_TYPE;
+ } else {
+ end_segment_reason |= ESRB_DEAD_END;
+ }
break;
}