diff options
author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2013-03-10 20:23:59 +0000 |
---|---|---|
committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2013-03-10 20:23:59 +0000 |
commit | 1b97cd37c1edcdb41fd1f0fce8e3a9c90b743a13 (patch) | |
tree | f346333fb5d169950416ef0af2c376e8d1e6d8d8 /navit/vehicleprofile.c | |
parent | 2797500b314ee98970fde490f2de4fa761ccd28d (diff) | |
download | navit-1b97cd37c1edcdb41fd1f0fce8e3a9c90b743a13.tar.gz |
Add:Core:Further work on vehicleprofile_options
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5406 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/vehicleprofile.c')
-rw-r--r-- | navit/vehicleprofile.c | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/navit/vehicleprofile.c b/navit/vehicleprofile.c index a51ecb34f..6bfbfbbf4 100644 --- a/navit/vehicleprofile.c +++ b/navit/vehicleprofile.c @@ -25,6 +25,7 @@ #include "xmlconfig.h" #include "roadprofile.h" #include "vehicleprofile.h" +#include "callback.h" static void vehicleprofile_set_attr_do(struct vehicleprofile *this_, struct attr *attr) @@ -84,6 +85,27 @@ vehicleprofile_set_attr_do(struct vehicleprofile *this_, struct attr *attr) } } +static void +vehicleprofile_clear(struct vehicleprofile *this_) +{ + if (this_->roadprofile_hash) + g_hash_table_destroy(this_->roadprofile_hash); + this_->roadprofile_hash=g_hash_table_new(NULL, NULL); + this_->length=-1; + this_->width=-1; + this_->height=-1; + this_->weight=-1; + this_->axle_weight=-1; + this_->through_traffic_penalty=9000; +} + +static void +vehicleprofile_update(struct vehicleprofile *this_) +{ + dbg(0,"enter\n"); +} + + struct vehicleprofile * vehicleprofile_new(struct attr *parent, struct attr **attrs) { @@ -96,13 +118,9 @@ vehicleprofile_new(struct attr *parent, struct attr **attrs) this_->func=&vehicleprofile_func; navit_object_ref((struct navit_object *)this_); this_->attrs=attr_list_dup(attrs); - this_->roadprofile_hash=g_hash_table_new(NULL, NULL); - this_->length=-1; - this_->width=-1; - this_->height=-1; - this_->weight=-1; - this_->axle_weight=-1; - this_->through_traffic_penalty=9000; + this_->active_callback.type=attr_callback; + this_->active_callback.u.callback=callback_new_attr_1(callback_cast(vehicleprofile_update), attr_active, this_); + vehicleprofile_clear(this_); for (attr=attrs;*attr; attr++) vehicleprofile_set_attr_do(this_, *attr); return this_; @@ -111,7 +129,7 @@ vehicleprofile_new(struct attr *parent, struct attr **attrs) struct attr_iter * vehicleprofile_attr_iter_new(void) { - return g_new0(void *,1); + return (struct attr_iter *)g_new0(void *,1); } void @@ -154,6 +172,9 @@ vehicleprofile_add_attr(struct vehicleprofile *this_, struct attr *attr) } } break; + case attr_profile_option: + attr->u.navit_object->func->add_attr(attr->u.navit_object, &this_->active_callback); + break; default: break; } |