X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/a3697549141084a5e8e2cef8e30928704d397bba..9d342fdde7e478e4b0421e190b7e81c13ee4e804:/src/expedia.c diff --git a/src/expedia.c b/src/expedia.c index 2443ceb7..239ada3c 100644 --- a/src/expedia.c +++ b/src/expedia.c @@ -31,6 +31,7 @@ #include #endif +#include "map_ids.h" #include "globals.h" #include "coords.h" #include "vikcoord.h" @@ -46,11 +47,11 @@ static int expedia_download ( MapCoord *src, const gchar *dest_fn, void *handle static void * expedia_handle_init ( ); static void expedia_handle_cleanup ( void *handle ); -static DownloadMapOptions expedia_options = { FALSE, FALSE, NULL, 2, a_check_map_file, NULL }; +static DownloadFileOptions expedia_options = { FALSE, FALSE, NULL, 2, a_check_map_file, NULL }; void expedia_init() { - VikMapsLayer_MapType map_type = { 5, 0, 0, VIK_VIEWPORT_DRAWMODE_EXPEDIA, expedia_coord_to_mapcoord, expedia_mapcoord_to_center_coord, expedia_download, expedia_handle_init, expedia_handle_cleanup }; - maps_layer_register_type(_("Expedia Street Maps"), 5, &map_type); + VikMapsLayer_MapType map_type = { MAP_ID_EXPEDIA, 0, 0, VIK_VIEWPORT_DRAWMODE_EXPEDIA, expedia_coord_to_mapcoord, expedia_mapcoord_to_center_coord, expedia_download, expedia_handle_init, expedia_handle_cleanup }; + maps_layer_register_type(_("Expedia Street Maps"), MAP_ID_EXPEDIA, &map_type); } #define EXPEDIA_SITE "expedia.com" @@ -169,12 +170,11 @@ static void expedia_mapcoord_to_center_coord ( MapCoord *src, VikCoord *dest ) dest->north_south = (((gdouble)src->y) / expedia_altis_freq(src->scale)) - 90; } -static int expedia_download ( MapCoord *src, const gchar *dest_fn, void *handle ) +static DownloadResult_t expedia_download ( MapCoord *src, const gchar *dest_fn, void *handle ) { gint height, width; struct LatLon ll; gchar *uri; - int res = -1; expedia_xy_to_latlon_middle ( src->scale, src->x, src->y, &ll ); @@ -187,7 +187,8 @@ static int expedia_download ( MapCoord *src, const gchar *dest_fn, void *handle uri = g_strdup_printf ( "/pub/agent.dll?qscr=mrdt&ID=3XNsF.&CenP=%lf,%lf&Lang=%s&Alti=%d&Size=%d,%d&Offs=0.000000,0.000000&BCheck&tpid=1", ll.lat, ll.lon, (ll.lon > -30) ? "EUR0809" : "USA0409", src->scale, width, height ); - if ((res = a_http_download_get_url ( EXPEDIA_SITE, uri, dest_fn, &expedia_options, NULL )) == 0) /* All OK */ + DownloadResult_t res = a_http_download_get_url ( EXPEDIA_SITE, uri, dest_fn, &expedia_options, NULL ); + if (res == DOWNLOAD_SUCCESS) expedia_snip ( dest_fn ); g_free(uri); return(res);