Skip to content

Commit 4b3f484

Browse files
committed
minor cleanup
1 parent c95cf6e commit 4b3f484

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

src/Misc/SavedGamesInSubdir.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ namespace SavedGames
185185
};
186186

187187

188-
template<typename T>
189-
bool AppendToStorage(IStorage* pStorage)
188+
template<typename T> requires std::is_trivially_copyable_v<T>
189+
bool WriteToStorage(IStorage* pStorage)
190190
{
191191
IStreamPtr pStream = nullptr;
192192
bool ret = false;
@@ -210,7 +210,7 @@ namespace SavedGames
210210
}
211211

212212

213-
template<typename T>
213+
template<typename T> requires std::is_trivially_copyable_v<T>
214214
std::optional<T> ReadFromStorage(IStorage* pStorage)
215215
{
216216
IStreamPtr pStream = nullptr;
@@ -223,7 +223,7 @@ namespace SavedGames
223223
&pStream
224224
);
225225

226-
T info;
226+
T info {};
227227

228228
if (SUCCEEDED(hr) && pStream != nullptr)
229229
{
@@ -280,10 +280,10 @@ DEFINE_HOOK(0x67D2E3, SaveGame_AdditionalInfoForClient, 0x6)
280280
GET_STACK(IStorage*, pStorage, STACK_OFFSET(0x4A0, -0x490));
281281
using namespace SavedGames;
282282

283-
if (pStorage)
283+
if (pStorage && SessionClass::IsCampaign())
284284
{
285-
if (SessionClass::IsCampaign() && Spawner::GetConfig()->CustomMissionID)
286-
AppendToStorage<CustomMissionID>(pStorage);
285+
if (Spawner::GetConfig()->CustomMissionID)
286+
WriteToStorage<CustomMissionID>(pStorage);
287287
}
288288

289289
return 0;
@@ -304,7 +304,7 @@ DEFINE_HOOK(0x67E4DC, LoadGame_AdditionalInfoForClient, 0x7)
304304
if (auto id = ReadFromStorage<CustomMissionID>(pStorage))
305305
{
306306
int num = id->Number;
307-
Debug::Log("[Spawner] sav file CustomMissionID = %d\n", num);
307+
Debug::Log("sav file CustomMissionID = %d\n", num);
308308
Spawner::GetConfig()->CustomMissionID = num;
309309
ScenarioClass::Instance->EndOfGame = true;
310310
}

src/Spawner/Spawner.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "ProtocolZero.LatencyLevel.h"
2525
#include <Utilities/Debug.h>
2626
#include <Utilities/DumperTypes.h>
27-
#include <Utilities/Patch.h>
2827

2928
#include <GameOptionsClass.h>
3029
#include <GameStrings.h>

0 commit comments

Comments
 (0)