From 3e571db922a1072d1e02da82e97dbe17e3d51122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Wed, 26 Feb 2025 08:52:24 +0100 Subject: [PATCH] Check cell count for being at most 255 when saving Not important for vanilla but it might surprise modders when their saves get truncated. Better than a static_assert on CELLS because that's further upstream, and mods might like to be able to work even if they can't save. --- src/client/GameSave.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/client/GameSave.cpp b/src/client/GameSave.cpp index a3187ba48..de923a8bb 100644 --- a/src/client/GameSave.cpp +++ b/src/client/GameSave.cpp @@ -2012,6 +2012,11 @@ void GameSave::readPSv(const std::vector &dataVec) std::pair> GameSave::serialiseOPS() const { + if (blockSize.X > 255 || blockSize.Y > 255) + { + throw BuildException("simulation size not supported by the save format"); + } + // minimum version this save is compatible with // when building, this number may be increased depending on what elements are used // or what properties are detected