2 #include <glib/gprintf.h>
12 struct mapset *mapset_new(void)
16 ms=g_new0(struct mapset, 1);
21 void mapset_add(struct mapset *ms, struct map *m)
23 ms->maps=g_list_append(ms->maps, m);
27 static void mapset_maps_free(struct mapset *ms)
33 void mapset_destroy(struct mapset *ms)
38 struct mapset_handle {
42 struct mapset_handle *
43 mapset_open(struct mapset *ms)
45 struct mapset_handle *ret;
47 ret=g_new(struct mapset_handle, 1);
53 struct map * mapset_next(struct mapset_handle *msh, int active)
61 msh->l=g_list_next(msh->l);
62 if (!active || map_get_active(ret))
68 mapset_close(struct mapset_handle *msh)
73 struct mapset_search {
75 struct map_search *ms;
77 struct attr *search_attr;
81 struct mapset_search *
82 mapset_search_new(struct mapset *ms, struct item *item, struct attr *search_attr, int partial)
84 struct mapset_search *this;
85 dbg(1,"enter(%p,%p,%p,%d)\n", ms, item, search_attr, partial);
86 this=g_new0(struct mapset_search,1);
89 this->search_attr=search_attr;
90 this->partial=partial;
91 this->ms=map_search_new(this->map->data, item, search_attr, partial);
96 mapset_search_get_item(struct mapset_search *this)
99 while (!(ret=map_search_get_item(this->ms))) {
100 if (this->search_attr->type >= attr_country_all && this->search_attr->type <= attr_country_name)
102 this->map=g_list_next(this->map);
105 map_search_destroy(this->ms);
106 this->ms=map_search_new(this->map->data, this->item, this->search_attr, this->partial);
112 mapset_search_destroy(struct mapset_search *this)
114 map_search_destroy(this->ms);