changeset 9455:ed5d9983d855 draft

(svn r13373) -Fix (r10210): loading of very old savegames was broken
author smatz <smatz@openttd.org>
date Tue, 03 Jun 2008 11:39:15 +0000
parents 929d8a0b2974
children 516efcac18bc
files src/saveload.cpp src/subsidy_gui.cpp
diffstat 2 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/saveload.cpp
+++ b/src/saveload.cpp
@@ -651,10 +651,18 @@
 	/* NOTICE - handle some buggy stuff, in really old versions everything was saved
 	 * as a byte-type. So detect this, and adjust array size accordingly */
 	if (!_sl.save && _sl_version == 0) {
+		/* all arrays except difficulty settings */
 		if (conv == SLE_INT16 || conv == SLE_UINT16 || conv == SLE_STRINGID ||
 				conv == SLE_INT32 || conv == SLE_UINT32) {
-			length *= SlCalcConvFileLen(conv);
-			conv = SLE_INT8;
+			SlCopyBytes(array, length * SlCalcConvFileLen(conv));
+			return;
+		}
+		/* used for conversion of Money 32bit->64bit */
+		if (conv == (SLE_FILE_I32 | SLE_VAR_I64)) {
+			for (uint i = 0; i < length; i++) {
+				((int64*)array)[i] = (int32)BSWAP32(SlReadUint32());
+			}
+			return;
 		}
 	}
 
--- a/src/subsidy_gui.cpp
+++ b/src/subsidy_gui.cpp
@@ -46,11 +46,11 @@
 		}
 
 		if (num == 0) {
-			y -= 10; /* "None" */
+			y -= 10; // "None"
 			if (y < 0) return;
 		}
 
-		y -= 11; /* "Services already subsidised:" */
+		y -= 11; // "Services already subsidised:"
 		if (y < 0) return;
 
 		for (const Subsidy *s = _subsidies; s != endof(_subsidies); s++) {