summaryrefslogtreecommitdiff
path: root/navit/roadprofile.c
diff options
context:
space:
mode:
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2009-04-12 06:37:36 +0000
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2009-04-12 06:37:36 +0000
commite474f8b91608e8aa23c5e5d0297e9fc0f2bd0828 (patch)
treed374b97c40b326ee01496587ed46f99b2c4f4e58 /navit/roadprofile.c
parent9ecdf6aec3d0fea7b84dc1cb38b81414a7c617db (diff)
downloadnavit-e474f8b91608e8aa23c5e5d0297e9fc0f2bd0828.tar.gz
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
Diffstat (limited to 'navit/roadprofile.c')
-rw-r--r--navit/roadprofile.c22
1 files changed, 18 insertions, 4 deletions
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;
}