From 7620d419c61f617ef4226cab41175e5c7beafefa Mon Sep 17 00:00:00 2001 From: Moritz Kobitzsch Date: Tue, 1 Aug 2017 11:06:05 +0200 Subject: [PATCH] fix serialisation of conditional turn restrictions --- include/extractor/serialization.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/extractor/serialization.hpp b/include/extractor/serialization.hpp index e1fbce8bd..7a8274231 100644 --- a/include/extractor/serialization.hpp +++ b/include/extractor/serialization.hpp @@ -166,7 +166,9 @@ inline void write(storage::io::FileWriter &writer, const WayRestriction &restric inline void read(storage::io::FileReader &reader, TurnRestriction &restriction) { reader.ReadInto(restriction.is_only); - if (restriction.Type() == RestrictionType::WAY_RESTRICTION) + std::uint32_t restriction_type; + reader.ReadInto(restriction_type); + if (restriction_type == RestrictionType::WAY_RESTRICTION) { WayRestriction way_restriction; read(reader, way_restriction); @@ -174,7 +176,7 @@ inline void read(storage::io::FileReader &reader, TurnRestriction &restriction) } else { - BOOST_ASSERT(restriction.Type() == RestrictionType::NODE_RESTRICTION); + BOOST_ASSERT(restriction_type == RestrictionType::NODE_RESTRICTION); NodeRestriction node_restriction; read(reader, node_restriction); restriction.node_or_way = std::move(node_restriction); @@ -184,6 +186,8 @@ inline void read(storage::io::FileReader &reader, TurnRestriction &restriction) inline void write(storage::io::FileWriter &writer, const TurnRestriction &restriction) { writer.WriteOne(restriction.is_only); + const std::uint32_t restriction_type = restriction.Type(); + writer.WriteOne(restriction_type); if (restriction.Type() == RestrictionType::WAY_RESTRICTION) { write(writer, mapbox::util::get(restriction.node_or_way));