changeset 17201:f1a1be5504ef draft

(svn r21940) -Fix [FS#4460]: Not all vehicles should be tested to be inside a tunnel upon savegame load (SmatZ)
author planetmaker <planetmaker@openttd.org>
date Wed, 02 Feb 2011 16:46:42 +0000
parents 91764ea184ea
children 0abfc0a01f6d
files src/saveload/afterload.cpp
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -2377,6 +2377,10 @@
 		 * get messed up just after loading the savegame. This fixes that. */
 		Vehicle *v;
 		FOR_ALL_VEHICLES(v) {
+			/* Not all vehicle types can be inside a tunnel. Furthermore,
+			 * testing IsTunnelTile() for invalid tiles causes a crash. */
+			if (!v->IsGroundVehicle()) continue;
+
 			/* Is the vehicle in a tunnel? */
 			if (!IsTunnelTile(v->tile)) continue;