summary refs log tree commit diff stats
path: root/Source/PuzzleSerializer.cpp
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2019-11-25 21:10:50 -0800
committerjbzdarkid <jbzdarkid@gmail.com>2019-11-25 21:10:50 -0800
commitac83733b590f3c0750bea1de3556ceb24fa0a4b1 (patch)
tree74aa45ca76603f23c027478af4c2c5aa09eab11e /Source/PuzzleSerializer.cpp
parente10243a64e0c6542c9b74c3bb95f5ebf4a3df7cb (diff)
downloadwitness-tutorializer-ac83733b590f3c0750bea1de3556ceb24fa0a4b1.tar.gz
witness-tutorializer-ac83733b590f3c0750bea1de3556ceb24fa0a4b1.tar.bz2
witness-tutorializer-ac83733b590f3c0750bea1de3556ceb24fa0a4b1.zip
Using PCH to clean up includes
Diffstat (limited to 'Source/PuzzleSerializer.cpp')
-rw-r--r--Source/PuzzleSerializer.cpp16
1 files changed, 1 insertions, 15 deletions
diff --git a/Source/PuzzleSerializer.cpp b/Source/PuzzleSerializer.cpp index 7461f7b..33f6da6 100644 --- a/Source/PuzzleSerializer.cpp +++ b/Source/PuzzleSerializer.cpp
@@ -1,6 +1,6 @@
1#include "pch.h"
1#include "PuzzleSerializer.h" 2#include "PuzzleSerializer.h"
2#include "Memory.h" 3#include "Memory.h"
3#include <cassert>
4 4
5#pragma warning (disable:26451) 5#pragma warning (disable:26451)
6#pragma warning (disable:26812) 6#pragma warning (disable:26812)
@@ -65,16 +65,6 @@ void PuzzleSerializer::WritePuzzle(const Puzzle& p, int id) {
65 WriteSequence(p, id); 65 WriteSequence(p, id);
66 WriteSymmetry(p, id); 66 WriteSymmetry(p, id);
67 67
68#ifndef NDEBUG
69 int maxDots = _memory->ReadEntityData<int>(id, NUM_DOTS, 1)[0];
70 assert(_intersectionFlags.size() <= maxDots);
71 assert(_intersectionLocations.size() <= maxDots*2);
72
73 int maxConnections = _memory->ReadEntityData<int>(id, NUM_CONNECTIONS, 1)[0];
74 assert(_connectionsA.size() <= maxConnections);
75 assert(_connectionsB.size() <= maxConnections);
76#endif
77
78 _memory->WriteEntityData<int>(id, GRID_SIZE_X, {(p.width + 1)/2}); 68 _memory->WriteEntityData<int>(id, GRID_SIZE_X, {(p.width + 1)/2});
79 _memory->WriteEntityData<int>(id, GRID_SIZE_Y, {(p.height + 1)/2}); 69 _memory->WriteEntityData<int>(id, GRID_SIZE_Y, {(p.height + 1)/2});
80 _memory->WriteEntityData<int>(id, NUM_DOTS, {static_cast<int>(_intersectionFlags.size())}); 70 _memory->WriteEntityData<int>(id, NUM_DOTS, {static_cast<int>(_intersectionFlags.size())});
@@ -455,10 +445,6 @@ void PuzzleSerializer::WriteDecorations(const Puzzle& p, int id) {
455 } 445 }
456 } 446 }
457 447
458#ifndef NDEBUG
459 int maxDecorations = _memory->ReadEntityData<int>(id, NUM_DECORATIONS, 1)[0];
460 assert(decorations.size() < maxDecorations);
461#endif
462 _memory->WriteEntityData<int>(id, NUM_DECORATIONS, {static_cast<int>(decorations.size())}); 448 _memory->WriteEntityData<int>(id, NUM_DECORATIONS, {static_cast<int>(decorations.size())});
463 _memory->WriteArray<int>(id, DECORATIONS, decorations); 449 _memory->WriteArray<int>(id, DECORATIONS, decorations);
464} 450}