Changeset - r25608:e7436c947000
[Not reviewed]
master
0 1 0
Patric Stout - 3 years ago 2021-06-04 08:33:38
truebrain@openttd.org
Codechange: use wrappers to get Var[Mem|File]Type, instead of GB()
1 file changed with 9 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/saveload/saveload.cpp
Show inline comments
 
@@ -587,17 +587,17 @@ static inline uint SlGetArrayLength(size
 
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);
 

	
 
	switch (length << 4) {
 

	
 
	switch (GetVarMemType(conv)) {
 
		case SLE_VAR_STRB:
 
		case SLE_VAR_STR:
 
		case SLE_VAR_STRQ:
 
			return SlReadArrayLength();
 

	
 
		default:
 
			assert(length < lengthof(conv_mem_size));
 
			return conv_mem_size[length];
 
			uint8 type = GetVarMemType(conv) >> 4;
 
			assert(type < lengthof(conv_mem_size));
 
			return conv_mem_size[type];
 
	}
 
}
 

	
 
@@ -610,9 +610,10 @@ static inline uint SlCalcConvMemLen(VarT
 
static inline byte SlCalcConvFileLen(VarType conv)
 
{
 
	static const byte conv_file_size[] = {1, 1, 2, 2, 4, 4, 8, 8, 2};
 
	byte length = GB(conv, 0, 4);
 
	assert(length < lengthof(conv_file_size));
 
	return conv_file_size[length];
 

	
 
	uint8 type = GetVarFileType(conv);
 
	assert(type < lengthof(conv_file_size));
 
	return conv_file_size[type];
 
}
 

	
 
/** Return the size in bytes of a reference (pointer) */
0 comments (0 inline, 0 general)