MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SlCopy

Function SlCopy

src/saveload/saveload.cpp:1150–1162  ·  view source on GitHub ↗

* Copy a list of SL_VARs to/from a savegame. * These entries are copied as-is, and you as caller have to make sure things * like length-fields are calculated correctly. * @param object The object being manipulated. * @param length The length of the object in elements * @param conv VarType type of the items. */

Source from the content-addressed store, hash-verified

1148 * @param conv VarType type of the items.
1149 */
1150void SlCopy(void *object, size_t length, VarType conv)
1151{
1152 if (_sl.action == SLA_PTRS || _sl.action == SLA_NULL) return;
1153
1154 /* Automatically calculate the length? */
1155 if (_sl.need_length != NL_NONE) {
1156 SlSetLength(length * SlCalcConvFileLen(conv));
1157 /* Determine length only? */
1158 if (_sl.need_length == NL_CALCLENGTH) return;
1159 }
1160
1161 SlCopyInternal(object, length, conv);
1162}
1163
1164/**
1165 * Return the size in bytes of a certain type of atomic array

Callers 15

SaveObjectMethod · 0.85
LoadObjectsMethod · 0.85
LoadMethod · 0.85
LoadMethod · 0.85
SaveMethod · 0.85
LoadMethod · 0.85
SaveMethod · 0.85
LoadMethod · 0.85
SaveMethod · 0.85
LoadMethod · 0.85
SaveMethod · 0.85
LoadMethod · 0.85

Calls 3

SlSetLengthFunction · 0.85
SlCalcConvFileLenFunction · 0.85
SlCopyInternalFunction · 0.85

Tested by

no test coverage detected