changeset 5986:3828f4c73a88 draft

(svn r8689) -Fix [FS#613] (r8619): crash when an old savegame had buoys on the northern edge of the map.
author rubidium <rubidium@openttd.org>
date Mon, 12 Feb 2007 12:52:37 +0000
parents 34cb8ae8ab20
children 7622c33a48f8
files src/openttd.cpp
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -1776,6 +1776,15 @@
 		}
 	}
 
+	/* Buoys do now store the owner of the previous water tile, which can never
+	 * be OWNER_NONE. So replace OWNER_NONE with OWNER_WATER. */
+	if (CheckSavegameVersion(46)) {
+		Station *st;
+		FOR_ALL_STATIONS(st) {
+			if (st->IsBuoy() && IsTileOwner(st->xy, OWNER_NONE)) SetTileOwner(st->xy, OWNER_WATER);
+		}
+	}
+
 	return true;
 }