Diff of /trunk/src/misc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 165 by harbaum, Sun Nov 8 20:32:55 2009 UTC revision 185 by harbaum, Sat Nov 14 16:55:33 2009 UTC
# Line 151  float pos_parse_lon(char *str) { Line 151  float pos_parse_lon(char *str) {
151    
152  const char *pos_get_bearing_str(pos_t from, pos_t to) {  const char *pos_get_bearing_str(pos_t from, pos_t to) {
153    static const char *bear_str[]={    static const char *bear_str[]={
154      "N", "NE", "E", "SE", "S", "SW", "W", "NW" };      "N", "NE", "E", "SE", "S", "SW", "W", "NW", "" };
155    int idx = (gpx_pos_get_bearing(from, to)+22.5)/45.0;  
156    /* make sure we stay in icon bounds */    float bearing = gpx_pos_get_bearing(from, to);
157    while(idx < 0) idx += 8;    if(!isnan(bearing)) {
158    while(idx > 7) idx -= 8;      int idx = (bearing+22.5)/45.0;
159    return _(bear_str[idx]);      /* make sure we stay in icon bounds */
160        while(idx < 0) idx += 8;
161        while(idx > 7) idx -= 8;
162        return _(bear_str[idx]);
163      }
164    
165      return bear_str[8];  // empty string
166  }  }
167    
168  /* the maemo font size is quite huge, so we adjust some fonts */  /* the maemo font size is quite huge, so we adjust some fonts */

Legend:
Removed from v.165  
changed lines
  Added in v.185