From 8a9802605c1e305fd0e1b6796b8daf766d400ea8 Mon Sep 17 00:00:00 2001 From: Sergi Hernandez Juan <shernand@iri.upc.edu> Date: Fri, 8 Jan 2021 15:19:31 +0100 Subject: [PATCH] Improved the update_references() function. --- include/opendrive_object.h | 2 +- src/opendrive_object.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/opendrive_object.h b/include/opendrive_object.h index 930ed4d..8d2ea20 100644 --- a/include/opendrive_object.h +++ b/include/opendrive_object.h @@ -54,7 +54,7 @@ class COpendriveObject double scale_factor; protected: void load(objects::object_type &object_info,COpendriveRoadSegment *segment); - void update_references(std::map<COpendriveRoadSegment *,COpendriveRoadSegment *> &segment_refs); + void update_references(segment_up_ref_t &segment_refs); void set_scale_factor(double scale); public: COpendriveObject(); diff --git a/src/opendrive_object.cpp b/src/opendrive_object.cpp index 28ac474..786ee2a 100644 --- a/src/opendrive_object.cpp +++ b/src/opendrive_object.cpp @@ -108,9 +108,10 @@ void COpendriveObject::load(objects::object_type &object_info,COpendriveRoadSegm this->segment=segment; } -void COpendriveObject::update_references(std::map<COpendriveRoadSegment *,COpendriveRoadSegment *> &segment_refs) +void COpendriveObject::update_references(segment_up_ref_t &segment_refs) { - this->segment=segment_refs[this->segment]; + if(segment_refs.find(this->segment)!=segment_refs.end()) + this->segment=segment_refs[this->segment]; } void COpendriveObject::set_scale_factor(double scale) -- GitLab