summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-05-31 22:49:44 +0200
committerPatric Stout <github@truebrain.nl>2021-06-10 19:18:24 +0200
commitfba86f711fe091fa0802a65979df019f690e8827 (patch)
treeaaaa3373eb0fd0cdfb852ff69c0d74c7797a5f8d
parentf899772ec29b9b802ab07e074dc0421f4e2d1a28 (diff)
downloadopenttd-fba86f711fe091fa0802a65979df019f690e8827.tar.xz
Codechange: move GetVariableAddress inside SlObjectMember
Also move it to static, as nobody else is using it.
-rw-r--r--src/saveload/saveload.cpp7
-rw-r--r--src/saveload/saveload.h1
2 files changed, 4 insertions, 4 deletions
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 29fcf89da..c325c1ee5 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -1517,8 +1517,10 @@ size_t SlCalcObjMemberLength(const void *object, const SaveLoad &sld)
}
}
-bool SlObjectMember(void *ptr, const SaveLoad &sld)
+static bool SlObjectMember(void *object, const SaveLoad &sld)
{
+ void *ptr = GetVariableAddress(object, sld);
+
assert(IsVariableSizeRight(sld));
VarType conv = GB(sld.conv, 0, 8);
@@ -1604,8 +1606,7 @@ void SlObject(void *object, const SaveLoadTable &slt)
}
for (auto &sld : slt) {
- void *ptr = GetVariableAddress(object, sld);
- SlObjectMember(ptr, sld);
+ SlObjectMember(object, sld);
}
}
diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h
index 53a81f7c2..e320c7d8b 100644
--- a/src/saveload/saveload.h
+++ b/src/saveload/saveload.h
@@ -905,7 +905,6 @@ void SlWriteByte(byte b);
void SlGlobList(const SaveLoadTable &slt);
void SlArray(void *array, size_t length, VarType conv);
void SlObject(void *object, const SaveLoadTable &slt);
-bool SlObjectMember(void *object, const SaveLoad &sld);
void NORETURN SlError(StringID string, const char *extra_msg = nullptr);
void NORETURN SlErrorCorrupt(const char *msg);
void NORETURN SlErrorCorruptFmt(const char *format, ...) WARN_FORMAT(1, 2);