Ticket #1274: 0411.diff

File 0411.diff, 6.6 KB (added by jandegr, 6 years ago)
  • navit/navit/navigation.c

     
    4848
    4949
    5050struct suffix {
     51        enum gender {unknown, male, female, neutral};
    5152        char *fullname;
    5253        char *abbrev;
    5354        int sex;
    5455} suffixes[]= {
    55         {"weg",NULL,1},
    56         {"platz","pl.",1},
    57         {"ring",NULL,1},
    58         {"allee",NULL,2},
    59         {"gasse",NULL,2},
    60         {"straße","str.",2},
    61         {"strasse",NULL,2},
     56        {"weg",NULL,male},
     57        {"platz","pl.",male},
     58        {"ring",NULL,male},
     59        {"allee",NULL,female},
     60        {"gasse",NULL,female},
     61        {"straße","str.",female},
     62
     63        /* some for the dutch lang. */
     64        {"straat",NULL,neutral},
     65        {"weg",NULL,neutral},
     66        {"baan",NULL,neutral},
     67        {"laan",NULL,neutral},
     68        {"wegel",NULL,neutral},
     69
     70        /* some for the french lang. */
     71        {"boulevard",NULL,male},
     72        {"avenue",NULL,female},
     73        {"chemin",NULL,neutral},
     74        {"rue",NULL,female},
    6275};
    6376
    6477struct navigation {
     
    323336        switch (n) {
    324337        case 0:
    325338                /* TRANSLATORS: the following counts refer to streets */
    326                 return _("zeroth"); // Not sure if this exists, neither if it will ever be needed
     339                return _("zeroth"); /* Not sure if this exists, neither if it will ever be needed */
    327340        case 1:
    328341                return _("first");
    329342        case 2:
     
    347360        switch (n) {
    348361        case 0:
    349362                /* TRANSLATORS: the following counts refer to roundabout exits */
    350                 return _("zeroth exit"); // Not sure if this exists, neither if it will ever be needed
     363                return _("zeroth exit"); /* Not sure if this exists, neither if it will ever be needed */
    351364        case 1:
    352365                return _("first exit");
    353366        case 2:
     
    514527calculate_angle(struct navigation_way *w)
    515528{
    516529        struct coord cbuf[2];
    517         struct item *ritem; // the "real" item
     530        struct item *ritem; /* the "real" item */
    518531        struct coord c;
    519532        struct map_rect *mr;
    520533        struct attr attr;
     
    645658navigation_itm_ways_update(struct navigation_itm *itm, struct map *graph_map)
    646659{
    647660        struct map_selection coord_sel;
    648         struct map_rect *g_rect; // Contains a map rectangle from the route graph's map
     661        struct map_rect *g_rect; /* Contains a map rectangle from the route graph's map */
    649662        struct item *i,*sitem;
    650663        struct attr sitem_attr,direction_attr;
    651664        struct navigation_way *w,*l;
     
    652665
    653666        navigation_itm_ways_clear(itm);
    654667
    655         // These values cause the code in route.c to get us only the route graph point and connected segments
     668        /* These values cause the code in route.c to get us only the route graph point and connected segments */
    656669        coord_sel.next = NULL;
    657670        coord_sel.u.c_rect.lu = itm->start;
    658671        coord_sel.u.c_rect.rl = itm->start;
    659         // the selection's order is ignored
     672        /* the selection's order is ignored */
    660673       
    661674        g_rect = map_rect_new(graph_map, &coord_sel);
    662675       
    663676        i = map_rect_get_item(g_rect);
    664         if (!i || i->type != type_rg_point) { // probably offroad?
     677        if (!i || i->type != type_rg_point) { /* probably offroad? */
    665678                map_rect_destroy(g_rect);
    666679                return ;
    667680        }
     
    778791check_roundabout(struct navigation_itm *itm, struct map *graph_map)
    779792{
    780793        struct map_selection coord_sel;
    781         struct map_rect *g_rect; // Contains a map rectangle from the route graph's map
     794        struct map_rect *g_rect; /* Contains a map rectangle from the route graph's map */
    782795        struct item *i,*sitem;
    783796        struct attr sitem_attr,flags_attr;
    784797
    785         // These values cause the code in route.c to get us only the route graph point and connected segments
     798        /* These values cause the code in route.c to get us only the route graph point and connected segments */
    786799        coord_sel.next = NULL;
    787800        coord_sel.u.c_rect.lu = itm->start;
    788801        coord_sel.u.c_rect.rl = itm->start;
    789         // the selection's order is ignored
     802        /* the selection's order is ignored */
    790803       
    791804        g_rect = map_rect_new(graph_map, &coord_sel);
    792805       
    793806        i = map_rect_get_item(g_rect);
    794         if (!i || i->type != type_rg_point) { // probably offroad?
     807        if (!i || i->type != type_rg_point) { /* probably offroad? */
    795808                map_rect_destroy(g_rect);
    796809                return 0;
    797810        }
     
    952965                curr = curr->next;
    953966        }
    954967
    955         if (!curr) { // from does not lead to to?
     968        if (!curr) { /* from does not lead to to? */
    956969                return -1;
    957970        }
    958971
     
    12711284                        struct navigation_way *cur_itm = &(new->way);
    12721285                        while (cur_itm) {
    12731286                                if (maneuver_category(cur_itm->item.type) == cat) {
    1274                                         // TODO: decide if a maneuver_category difference of 1 is still similar
     1287                                        /* TODO: decide if a maneuver_category difference of 1 is still similar */
    12751288                                        num_similar++;
    12761289                                }
    12771290                                cur_itm = cur_itm->next;
     
    15521565                if(next->way.item.type == type_ramp)
    15531566                        return NULL;
    15541567                if(itm->way.item.type == type_highway_city || itm->way.item.type == type_highway_land )
    1555                         return g_strdup_printf("%s%s",prefix,_("exit"));        /* %FIXME Can this even be reached? */                   
     1568                        return g_strdup_printf("%s%s",prefix,_("exit"));        /* %FIXME Can this even be reached?
     1569                        Answer : no, and so Navit can not differentiate between a ramp and an exit*/
    15561570                else
    15571571                        return g_strdup_printf("%s%s",prefix,_("into the ramp"));
    15581572               
     
    15601574        if (!n1 && !n2)
    15611575                return NULL;
    15621576        if (n1) {
    1563                 sex=-1;
     1577                sex=unknown;
    15641578                name1=NULL;
    15651579                for (i = 0 ; i < sizeof(suffixes)/sizeof(suffixes[0]) ; i++) {
    15661580                        if (contains_suffix(n1,suffixes[i].fullname)) {
     
    15821596                        sep="";
    15831597                }
    15841598                switch (sex) {
    1585                 case -1:
     1599                case unknown:
    15861600                        /* TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name */
    15871601                        ret=g_strdup_printf(_("%sinto the street %s%s%s"),prefix,n1, sep, name2);
    15881602                        break;
    1589                 case 1:
     1603                case male:
    15901604                        /* TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Male form. The stuff after | doesn't have to be included */
    15911605                        ret=g_strdup_printf(_("%sinto the %s%s%s|male form"),prefix,name1, sep, name2);
    15921606                        break;
    1593                 case 2:
     1607                case female:
    15941608                        /* TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Female form. The stuff after | doesn't have to be included */
    15951609                        ret=g_strdup_printf(_("%sinto the %s%s%s|female form"),prefix,name1, sep, name2);
    15961610                        break;
    1597                 case 3:
     1611                case neutral:
    15981612                        /* TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Neutral form. The stuff after | doesn't have to be included */
    15991613                        ret=g_strdup_printf(_("%sinto the %s%s%s|neutral form"),prefix,name1, sep, name2);
    16001614                        break;
     
    16361650        struct navigation_way *w;
    16371651       
    16381652        if (connect) {
    1639                 level = -2; // level = -2 means "connect to another maneuver via 'then ...'"
     1653                level = -2; /* level = -2 means "connect to another maneuver via 'then ...'" */
    16401654        } else {
    16411655                level=1;
    16421656        }