mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-04 06:00:15 +00:00
(svn r16133) -Fix (r16129): who would've thought that the saveload system couldn't handle skipping strings on load yet?
This commit is contained in:
parent
9dd88c1586
commit
8d3b681b6b
@ -145,17 +145,28 @@ static void SlReadFill()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline size_t SlGetOffs() {return _sl.offs_base - (_sl.bufe - _sl.bufp);}
|
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
|
/** Return the size in bytes of a certain type of normal/atomic variable
|
||||||
* as it appears in memory. See VarTypes
|
* as it appears in memory. See VarTypes
|
||||||
* @param conv VarType type of variable that is used for calculating the size
|
* @param conv VarType type of variable that is used for calculating the size
|
||||||
* @return Return the size of this type in bytes */
|
* @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};
|
static const byte conv_mem_size[] = {1, 1, 1, 2, 2, 4, 4, 8, 8, 0};
|
||||||
byte length = GB(conv, 4, 4);
|
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
|
/** Return the size in bytes of a certain type of normal/atomic variable
|
||||||
|
Loading…
Reference in New Issue
Block a user