forked from organicmaps/organicmaps
PR fixes.
This commit is contained in:
parent
4f75a3cd63
commit
f35e9c04e7
2 changed files with 10 additions and 6 deletions
|
@ -55,6 +55,9 @@ RoutingMapping::RoutingMapping(string const & countryFile, MwmSet * pIndex)
|
|||
m_error(IRouter::ResultCode::RouteFileNotExist),
|
||||
m_pIndex(pIndex)
|
||||
{
|
||||
if (m_pIndex == 0)
|
||||
return;
|
||||
|
||||
m_handle = pIndex->GetMwmHandleByCountryFile(CountryFile(countryFile));
|
||||
if (!m_handle.IsAlive())
|
||||
return;
|
||||
|
@ -80,7 +83,7 @@ RoutingMapping::RoutingMapping(string const & countryFile, MwmSet * pIndex)
|
|||
m_error = IRouter::ResultCode::NoError;
|
||||
}
|
||||
|
||||
void RoutingMapping::LoadFileIfNeed()
|
||||
void RoutingMapping::LoadFileIfNeeded()
|
||||
{
|
||||
if (!m_handle.IsAlive() && m_mwmId.IsAlive() && m_pIndex)
|
||||
m_handle = m_pIndex->GetMwmHandleById(m_mwmId);
|
||||
|
@ -102,7 +105,7 @@ RoutingMapping::~RoutingMapping()
|
|||
|
||||
void RoutingMapping::Map()
|
||||
{
|
||||
LoadFileIfNeed();
|
||||
LoadFileIfNeeded();
|
||||
++m_mapCounter;
|
||||
if (!m_segMapping.IsMapped())
|
||||
{
|
||||
|
@ -123,7 +126,7 @@ void RoutingMapping::LoadFacade()
|
|||
{
|
||||
if (!m_facadeCounter)
|
||||
{
|
||||
LoadFileIfNeed();
|
||||
LoadFileIfNeeded();
|
||||
m_dataFacade.Load(m_container);
|
||||
}
|
||||
++m_facadeCounter;
|
||||
|
@ -144,7 +147,7 @@ void RoutingMapping::LoadCrossContext()
|
|||
if (m_crossContextLoaded)
|
||||
return;
|
||||
|
||||
LoadFileIfNeed();
|
||||
LoadFileIfNeeded();
|
||||
|
||||
if (m_container.IsExist(ROUTING_CROSS_CONTEXT_TAG))
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ struct RoutingMapping
|
|||
|
||||
/// Default constructor to create invalid instance for existing client code.
|
||||
/// @postcondition IsValid() == false.
|
||||
RoutingMapping() = default;
|
||||
RoutingMapping() : m_pIndex(nullptr) {}
|
||||
/// @param countryFile Country file name without extension.
|
||||
RoutingMapping(string const & countryFile, MwmSet * pIndex);
|
||||
~RoutingMapping();
|
||||
|
@ -56,7 +56,7 @@ struct RoutingMapping
|
|||
void FreeFileIfPossible();
|
||||
|
||||
private:
|
||||
void LoadFileIfNeed();
|
||||
void LoadFileIfNeeded();
|
||||
|
||||
size_t m_mapCounter;
|
||||
size_t m_facadeCounter;
|
||||
|
@ -65,6 +65,7 @@ private:
|
|||
FilesMappingContainer m_container;
|
||||
IRouter::ResultCode m_error;
|
||||
MwmSet::MwmHandle m_handle;
|
||||
// We save a mwmId for possibility to unlock a mwm file by rewriting m_handle.
|
||||
Index::MwmId m_mwmId;
|
||||
MwmSet * m_pIndex;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue