From 0fccf5fd232aabe4be9a04f0259bb3c3f78a6147 Mon Sep 17 00:00:00 2001 From: Thomas Christlieb Date: Thu, 14 Oct 2021 13:21:08 +0200 Subject: [PATCH] make sure do not save more then 32 lightsources for compatibility reasons --- Source/loadsave.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index 38d2e11f647e..c07a5a2a8803 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -1937,11 +1937,14 @@ void SaveGameData() for (int i = 0; i < ActiveObjectCount; i++) SaveObject(file, Objects[ActiveObjects[i]]); - file.WriteBE(ActiveLightCount); + /* We can't save more then 32 lightsources for compatibility reasons */ + int saveLightSources = ActiveLightCount > 32 ? 32 : ActiveLightCount; + + file.WriteBE(saveLightSources); for (uint8_t lightId : ActiveLights) file.WriteLE(lightId); - for (int i = 0; i < ActiveLightCount; i++) + for (int i = 0; i < saveLightSources; i++) SaveLighting(&file, &Lights[ActiveLights[i]]); file.WriteBE(VisionId);