Implements Exit Numbers + Names (junction:ref way tag for now)

This commit is contained in:
Daniel J. Hofmann
2017-06-29 22:12:25 +02:00
committed by Patrick Niklaus
parent 6d78c11fd2
commit 7d900e3b5a
27 changed files with 160 additions and 30 deletions
+13 -5
View File
@@ -37,7 +37,7 @@ StringView NameTable::GetNameForID(const NameID id) const
if (id == INVALID_NAMEID)
return {};
return m_name_table.at(id);
return m_name_table.at(id + 0);
}
StringView NameTable::GetDestinationsForID(const NameID id) const
@@ -48,6 +48,14 @@ StringView NameTable::GetDestinationsForID(const NameID id) const
return m_name_table.at(id + 1);
}
StringView NameTable::GetExitsForID(const NameID id) const
{
if (id == INVALID_NAMEID)
return {};
return m_name_table.at(id + 4);
}
StringView NameTable::GetRefForID(const NameID id) const
{
if (id == INVALID_NAMEID)
@@ -55,14 +63,14 @@ StringView NameTable::GetRefForID(const NameID id) const
// Way string data is stored in blocks based on `id` as follows:
//
// | name | destination | pronunciation | ref |
// | name | destination | pronunciation | ref | exits
// ^ ^
// [range)
// ^ id + 3
//
// `id + offset` gives us the range of chars.
//
// Offset 0 is name, 1 is destination, 2 is pronunciation, 3 is ref.
// Offset 0 is name, 1 is destination, 2 is pronunciation, 3 is ref, 4 is exits
// See datafacades and extractor callbacks for details.
const constexpr auto OFFSET_REF = 3u;
return m_name_table.at(id + OFFSET_REF);
@@ -75,14 +83,14 @@ StringView NameTable::GetPronunciationForID(const NameID id) const
// Way string data is stored in blocks based on `id` as follows:
//
// | name | destination | pronunciation | ref |
// | name | destination | pronunciation | ref | exits
// ^ ^
// [range)
// ^ id + 2
//
// `id + offset` gives us the range of chars.
//
// Offset 0 is name, 1 is destination, 2 is pronunciation, 3 is ref.
// Offset 0 is name, 1 is destination, 2 is pronunciation, 3 is ref, 4 is exits
// See datafacades and extractor callbacks for details.
const constexpr auto OFFSET_PRONUNCIATION = 2u;
return m_name_table.at(id + OFFSET_PRONUNCIATION);