diff --git a/routing_common/bicycle_model.cpp b/routing_common/bicycle_model.cpp index 941a955fb9..a59b7d2577 100644 --- a/routing_common/bicycle_model.cpp +++ b/routing_common/bicycle_model.cpp @@ -413,8 +413,8 @@ void BicycleModel::Init() { initializer_list hwtagYesBicycle = {"hwtag", "yesbicycle"}; - m_yesBicycleType = classif().GetTypeByPath(hwtagYesBicycle); m_noBicycleType = classif().GetTypeByPath({"hwtag", "nobicycle"}); + m_yesBicycleType = classif().GetTypeByPath(hwtagYesBicycle); m_bidirBicycleType = classif().GetTypeByPath({"hwtag", "bidir_bicycle"}); vector const additionalTags = { diff --git a/routing_common/car_model.cpp b/routing_common/car_model.cpp index b3a079623b..668acaabc1 100644 --- a/routing_common/car_model.cpp +++ b/routing_common/car_model.cpp @@ -2,6 +2,7 @@ #include "routing_common/car_model_coefs.hpp" #include "indexer/classificator.hpp" +#include "indexer/feature.hpp" #include "base/macros.hpp" @@ -199,22 +200,36 @@ CarModel::CarModel() : VehicleModel(classif(), kCarOptionsDefault, kCarSurface, {kGlobalHighwayBasedMeanSpeeds, kGlobalHighwayBasedFactors}) { - InitAdditionalRoadTypes(); + Init(); } CarModel::CarModel(VehicleModel::LimitsInitList const & roadLimits, HighwayBasedInfo const & info) : VehicleModel(classif(), roadLimits, kCarSurface, info) { - InitAdditionalRoadTypes(); + Init(); } double CarModel::GetOffroadSpeed() const { return kSpeedOffroadKMpH; } -void CarModel::InitAdditionalRoadTypes() +void CarModel::Init() { + m_noCarType = classif().GetTypeByPath({"hwtag", "nocar"}); + m_yesCarType = classif().GetTypeByPath({"hwtag", "yescar"}); + SetAdditionalRoadTypes(classif(), kAdditionalTags); } +VehicleModelInterface::RoadAvailability CarModel::GetRoadAvailability(feature::TypesHolder const & types) const +{ + if (types.Has(m_yesCarType)) + return RoadAvailability::Available; + + if (types.Has(m_noCarType)) + return RoadAvailability::NotAvailable; + + return RoadAvailability::Unknown; +} + // static CarModel const & CarModel::AllLimitsInstance() { diff --git a/routing_common/car_model.hpp b/routing_common/car_model.hpp index d72b4410fa..ba0a307b0f 100644 --- a/routing_common/car_model.hpp +++ b/routing_common/car_model.hpp @@ -21,8 +21,14 @@ public: static std::vector const & GetAdditionalTags(); static VehicleModel::SurfaceInitList const & GetSurfaces(); +protected: + RoadAvailability GetRoadAvailability(feature::TypesHolder const & types) const override; + private: - void InitAdditionalRoadTypes(); + void Init(); + + uint32_t m_noCarType = 0; + uint32_t m_yesCarType = 0; }; class CarModelFactory : public VehicleModelFactory