From e474f8b91608e8aa23c5e5d0297e9fc0f2bd0828 Mon Sep 17 00:00:00 2001 From: martin-s Date: Sun, 12 Apr 2009 06:37:36 +0000 Subject: Fix:Core:Made routing more flexible git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@2203 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/roadprofile.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'navit/roadprofile.c') diff --git a/navit/roadprofile.c b/navit/roadprofile.c index a3ce77cb0..07c292995 100644 --- a/navit/roadprofile.c +++ b/navit/roadprofile.c @@ -22,17 +22,30 @@ #include "item.h" #include "roadprofile.h" -struct roadprofile { - struct attr **attrs; -}; +static void +roadprofile_set_attr_do(struct roadprofile *this, struct attr *attr) +{ + switch (attr->type) { + case attr_speed: + this->speed=attr->u.num; + break; + case attr_route_weight: + this->route_weight=attr->u.num; + break; + default: + break; + } +} struct roadprofile * roadprofile_new(struct attr *parent, struct attr **attrs) { struct roadprofile *this_; - struct attr *type_attr; + struct attr **attr; this_=g_new0(struct roadprofile, 1); this_->attrs=attr_list_dup(attrs); + for (attr=attrs;*attr; attr++) + roadprofile_set_attr_do(this_, *attr); return this_; } @@ -45,6 +58,7 @@ roadprofile_get_attr(struct roadprofile *this_, enum attr_type type, struct attr int roadprofile_set_attr(struct roadprofile *this_, struct attr *attr) { + roadprofile_set_attr_do(this_, attr); this_->attrs=attr_generic_set_attr(this_->attrs, attr); return 1; } -- cgit v1.2.1