diff options
Diffstat (limited to 'Source/PuzzleSerializer.cpp')
-rw-r--r-- | Source/PuzzleSerializer.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Source/PuzzleSerializer.cpp b/Source/PuzzleSerializer.cpp index e845578..5c91b56 100644 --- a/Source/PuzzleSerializer.cpp +++ b/Source/PuzzleSerializer.cpp | |||
@@ -10,6 +10,8 @@ PuzzleSerializer::PuzzleSerializer(const std::shared_ptr<Memory>& memory) : _mem | |||
10 | Puzzle PuzzleSerializer::ReadPuzzle(int id) { | 10 | Puzzle PuzzleSerializer::ReadPuzzle(int id) { |
11 | int width = 2 * _memory->ReadEntityData<int>(id, GRID_SIZE_X, 1)[0] - 1; | 11 | int width = 2 * _memory->ReadEntityData<int>(id, GRID_SIZE_X, 1)[0] - 1; |
12 | int height = 2 * _memory->ReadEntityData<int>(id, GRID_SIZE_Y, 1)[0] - 1; | 12 | int height = 2 * _memory->ReadEntityData<int>(id, GRID_SIZE_Y, 1)[0] - 1; |
13 | if (width == 0) width = height; | ||
14 | if (height == 0) height = width; | ||
13 | if (width < 0 || height < 0) return Puzzle(); // @Error: Grid size should be always positive? Looks like the starting panels break this rule, though. | 15 | if (width < 0 || height < 0) return Puzzle(); // @Error: Grid size should be always positive? Looks like the starting panels break this rule, though. |
14 | 16 | ||
15 | int numIntersections = _memory->ReadEntityData<int>(id, NUM_DOTS, 1)[0]; | 17 | int numIntersections = _memory->ReadEntityData<int>(id, NUM_DOTS, 1)[0]; |