From 2bccf4edd35a4276188b06bb00ebff93caef8e7e Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 15 Jan 2025 15:38:43 -0700 Subject: [PATCH] Add Read for char* --- LEGO1/lego/legoomni/src/common/legogamestate.cpp | 5 +---- LEGO1/lego/sources/misc/legostorage.h | 9 +++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index a24b2e19..6585d2f4 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -390,10 +390,7 @@ MxResult LegoGameState::Load(MxULong p_slot) if (count) { for (MxS16 i = 0; i < count; i++) { - MxS16 stateNameLength; - storage.Read(stateNameLength); - storage.Read(stateName, (MxULong) stateNameLength); - stateName[stateNameLength] = 0; + storage.Read(stateName); LegoState* state = GetState(stateName); if (!state) { diff --git a/LEGO1/lego/sources/misc/legostorage.h b/LEGO1/lego/sources/misc/legostorage.h index fa7f6ae4..f46c7a1f 100644 --- a/LEGO1/lego/sources/misc/legostorage.h +++ b/LEGO1/lego/sources/misc/legostorage.h @@ -155,6 +155,15 @@ class LegoFile : public LegoStorage { return this; } + LegoStorage* Read(char* p_data) + { + LegoS16 length; + Read(length); + Read(p_data, length); + p_data[length] = '\0'; + return this; + } + // FUNCTION: LEGO1 0x10034470 LegoStorage* Read(MxString& p_data) {