Skip to content

Commit

Permalink
make sure do not save more then 32 lightsources for compatibility rea…
Browse files Browse the repository at this point in the history
…sons
  • Loading branch information
ThomasChr committed Oct 14, 2021
1 parent d29a32d commit 0fccf5f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Source/loadsave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1937,11 +1937,14 @@ void SaveGameData()
for (int i = 0; i < ActiveObjectCount; i++)
SaveObject(file, Objects[ActiveObjects[i]]);

file.WriteBE<int32_t>(ActiveLightCount);
/* We can't save more then 32 lightsources for compatibility reasons */
int saveLightSources = ActiveLightCount > 32 ? 32 : ActiveLightCount;

file.WriteBE<int32_t>(saveLightSources);

for (uint8_t lightId : ActiveLights)
file.WriteLE<uint8_t>(lightId);
for (int i = 0; i < ActiveLightCount; i++)
for (int i = 0; i < saveLightSources; i++)
SaveLighting(&file, &Lights[ActiveLights[i]]);

file.WriteBE<int32_t>(VisionId);
Expand Down

0 comments on commit 0fccf5f

Please sign in to comment.