summaryrefslogtreecommitdiff
path: root/navit/item.c
diff options
context:
space:
mode:
authormvglasow <michael -at- vonglasow.com>2018-05-26 22:16:52 +0200
committermvglasow <michael -at- vonglasow.com>2018-05-26 22:16:52 +0200
commit5b9d018fdbcef2b9ffaf539ee0f959bd07ccf57c (patch)
tree0ea83f5162ac7c5503f7da6f9285fda4f5d76c46 /navit/item.c
parente2dd06580d1b60c5638433d8471008b29c81f674 (diff)
downloadnavit-5b9d018fdbcef2b9ffaf539ee0f959bd07ccf57c.tar.gz
cleanup:global:Reformat with astyle and remove trailing spaces
Mirrors 8a76acb and 41a1264 Signed-off-by: mvglasow <michael -at- vonglasow.com>
Diffstat (limited to 'navit/item.c')
-rw-r--r--navit/item.c512
1 files changed, 240 insertions, 272 deletions
diff --git a/navit/item.c b/navit/item.c
index 3ea79924c..d18535fa4 100644
--- a/navit/item.c
+++ b/navit/item.c
@@ -27,61 +27,61 @@
#include "transform.h"
struct item_name {
- enum item_type item;
- char *name;
+ enum item_type item;
+ char *name;
};
struct item_range item_range_all = { type_none, type_last };
struct default_flags {
- enum item_type type;
- int flags;
+ enum item_type type;
+ int flags;
};
struct item busy_item;
-struct default_flags default_flags2[]={
- {type_street_nopass, AF_PBH},
- {type_street_0, AF_ALL},
- {type_street_1_city, AF_ALL},
- {type_street_2_city, AF_ALL},
- {type_street_3_city, AF_ALL},
- {type_street_4_city, AF_ALL},
- {type_highway_city, AF_MOTORIZED_FAST},
- {type_street_1_land, AF_ALL},
- {type_street_2_land, AF_ALL},
- {type_street_3_land, AF_ALL},
- {type_street_4_land, AF_ALL},
- {type_street_n_lanes, AF_MOTORIZED_FAST},
- {type_highway_land, AF_MOTORIZED_FAST},
- {type_ramp, AF_MOTORIZED_FAST},
- {type_roundabout, AF_ALL},
- {type_ferry, AF_ALL},
- {type_cycleway, AF_PBH},
- {type_track_paved, AF_ALL},
- {type_track_gravelled, AF_ALL},
- {type_track_unpaved, AF_ALL},
- {type_track_ground, AF_ALL},
- {type_track_grass, AF_ALL},
- {type_footway, AF_PBH},
- {type_living_street, AF_ALL},
- {type_street_service, AF_ALL},
- {type_street_parking_lane, AF_ALL},
- {type_bridleway, AF_PBH},
- {type_path, AF_PBH},
- {type_steps, AF_PBH},
- {type_street_pedestrian, AF_PBH},
- {type_hiking_mountain, AF_PEDESTRIAN},
- {type_hiking_mountain_demanding, AF_PEDESTRIAN},
- {type_hiking, AF_PEDESTRIAN},
- {type_hiking_alpine, AF_PEDESTRIAN},
- {type_hiking_alpine_demanding, AF_PEDESTRIAN},
- {type_hiking_alpine_difficult, AF_PEDESTRIAN},
+struct default_flags default_flags2[]= {
+ {type_street_nopass, AF_PBH},
+ {type_street_0, AF_ALL},
+ {type_street_1_city, AF_ALL},
+ {type_street_2_city, AF_ALL},
+ {type_street_3_city, AF_ALL},
+ {type_street_4_city, AF_ALL},
+ {type_highway_city, AF_MOTORIZED_FAST},
+ {type_street_1_land, AF_ALL},
+ {type_street_2_land, AF_ALL},
+ {type_street_3_land, AF_ALL},
+ {type_street_4_land, AF_ALL},
+ {type_street_n_lanes, AF_MOTORIZED_FAST},
+ {type_highway_land, AF_MOTORIZED_FAST},
+ {type_ramp, AF_MOTORIZED_FAST},
+ {type_roundabout, AF_ALL},
+ {type_ferry, AF_ALL},
+ {type_cycleway, AF_PBH},
+ {type_track_paved, AF_ALL},
+ {type_track_gravelled, AF_ALL},
+ {type_track_unpaved, AF_ALL},
+ {type_track_ground, AF_ALL},
+ {type_track_grass, AF_ALL},
+ {type_footway, AF_PBH},
+ {type_living_street, AF_ALL},
+ {type_street_service, AF_ALL},
+ {type_street_parking_lane, AF_ALL},
+ {type_bridleway, AF_PBH},
+ {type_path, AF_PBH},
+ {type_steps, AF_PBH},
+ {type_street_pedestrian, AF_PBH},
+ {type_hiking_mountain, AF_PEDESTRIAN},
+ {type_hiking_mountain_demanding, AF_PEDESTRIAN},
+ {type_hiking, AF_PEDESTRIAN},
+ {type_hiking_alpine, AF_PEDESTRIAN},
+ {type_hiking_alpine_demanding, AF_PEDESTRIAN},
+ {type_hiking_alpine_difficult, AF_PEDESTRIAN},
};
-struct item_name item_names[]={
+struct item_name item_names[]= {
#define ITEM2(x,y) ITEM(y)
#define ITEM(x) { type_##x, #x },
#include "item_def.h"
@@ -94,40 +94,36 @@ static GHashTable *default_flags_hash;
static GHashTable *item_hash;
void
-item_create_hash(void)
-{
- int i;
- item_hash=g_hash_table_new(g_str_hash, g_str_equal);
- for (i=0 ; i < sizeof(item_names)/sizeof(struct item_name) ; i++) {
- g_hash_table_insert(item_hash, item_names[i].name, GINT_TO_POINTER(item_names[i].item));
- }
+item_create_hash(void) {
+ int i;
+ item_hash=g_hash_table_new(g_str_hash, g_str_equal);
+ for (i=0 ; i < sizeof(item_names)/sizeof(struct item_name) ; i++) {
+ g_hash_table_insert(item_hash, item_names[i].name, GINT_TO_POINTER(item_names[i].item));
+ }
}
void
-item_destroy_hash(void)
-{
- g_hash_table_destroy(item_hash);
- item_hash=NULL;
+item_destroy_hash(void) {
+ g_hash_table_destroy(item_hash);
+ item_hash=NULL;
}
int *
-item_get_default_flags(enum item_type type)
-{
- if (!default_flags_hash) {
- int i;
- default_flags_hash=g_hash_table_new(NULL, NULL);
- for (i = 0 ; i < sizeof(default_flags2)/sizeof(struct default_flags); i++) {
- g_hash_table_insert(default_flags_hash, (void *)(long)default_flags2[i].type, &default_flags2[i].flags);
- }
- }
- return g_hash_table_lookup(default_flags_hash, (void *)(long)type);
+item_get_default_flags(enum item_type type) {
+ if (!default_flags_hash) {
+ int i;
+ default_flags_hash=g_hash_table_new(NULL, NULL);
+ for (i = 0 ; i < sizeof(default_flags2)/sizeof(struct default_flags); i++) {
+ g_hash_table_insert(default_flags_hash, (void *)(long)default_flags2[i].type, &default_flags2[i].flags);
+ }
+ }
+ return g_hash_table_lookup(default_flags_hash, (void *)(long)type);
}
void
-item_cleanup(void)
-{
- if (default_flags_hash)
- g_hash_table_destroy(default_flags_hash);
+item_cleanup(void) {
+ if (default_flags_hash)
+ g_hash_table_destroy(default_flags_hash);
}
/**
@@ -143,9 +139,8 @@ item_cleanup(void)
* {@code map_rect}. There can only be one active item per {@code map_rect}.
*/
void
-item_coord_rewind(struct item *it)
-{
- it->meth->item_coord_rewind(it->priv_data);
+item_coord_rewind(struct item *it) {
+ it->meth->item_coord_rewind(it->priv_data);
}
/**
@@ -171,9 +166,8 @@ item_coord_rewind(struct item *it)
* @return The number of coordinates actually retrieved and stored in {@code c}
*/
int
-item_coord_get(struct item *it, struct coord *c, int count)
-{
- return it->meth->item_coord_get(it->priv_data, c, count);
+item_coord_get(struct item *it, struct coord *c, int count) {
+ return it->meth->item_coord_get(it->priv_data, c, count);
}
/**
@@ -202,42 +196,40 @@ item_coord_get(struct item *it, struct coord *c, int count)
* @param mode The change mode, see description
*/
int
-item_coord_set(struct item *it, struct coord *c, int count, enum change_mode mode)
-{
- if (!it->meth->item_coord_set)
- return 0;
- return it->meth->item_coord_set(it->priv_data, c, count, mode);
+item_coord_set(struct item *it, struct coord *c, int count, enum change_mode mode) {
+ if (!it->meth->item_coord_set)
+ return 0;
+ return it->meth->item_coord_set(it->priv_data, c, count, mode);
}
int
-item_coord_get_within_selection(struct item *it, struct coord *c, int count, struct map_selection *sel)
-{
- int i,ret=it->meth->item_coord_get(it->priv_data, c, count);
- struct coord_rect r;
- struct map_selection *curr;
- if (ret <= 0 || !sel)
- return ret;
- r.lu=c[0];
- r.rl=c[0];
- for (i = 1 ; i < ret ; i++) {
- if (r.lu.x > c[i].x)
- r.lu.x=c[i].x;
- if (r.rl.x < c[i].x)
- r.rl.x=c[i].x;
- if (r.rl.y > c[i].y)
- r.rl.y=c[i].y;
- if (r.lu.y < c[i].y)
- r.lu.y=c[i].y;
- }
- curr=sel;
- while (curr) {
- struct coord_rect *sr=&curr->u.c_rect;
- if (r.lu.x <= sr->rl.x && r.rl.x >= sr->lu.x &&
- r.lu.y >= sr->rl.y && r.rl.y <= sr->lu.y)
- return ret;
- curr=curr->next;
- }
- return 0;
+item_coord_get_within_selection(struct item *it, struct coord *c, int count, struct map_selection *sel) {
+ int i,ret=it->meth->item_coord_get(it->priv_data, c, count);
+ struct coord_rect r;
+ struct map_selection *curr;
+ if (ret <= 0 || !sel)
+ return ret;
+ r.lu=c[0];
+ r.rl=c[0];
+ for (i = 1 ; i < ret ; i++) {
+ if (r.lu.x > c[i].x)
+ r.lu.x=c[i].x;
+ if (r.rl.x < c[i].x)
+ r.rl.x=c[i].x;
+ if (r.rl.y > c[i].y)
+ r.rl.y=c[i].y;
+ if (r.lu.y < c[i].y)
+ r.lu.y=c[i].y;
+ }
+ curr=sel;
+ while (curr) {
+ struct coord_rect *sr=&curr->u.c_rect;
+ if (r.lu.x <= sr->rl.x && r.rl.x >= sr->lu.x &&
+ r.lu.y >= sr->rl.y && r.rl.y <= sr->lu.y)
+ return ret;
+ curr=curr->next;
+ }
+ return 0;
}
/**
@@ -266,30 +258,29 @@ item_coord_get_within_selection(struct item *it, struct coord *c, int count, str
* @return The number of coordinates stored in `c`
*/
int item_coord_get_within_range(struct item *i, struct coord *c, int max,
- struct coord *start, struct coord *end)
-{
- struct map_rect *mr;
- struct item *item;
- int rc = 0, p = 0;
- struct coord c1;
- mr=map_rect_new(i->map, NULL);
- if (!mr)
- return 0;
- item = map_rect_get_item_byid(mr, i->id_hi, i->id_lo);
- if (item) {
- rc = item_coord_get(item, &c1, 1);
- while (rc && (c1.x != start->x || c1.y != start->y)) {
- rc = item_coord_get(item, &c1, 1);
- }
- while (rc && p < max) {
- c[p++] = c1;
- if (c1.x == end->x && c1.y == end->y)
- break;
- rc = item_coord_get(item, &c1, 1);
- }
- }
- map_rect_destroy(mr);
- return p;
+ struct coord *start, struct coord *end) {
+ struct map_rect *mr;
+ struct item *item;
+ int rc = 0, p = 0;
+ struct coord c1;
+ mr=map_rect_new(i->map, NULL);
+ if (!mr)
+ return 0;
+ item = map_rect_get_item_byid(mr, i->id_hi, i->id_lo);
+ if (item) {
+ rc = item_coord_get(item, &c1, 1);
+ while (rc && (c1.x != start->x || c1.y != start->y)) {
+ rc = item_coord_get(item, &c1, 1);
+ }
+ while (rc && p < max) {
+ c[p++] = c1;
+ if (c1.x == end->x && c1.y == end->y)
+ break;
+ rc = item_coord_get(item, &c1, 1);
+ }
+ }
+ map_rect_destroy(mr);
+ return p;
}
/**
@@ -310,15 +301,14 @@ int item_coord_get_within_range(struct item *i, struct coord *c, int max,
* @return The number of coordinates actually retrieved and stored in {@code c}
*/
int
-item_coord_get_pro(struct item *it, struct coord *c, int count, enum projection to)
-{
- int ret=item_coord_get(it, c, count);
- int i;
- enum projection from=map_projection(it->map);
- if (from != to)
- for (i = 0 ; i < count ; i++)
- transform_from_to(c+i, from, c+i, to);
- return ret;
+item_coord_get_pro(struct item *it, struct coord *c, int count, enum projection to) {
+ int ret=item_coord_get(it, c, count);
+ int i;
+ enum projection from=map_projection(it->map);
+ if (from != to)
+ for (i = 0 ; i < count ; i++)
+ transform_from_to(c+i, from, c+i, to);
+ return ret;
}
/**
@@ -333,12 +323,11 @@ item_coord_get_pro(struct item *it, struct coord *c, int count, enum projection
*
* @return True on success, false on failure
*/
-int
-item_coord_is_node(struct item *it)
-{
- if (it->meth->item_coord_is_node)
- return it->meth->item_coord_is_node(it->priv_data);
- return 0;
+int
+item_coord_is_node(struct item *it) {
+ if (it->meth->item_coord_is_node)
+ return it->meth->item_coord_is_node(it->priv_data);
+ return 0;
}
/**
@@ -354,9 +343,8 @@ item_coord_is_node(struct item *it)
* {@code map_rect}. There can only be one active item per {@code map_rect}.
*/
void
-item_attr_rewind(struct item *it)
-{
- it->meth->item_attr_rewind(it->priv_data);
+item_attr_rewind(struct item *it) {
+ it->meth->item_attr_rewind(it->priv_data);
}
/**
@@ -376,9 +364,8 @@ item_attr_rewind(struct item *it)
* @return True on success, false on failure
*/
int
-item_attr_get(struct item *it, enum attr_type attr_type, struct attr *attr)
-{
- return it->meth->item_attr_get(it->priv_data, attr_type, attr);
+item_attr_get(struct item *it, enum attr_type attr_type, struct attr *attr) {
+ return it->meth->item_attr_get(it->priv_data, attr_type, attr);
}
/**
@@ -404,11 +391,10 @@ item_attr_get(struct item *it, enum attr_type attr_type, struct attr *attr)
* @param mode The change mode, see description
*/
int
-item_attr_set(struct item *it, struct attr *attr, enum change_mode mode)
-{
- if (!it->meth->item_attr_set)
- return 0;
- return it->meth->item_attr_set(it->priv_data, attr, mode);
+item_attr_set(struct item *it, struct attr *attr, enum change_mode mode) {
+ if (!it->meth->item_attr_set)
+ return 0;
+ return it->meth->item_attr_set(it->priv_data, attr, mode);
}
/**
@@ -420,195 +406,177 @@ item_attr_set(struct item *it, struct attr *attr, enum change_mode mode)
* @return Non-zero if this action is supported by the map and type is set successfully, 0 on error.
*/
int
-item_type_set(struct item *it, enum item_type type)
-{
- if (!it->meth->item_type_set)
- return 0;
- return it->meth->item_type_set(it->priv_data, type);
+item_type_set(struct item *it, enum item_type type) {
+ if (!it->meth->item_type_set)
+ return 0;
+ return it->meth->item_type_set(it->priv_data, type);
}
-struct item * item_new(char *type, int zoom)
-{
- struct item * it;
+struct item * item_new(char *type, int zoom) {
+ struct item * it;
- it = g_new0(struct item, 1);
+ it = g_new0(struct item, 1);
- /* FIXME evaluate arguments */
+ /* FIXME evaluate arguments */
- return it;
+ return it;
}
enum item_type
-item_from_name(const char *name)
-{
- int i;
+item_from_name(const char *name) {
+ int i;
- if (item_hash)
- return GPOINTER_TO_INT(g_hash_table_lookup(item_hash, name));
+ if (item_hash)
+ return GPOINTER_TO_INT(g_hash_table_lookup(item_hash, name));
- for (i=0 ; i < sizeof(item_names)/sizeof(struct item_name) ; i++) {
- if (! strcmp(item_names[i].name, name))
- return item_names[i].item;
- }
- return type_none;
+ for (i=0 ; i < sizeof(item_names)/sizeof(struct item_name) ; i++) {
+ if (! strcmp(item_names[i].name, name))
+ return item_names[i].item;
+ }
+ return type_none;
}
char *
-item_to_name(enum item_type item)
-{
- int i;
+item_to_name(enum item_type item) {
+ int i;
- for (i=0 ; i < sizeof(item_names)/sizeof(struct item_name) ; i++) {
- if (item_names[i].item == item)
- return item_names[i].name;
- }
- return NULL;
+ for (i=0 ; i < sizeof(item_names)/sizeof(struct item_name) ; i++) {
+ if (item_names[i].item == item)
+ return item_names[i].name;
+ }
+ return NULL;
}
struct item_hash {
- GHashTable *h;
+ GHashTable *h;
};
static guint
-item_hash_hash(gconstpointer key)
-{
- const struct item *itm=key;
- gconstpointer hashkey=(gconstpointer)GINT_TO_POINTER(itm->id_hi^itm->id_lo^(GPOINTER_TO_INT(itm->map)));
- return g_direct_hash(hashkey);
+item_hash_hash(gconstpointer key) {
+ const struct item *itm=key;
+ gconstpointer hashkey=(gconstpointer)GINT_TO_POINTER(itm->id_hi^itm->id_lo^(GPOINTER_TO_INT(itm->map)));
+ return g_direct_hash(hashkey);
}
static gboolean
-item_hash_equal(gconstpointer a, gconstpointer b)
-{
- const struct item *itm_a=a;
- const struct item *itm_b=b;
- if (item_is_equal(*itm_a, *itm_b))
- return TRUE;
- return FALSE;
+item_hash_equal(gconstpointer a, gconstpointer b) {
+ const struct item *itm_a=a;
+ const struct item *itm_b=b;
+ if (item_is_equal(*itm_a, *itm_b))
+ return TRUE;
+ return FALSE;
}
unsigned int
-item_id_hash(const void *key)
-{
- const struct item_id *id=key;
- return id->id_hi^id->id_lo;
+item_id_hash(const void *key) {
+ const struct item_id *id=key;
+ return id->id_hi^id->id_lo;
}
int
-item_id_equal(const void *a, const void *b)
-{
- const struct item_id *id_a=a;
- const struct item_id *id_b=b;
- return (id_a->id_hi == id_b->id_hi && id_a->id_lo == id_b->id_lo);
+item_id_equal(const void *a, const void *b) {
+ const struct item_id *id_a=a;
+ const struct item_id *id_b=b;
+ return (id_a->id_hi == id_b->id_hi && id_a->id_lo == id_b->id_lo);
}
/**
- * @brief Derive item id_lo and id_hi from pointer, considering pointer could be 32 or 64 bit wide but both ids are 32 bit.
+ * @brief Derive item id_lo and id_hi from pointer, considering pointer could be 32 or 64 bit wide but both ids are 32 bit.
*
* @param it reference to the item.
* @param id pointer to derive item id from.
* @return Nothing.
*/
void
-item_id_from_ptr(struct item *item, void *id)
-{
+item_id_from_ptr(struct item *item, void *id) {
#if !defined(__LP64__) && !defined(__LLP64__) && !defined(WIN64)
- item->id_lo=(int) id;
- item->id_hi=0;
+ item->id_lo=(int) id;
+ item->id_hi=0;
#else
# ifndef _MSC_VER
- item->id_lo=((long long)id)&0xFFFFFFFFll;
+ item->id_lo=((long long)id)&0xFFFFFFFFll;
# else
- item->id_lo=((long long)id)&0xFFFFFFFFi64;
+ item->id_lo=((long long)id)&0xFFFFFFFFi64;
# endif
- item->id_hi=((long long)id)>>32;
+ item->id_hi=((long long)id)>>32;
#endif
}
struct item_hash *
-item_hash_new(void)
-{
- struct item_hash *ret=g_new(struct item_hash, 1);
+item_hash_new(void) {
+ struct item_hash *ret=g_new(struct item_hash, 1);
- ret->h=g_hash_table_new_full(item_hash_hash, item_hash_equal, g_free, NULL);
- return ret;
+ ret->h=g_hash_table_new_full(item_hash_hash, item_hash_equal, g_free, NULL);
+ return ret;
}
void
-item_hash_insert(struct item_hash *h, struct item *item, void *val)
-{
- struct item *hitem=g_new(struct item, 1);
- *hitem=*item;
- dbg(lvl_info,"inserting (0x%x,0x%x) into %p", item->id_hi, item->id_lo, h->h);
- g_hash_table_insert(h->h, hitem, val);
+item_hash_insert(struct item_hash *h, struct item *item, void *val) {
+ struct item *hitem=g_new(struct item, 1);
+ *hitem=*item;
+ dbg(lvl_info,"inserting (0x%x,0x%x) into %p", item->id_hi, item->id_lo, h->h);
+ g_hash_table_insert(h->h, hitem, val);
}
int
-item_hash_remove(struct item_hash *h, struct item *item)
-{
- int ret;
+item_hash_remove(struct item_hash *h, struct item *item) {
+ int ret;
- dbg(lvl_info,"removing (0x%x,0x%x) from %p", item->id_hi, item->id_lo, h->h);
- ret=g_hash_table_remove(h->h, item);
- dbg(lvl_info,"ret=%d", ret);
+ dbg(lvl_info,"removing (0x%x,0x%x) from %p", item->id_hi, item->id_lo, h->h);
+ ret=g_hash_table_remove(h->h, item);
+ dbg(lvl_info,"ret=%d", ret);
- return ret;
+ return ret;
}
void *
-item_hash_lookup(struct item_hash *h, struct item *item)
-{
- return g_hash_table_lookup(h->h, item);
+item_hash_lookup(struct item_hash *h, struct item *item) {
+ return g_hash_table_lookup(h->h, item);
}
void
-item_hash_destroy(struct item_hash *h)
-{
- g_hash_table_destroy(h->h);
- g_free(h);
+item_hash_destroy(struct item_hash *h) {
+ g_hash_table_destroy(h->h);
+ g_free(h);
}
int
-item_range_intersects_range(struct item_range *range1, struct item_range *range2)
-{
- if (range1->max < range2->min)
- return 0;
- if (range1->min > range2->max)
- return 0;
- return 1;
+item_range_intersects_range(struct item_range *range1, struct item_range *range2) {
+ if (range1->max < range2->min)
+ return 0;
+ if (range1->min > range2->max)
+ return 0;
+ return 1;
}
int
-item_range_contains_item(struct item_range *range, enum item_type type)
-{
- if (type >= range->min && type <= range->max)
- return 1;
- return 0;
+item_range_contains_item(struct item_range *range, enum item_type type) {
+ if (type >= range->min && type <= range->max)
+ return 1;
+ return 0;
}
void
-item_dump_attr(struct item *item, struct map *map, FILE *out)
-{
- struct attr attr;
- fprintf(out,"type=%s", item_to_name(item->type));
- while (item_attr_get(item, attr_any, &attr))
- fprintf(out," %s='%s'", attr_to_name(attr.type), attr_to_text(&attr, map, 1));
+item_dump_attr(struct item *item, struct map *map, FILE *out) {
+ struct attr attr;
+ fprintf(out,"type=%s", item_to_name(item->type));
+ while (item_attr_get(item, attr_any, &attr))
+ fprintf(out," %s='%s'", attr_to_name(attr.type), attr_to_text(&attr, map, 1));
}
void
-item_dump_filedesc(struct item *item, struct map *map, FILE *out)
-{
-
- int i,count,max=16384;
- struct coord *ca=g_alloca(sizeof(struct coord)*max);
-
- count=item_coord_get(item, ca, item->type < type_line ? 1: max);
- if (item->type < type_line)
- fprintf(out,"mg:0x%x 0x%x ", ca[0].x, ca[0].y);
- item_dump_attr(item, map, out);
- fprintf(out,"\n");
- if (item->type >= type_line)
- for (i = 0 ; i < count ; i++)
- fprintf(out,"mg:0x%x 0x%x\n", ca[i].x, ca[i].y);
+item_dump_filedesc(struct item *item, struct map *map, FILE *out) {
+
+ int i,count,max=16384;
+ struct coord *ca=g_alloca(sizeof(struct coord)*max);
+
+ count=item_coord_get(item, ca, item->type < type_line ? 1: max);
+ if (item->type < type_line)
+ fprintf(out,"mg:0x%x 0x%x ", ca[0].x, ca[0].y);
+ item_dump_attr(item, map, out);
+ fprintf(out,"\n");
+ if (item->type >= type_line)
+ for (i = 0 ; i < count ; i++)
+ fprintf(out,"mg:0x%x 0x%x\n", ca[i].x, ca[i].y);
}