summary refs log tree commit diff stats
path: root/Source/PuzzlerSerializer.h
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2019-11-16 10:27:06 -0800
committerjbzdarkid <jbzdarkid@gmail.com>2019-11-16 10:27:06 -0800
commit0baa521ba34d2cd4e0f732f83d23b807605786a2 (patch)
treedfb01163d291ee846c7a5840ffc08e089a7fb8e6 /Source/PuzzlerSerializer.h
parent0d0abe2ee56382c5751dd12fbca75af87773879f (diff)
downloadwitness-tutorializer-0baa521ba34d2cd4e0f732f83d23b807605786a2.tar.gz
witness-tutorializer-0baa521ba34d2cd4e0f732f83d23b807605786a2.tar.bz2
witness-tutorializer-0baa521ba34d2cd4e0f732f83d23b807605786a2.zip
More and more progress.
Split out functions in serializer
Figured out how to allocate memory (for sequences)
Diffstat (limited to 'Source/PuzzlerSerializer.h')
-rw-r--r--Source/PuzzlerSerializer.h24
1 files changed, 20 insertions, 4 deletions
diff --git a/Source/PuzzlerSerializer.h b/Source/PuzzlerSerializer.h index 00c89f5..535d82f 100644 --- a/Source/PuzzlerSerializer.h +++ b/Source/PuzzlerSerializer.h
@@ -22,24 +22,40 @@ private:
22 DOT_IS_BLUE = 0x100, 22 DOT_IS_BLUE = 0x100,
23 DOT_IS_ORANGE = 0x200, 23 DOT_IS_ORANGE = 0x200,
24 DOT_IS_INVISIBLE = 0x1000, 24 DOT_IS_INVISIBLE = 0x1000,
25 HAS_ONE_CONN = 0x100000, 25 HAS_ONE_CONN = 0x100000,
26 HAS_VERTI_CONN = 0x200000, 26 HAS_VERTI_CONN = 0x200000,
27 HAS_HORIZ_CONN = 0x400000, 27 HAS_HORIZ_CONN = 0x400000,
28 }; 28 };
29 29
30 void ReadIntersections(Puzzle& p, int id); 30 void ReadIntersections(Puzzle& p);
31 void ReadExtras(Puzzle& p);
31 void ReadDecorations(Puzzle& p, int id); 32 void ReadDecorations(Puzzle& p, int id);
32 void WriteIntersections(const Puzzle& p, int id); 33 void ReadSequence(Puzzle& p, int id);
34
35 void WriteIntersections(const Puzzle& p);
36 void WriteDots(const Puzzle& p);
37 void WriteGaps(const Puzzle& p);
38 void WriteEndpoints(const Puzzle& p);
33 void WriteDecorations(const Puzzle& p, int id); 39 void WriteDecorations(const Puzzle& p, int id);
40 void WriteSequence(const Puzzle& p, int id);
34 41
35 std::tuple<int, int> loc_to_xy(const Puzzle& p, int location) const; 42 std::tuple<int, int> loc_to_xy(const Puzzle& p, int location) const;
36 int xy_to_loc(const Puzzle& p, int x, int y) const; 43 int xy_to_loc(const Puzzle& p, int x, int y) const;
37 // Decoration location 44 // Decoration location
38 std::tuple<int, int> dloc_to_xy(const Puzzle& p, int location) const; 45 std::tuple<int, int> dloc_to_xy(const Puzzle& p, int location) const;
39 int xy_to_dloc(const Puzzle& p, int x, int y) const; 46 int xy_to_dloc(const Puzzle& p, int x, int y) const;
47 // Grid coordinates
48 std::tuple<float, float> xy_to_pos(const Puzzle& p, int x, int y) const;
40 Cell::Dot FlagsToDot(int flags) const; 49 Cell::Dot FlagsToDot(int flags) const;
41 // Iterate connection lists for another location which is connected to us; return that other location. 50 // Iterate connection lists for another location which is connected to us; return that other location.
42 int FindConnection(int i, const std::vector<int>& connections_a, const std::vector<int>& connections_b) const; 51 int FindConnection(int location) const;
43 52
44 std::shared_ptr<Memory> _memory; 53 std::shared_ptr<Memory> _memory;
54
55 std::vector<float> _intersectionLocations;
56 std::vector<int> _intersectionFlags;
57 std::vector<int> _connectionsA;
58 std::vector<int> _connectionsB;
59
60 float MIN, MAX, WIDTH_INTERVAL, HEIGHT_INTERVAL, HORIZ_GAP_SIZE, VERTI_GAP_SIZE;
45}; 61};