From 0baa521ba34d2cd4e0f732f83d23b807605786a2 Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Sat, 16 Nov 2019 10:27:06 -0800 Subject: More and more progress. Split out functions in serializer Figured out how to allocate memory (for sequences) --- Source/PuzzlerSerializer.h | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'Source/PuzzlerSerializer.h') 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: DOT_IS_BLUE = 0x100, DOT_IS_ORANGE = 0x200, DOT_IS_INVISIBLE = 0x1000, - HAS_ONE_CONN = 0x100000, + HAS_ONE_CONN = 0x100000, HAS_VERTI_CONN = 0x200000, HAS_HORIZ_CONN = 0x400000, }; - void ReadIntersections(Puzzle& p, int id); + void ReadIntersections(Puzzle& p); + void ReadExtras(Puzzle& p); void ReadDecorations(Puzzle& p, int id); - void WriteIntersections(const Puzzle& p, int id); + void ReadSequence(Puzzle& p, int id); + + void WriteIntersections(const Puzzle& p); + void WriteDots(const Puzzle& p); + void WriteGaps(const Puzzle& p); + void WriteEndpoints(const Puzzle& p); void WriteDecorations(const Puzzle& p, int id); + void WriteSequence(const Puzzle& p, int id); std::tuple loc_to_xy(const Puzzle& p, int location) const; int xy_to_loc(const Puzzle& p, int x, int y) const; // Decoration location std::tuple dloc_to_xy(const Puzzle& p, int location) const; int xy_to_dloc(const Puzzle& p, int x, int y) const; + // Grid coordinates + std::tuple xy_to_pos(const Puzzle& p, int x, int y) const; Cell::Dot FlagsToDot(int flags) const; // Iterate connection lists for another location which is connected to us; return that other location. - int FindConnection(int i, const std::vector& connections_a, const std::vector& connections_b) const; + int FindConnection(int location) const; std::shared_ptr _memory; + + std::vector _intersectionLocations; + std::vector _intersectionFlags; + std::vector _connectionsA; + std::vector _connectionsB; + + float MIN, MAX, WIDTH_INTERVAL, HEIGHT_INTERVAL, HORIZ_GAP_SIZE, VERTI_GAP_SIZE; }; -- cgit 1.4.1