Changeset - r25697:3a19d560faf8
[Not reviewed]
master
0 1 0
Patric Stout - 3 years ago 2021-06-15 10:00:48
truebrain@openttd.org
Codechange: make it more obvious SlArray supports SLE_VAR_NULL

In the end, the code was already doing the right thing, but a few
functions deep, and not really obvious. When validating what objects
can handle SLE_VAR_NULL, it is nicer to just have this obvious.
1 file changed with 6 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/saveload/saveload.cpp
Show inline comments
 
@@ -1069,6 +1069,12 @@ void SlArray(void *array, size_t length,
 
		if (_sl.need_length == NL_CALCLENGTH) return;
 
	}
 

	
 
	if (GetVarMemType(conv) == SLE_VAR_NULL) {
 
		assert(_sl.action != SLA_SAVE); // Use SL_NULL if you want to write null-bytes
 
		SlSkipBytes(SlCalcArrayLen(length, conv));
 
		return;
 
	}
 

	
 
	/* NOTICE - handle some buggy stuff, in really old versions everything was saved
 
	 * as a byte-type. So detect this, and adjust array size accordingly */
 
	if (_sl.action != SLA_SAVE && _sl_version == 0) {
0 comments (0 inline, 0 general)