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
commit9e4213708266f9d3a4a4167fc4c16a52c38a2eda (patch)
treed374b97c40b326ee01496587ed46f99b2c4f4e58 /navit/roadprofile.c
parent52b69352f4537bf9a9a191e56032360cd534b58a (diff)
downloadnavit-svn-9e4213708266f9d3a4a4167fc4c16a52c38a2eda.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 a3ce77cb..07c29299 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;
}