(svn r18952) -Fix (r18950): loading recent (=newer then title game) savegames failed

This commit is contained in:
yexo 2010-01-29 21:06:35 +00:00
parent b0349704b0
commit dc714960e3
2 changed files with 11 additions and 1 deletions

View File

@ -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

View File

@ -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));
}
}