From dc714960e3699144fcd39a13460b0a8f9fd0ca4d Mon Sep 17 00:00:00 2001 From: yexo Date: Fri, 29 Jan 2010 21:06:35 +0000 Subject: (svn r18952) -Fix (r18950): loading recent (=newer then title game) savegames failed --- src/saveload/saveload.h | 10 ++++++++++ src/settings.cpp | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h index b5218456c..c3864c04f 100644 --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -295,6 +295,16 @@ static inline VarType GetVarFileType(VarType type) return type & 0xF; // GB(type, 0, 4); } +/** + * Check if the given saveload type is a numeric type. + * @param conv the type to check + * @return True if it's a numeric type. + */ +static bool IsNumericType(VarType conv) +{ + return GetVarMemType(conv) <= SLE_VAR_U64; +} + /** Get the address of the variable. Which one to pick depends on the object * pointer. If it is NULL we are dealing with global variables so the address * is taken. If non-null only the offset is stored in the union and we need diff --git a/src/settings.cpp b/src/settings.cpp index 3150ebc17..9af46b4be 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -1784,7 +1784,7 @@ static void LoadSettings(const SettingDesc *osd, void *object) void *ptr = GetVariableAddress(object, sld); if (!SlObjectMember(ptr, sld)) continue; - Write_ValidateSetting(ptr, osd, ReadValue(ptr, sld->conv)); + if (IsNumericType(sld->conv)) Write_ValidateSetting(ptr, osd, ReadValue(ptr, sld->conv)); } } -- cgit v1.2.3-70-g09d2