summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-04-24 08:15:58 +0000
committerrubidium <rubidium@openttd.org>2009-04-24 08:15:58 +0000
commitd21f406b038f9514c4180ff2ab16f2f9db91afb4 (patch)
treee3d66fc8770e96888b815333a29fb1837abcdce0 /src
parent7d76836fcb2e1a03b6b84592da55d5157245a9a1 (diff)
downloadopenttd-d21f406b038f9514c4180ff2ab16f2f9db91afb4.tar.xz
(svn r16133) -Fix (r16129): who would've thought that the saveload system couldn't handle skipping strings on load yet?
Diffstat (limited to 'src')
-rw-r--r--src/saveload/saveload.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 43b904e34..f0eb90bb1 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -145,17 +145,28 @@ static void SlReadFill()
}
static inline size_t SlGetOffs() {return _sl.offs_base - (_sl.bufe - _sl.bufp);}
+static inline uint SlReadArrayLength();
/** Return the size in bytes of a certain type of normal/atomic variable
* as it appears in memory. See VarTypes
* @param conv VarType type of variable that is used for calculating the size
* @return Return the size of this type in bytes */
-static inline byte SlCalcConvMemLen(VarType conv)
+static inline uint SlCalcConvMemLen(VarType conv)
{
static const byte conv_mem_size[] = {1, 1, 1, 2, 2, 4, 4, 8, 8, 0};
byte length = GB(conv, 4, 4);
- assert(length < lengthof(conv_mem_size));
- return conv_mem_size[length];
+
+ switch (length << 4) {
+ case SLE_VAR_STRB:
+ case SLE_VAR_STRBQ:
+ case SLE_VAR_STR:
+ case SLE_VAR_STRQ:
+ return SlReadArrayLength();
+
+ default:
+ assert(length < lengthof(conv_mem_size));
+ return conv_mem_size[length];
+ }
}
/** Return the size in bytes of a certain type of normal/atomic variable