Skip to content

Commit 0e75bb8

Browse files
committed
Revert "please god, make these the final fixes. Perhaps this was a mistake :("
This reverts commit 8d3fdfd.
1 parent 8d3fdfd commit 0e75bb8

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

Source/Entities/MovableObject.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,9 @@ int MovableObject::Create(const MovableObject& reference) {
267267
m_ObjectValueMap = reference.m_ObjectValueMap;
268268

269269
// If we're currently performing a game save or load we want to persist our existing IDs
270-
if (g_MovableMan.ShouldPersistUniqueIDs() && reference.m_UniqueID != 0) {
271-
m_UniqueID = reference.m_UniqueID;
270+
if (g_MovableMan.ShouldPersistUniqueIDs()) {
271+
m_UniqueID = reference.m_UniqueID == 0 ? g_MovableMan.GetNextUniqueID() : reference.m_UniqueID;
272272
m_AgeTimer = reference.m_AgeTimer;
273-
const_cast<MovableObject&>(reference).m_UniqueID = 0; // fuck it, stop it deregistering us
274273
} else {
275274
// Otherwise we're copying from a preset normally and ought to create a new object
276275
m_UniqueID = g_MovableMan.GetNextUniqueID();

Source/Managers/ActivityMan.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ bool ActivityMan::SaveCurrentGame(const std::string& fileName) {
128128
}
129129
}
130130

131+
writer->NewPropertyWithValue("MaxUniqueID", currentMaxID);
132+
writer->NewPropertyWithValue("CurrentSimTicks", g_TimerMan.GetSimTickCount());
131133
writer->NewPropertyWithValue("OriginalScenePresetName", scene->GetPresetName());
132134
writer->NewPropertyWithValue("PlaceObjectsIfSceneIsRestarted", g_SceneMan.GetPlaceObjectsOnLoad());
133135
writer->NewPropertyWithValue("PlaceUnitsIfSceneIsRestarted", g_SceneMan.GetPlaceUnitsOnLoad());
134136
writer->NewPropertyWithValue("Scene", modifiableScene.get());
135-
writer->NewPropertyWithValue("MaxUniqueID", currentMaxID);
136-
writer->NewPropertyWithValue("CurrentSimTicks", g_TimerMan.GetSimTickCount());
137137

138138
auto saveWriterData = [](Writer* writerToSave) {
139139
writerToSave->EndWrite();
@@ -181,7 +181,11 @@ bool ActivityMan::LoadAndLaunchGame(const std::string& fileName) {
181181
bool placeUnitsIfSceneIsRestarted = true;
182182
while (reader.NextProperty()) {
183183
std::string propName = reader.ReadPropName();
184-
if (propName == "Activity") {
184+
if (propName == "MaxUniqueID") {
185+
reader >> maxUniqueID;
186+
} else if (propName == "CurrentSimTicks") {
187+
reader >> simTimeTicks;
188+
} else if (propName == "Activity") {
185189
reader >> activity.get();
186190
} else if (propName == "OriginalScenePresetName") {
187191
reader >> originalScenePresetName;
@@ -191,11 +195,7 @@ bool ActivityMan::LoadAndLaunchGame(const std::string& fileName) {
191195
reader >> placeUnitsIfSceneIsRestarted;
192196
} else if (propName == "Scene") {
193197
reader >> scene.get();
194-
} else if (propName == "MaxUniqueID") {
195-
reader >> maxUniqueID;
196-
} else if (propName == "CurrentSimTicks") {
197-
reader >> simTimeTicks;
198-
}
198+
}
199199
}
200200

201201
g_MovableMan.SetShouldPersistUniqueIDs(true);

0 commit comments

Comments
 (0)