From 1179690d23f734101f9f9942acfa4b65b78e9314 Mon Sep 17 00:00:00 2001 From: Mikhail Gorbushin Date: Tue, 4 Jun 2019 14:54:07 +0300 Subject: [PATCH] [generator] fix RestrictionWriter --- generator/restriction_writer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/generator/restriction_writer.cpp b/generator/restriction_writer.cpp index 191cfcb3e4..2359ccbdeb 100644 --- a/generator/restriction_writer.cpp +++ b/generator/restriction_writer.cpp @@ -170,10 +170,13 @@ void RestrictionWriter::CollectRelation(RelationElement const & relationElement) GetType(relationElement, via.back().first) == OsmElement::EntityType::Node ? ViaType::Node : ViaType::Way; - m_stream << DebugPrint(type) << "," << DebugPrint(viaType) << ","; + auto const printHeader = [&]() { + m_stream << DebugPrint(type) << "," << DebugPrint(viaType) << ","; + }; if (viaType == ViaType::Way) { + printHeader(); m_stream << fromOsmId << ","; for (auto const & viaMember : via) m_stream << viaMember.first << ","; @@ -186,6 +189,7 @@ void RestrictionWriter::CollectRelation(RelationElement const & relationElement) if (!m_cache.GetNode(viaNodeOsmId, y, x)) return; + printHeader(); m_stream << x << "," << y << ","; m_stream << fromOsmId << ","; }