about summary refs log tree commit diff stats
path: root/Source/PuzzleSerializer.cpp
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2019-11-18 10:03:00 -0800
committerjbzdarkid <jbzdarkid@gmail.com>2019-11-18 10:03:00 -0800
commit7a13ef0a94f6ed4989677530b1b37e1af0692fc7 (patch)
treec3be1b561d426b076c2e620cfcaf8def81e84228 /Source/PuzzleSerializer.cpp
parentc282663a96ae9704a59c55c9300dbc8c49e0ef39 (diff)
downloadwitness-tutorializer-7a13ef0a94f6ed4989677530b1b37e1af0692fc7.tar.gz
witness-tutorializer-7a13ef0a94f6ed4989677530b1b37e1af0692fc7.tar.bz2
witness-tutorializer-7a13ef0a94f6ed4989677530b1b37e1af0692fc7.zip
Done with most of tutorial
Diffstat (limited to 'Source/PuzzleSerializer.cpp')
-rw-r--r--Source/PuzzleSerializer.cpp2
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
10Puzzle PuzzleSerializer::ReadPuzzle(int id) { 10Puzzle 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];