(svn r10151) [0.5] -Fix [FS#862]: train disconnects in some old TTD savegames.
--- a/oldloader.c Sun Jun 10 19:59:34 2007 +0000
+++ b/oldloader.c Wed Jun 13 20:30:48 2007 +0000
@@ -19,6 +19,7 @@
#include "network.h"
#include "ai/ai.h"
#include "date.h"
+#include "bridge_map.h"
enum {
HEADER_SIZE = 49,
@@ -356,6 +357,21 @@
break;
}
}
+
+ if (IsBridgeTile(v->tile) && IsBridgeRamp(v->tile) &&
+ (v->z_pos & (TILE_HEIGHT - 1)) == (TILE_HEIGHT - 1)) {
+ /* Under some circumstances the trains going up a ramp can be one
+ * pixel too low when they enter the bridge. This causes the train
+ * to "disappear" under the bridge, which causes the train to
+ * break into two pieces and crash slightly later.
+ *
+ * This "hack" will make the trains on those positions on the
+ * ramps run one pixel higher. This offset will be automatically
+ * "fixed" when it enters the bridge middle parts or when it
+ * drives down the ramp of the bridge.
+ */
+ v->z_pos++;
+ }
}
}