Fix:osd_core:Use correct new value for routespeed
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Tue, 14 Apr 2009 18:43:50 +0000 (18:43 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Tue, 14 Apr 2009 18:43:50 +0000 (18:43 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit@2211 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit.c
navit/osd/core/osd_core.c
navit/vehicleprofile.c

index 8cfb875..5a51fa4 100644 (file)
@@ -709,6 +709,12 @@ navit_get_graphics(struct navit *this_)
        return this_->gra;
 }
 
+struct vehicleprofile *
+navit_get_vehicleprofile(struct navit *this_)
+{
+       return this_->vehicleprofile;
+}
+
 static void
 navit_projection_set(struct navit *this_, enum projection pro)
 {
index 8901d78..a73f5e5 100644 (file)
@@ -44,6 +44,8 @@
 #include "command.h"
 #include "navit_nls.h"
 #include "messages.h"
+#include "vehicleprofile.h"
+#include "roadprofile.h"
 #include "osd.h"
 
 struct compass {
@@ -760,7 +762,6 @@ osd_text_draw(struct osd_text *this, struct navit *navit, struct vehicle *v)
        struct map_rect *nav_mr = NULL;
        struct item *item;
        int offset,lines;
-       int *speedlist = NULL;
        int height=this->osd_item.font_size*13/256;
        int yspacing=height/2;
        int xspacing=height/4;
@@ -831,9 +832,13 @@ osd_text_draw(struct osd_text *this, struct navit *navit, struct vehicle *v)
                                                        value = format_speed(routespeed, "");
                                                } 
 
-                                               if ((routespeed == -1) && route && (speedlist=route_get_speedlist(route))) {
-                                                       if (item->type >= route_item_first && item->type <= route_item_last) {
-                                                               routespeed=speedlist[item->type-route_item_first];
+                                               if (routespeed == -1) {
+                                                       struct vehicleprofile *prof=navit_get_vehicleprofile(navit);
+                                                       struct roadprofile *rprof=NULL;
+                                                       if (prof)
+                                                               rprof=vehicleprofile_get_roadprofile(prof, item->type);
+                                                       if (rprof) {
+                                                               routespeed=rprof->speed;
                                                                value=format_speed(routespeed,"");
                                                        }
                                                }
index 650e6af..533d8bb 100644 (file)
@@ -105,7 +105,7 @@ vehicleprofile_remove_attr(struct vehicleprofile *this_, struct attr *attr)
        return 1;
 }
 
-struct roadprofile_data *
+struct roadprofile *
 vehicleprofile_get_roadprofile(struct vehicleprofile *this_, enum item_type type)
 {
        return g_hash_table_lookup(this_->roadprofile_hash, (void *)(long)type);