From 7a13ef0a94f6ed4989677530b1b37e1af0692fc7 Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Mon, 18 Nov 2019 10:03:00 -0800 Subject: Done with most of tutorial --- Source/PuzzleSerializer.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Source/PuzzleSerializer.cpp') 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) : _mem Puzzle PuzzleSerializer::ReadPuzzle(int id) { int width = 2 * _memory->ReadEntityData(id, GRID_SIZE_X, 1)[0] - 1; int height = 2 * _memory->ReadEntityData(id, GRID_SIZE_Y, 1)[0] - 1; + if (width == 0) width = height; + if (height == 0) height = width; if (width < 0 || height < 0) return Puzzle(); // @Error: Grid size should be always positive? Looks like the starting panels break this rule, though. int numIntersections = _memory->ReadEntityData(id, NUM_DOTS, 1)[0]; -- cgit 1.4.1