From fb56735fbd2c3f54554741a643eb7df873b061a7 Mon Sep 17 00:00:00 2001 From: MishaProductions <106913236+MishaProductions@users.noreply.github.com> Date: Mon, 3 Jul 2023 20:25:37 +0300 Subject: [PATCH] [lego] Implement LegoGameState::SetSavepath (#76) * SetSavePath 100% match * fix naming convention --- LEGO1/legogamestate.cpp | 17 +++++++++++++++-- LEGO1/legogamestate.h | 3 +++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/LEGO1/legogamestate.cpp b/LEGO1/legogamestate.cpp index c12a5e06..344cf1ca 100644 --- a/LEGO1/legogamestate.cpp +++ b/LEGO1/legogamestate.cpp @@ -1,4 +1,5 @@ #include "legogamestate.h" +#include "legoomni.h" // OFFSET: LEGO1 0x10039550 LegoGameState::LegoGameState() @@ -39,7 +40,19 @@ void LegoGameState::SerializeScoreHistory(MxS16 p) } // OFFSET: LEGO1 0x10039f00 -void LegoGameState::SetSavePath(char *p) +void LegoGameState::SetSavePath(char *p_savePath) { - // TODO + if (m_savePath != NULL) + { + delete[] m_savePath; + } + if (p_savePath) + { + m_savePath = new char[strlen(p_savePath) + 1]; + strcpy(m_savePath, p_savePath); + } + else + { + m_savePath = NULL; + } } diff --git a/LEGO1/legogamestate.h b/LEGO1/legogamestate.h index 80437051..ef2eeb1e 100644 --- a/LEGO1/legogamestate.h +++ b/LEGO1/legogamestate.h @@ -13,6 +13,9 @@ class LegoGameState __declspec(dllexport) void SerializePlayersInfo(MxS16 p); __declspec(dllexport) void SerializeScoreHistory(MxS16 p); __declspec(dllexport) void SetSavePath(char *p); + +private: + char *m_savePath; }; #endif // LEGOGAMESTATE_H