… | |
… | |
116 | load_style_map (char *style_name) |
116 | load_style_map (char *style_name) |
117 | { |
117 | { |
118 | maptile *style_map; |
118 | maptile *style_map; |
119 | |
119 | |
120 | /* Given a file. See if its in memory */ |
120 | /* Given a file. See if its in memory */ |
121 | for (style_map = styles; style_map != NULL; style_map = style_map->next) |
121 | for (style_map = styles; style_map; style_map = style_map->next) |
122 | { |
|
|
123 | if (!strcmp (style_name, style_map->path)) |
122 | if (!strcmp (style_name, style_map->path)) |
124 | return style_map; |
123 | return style_map; |
125 | } |
124 | |
126 | style_map = load_original_map (style_name, MAP_STYLE); |
125 | style_map = load_original_map (style_name, MAP_STYLE); |
|
|
126 | |
127 | /* Remove it from global list, put it on our local list */ |
127 | /* Remove it from global list, put it on our local list */ |
128 | if (style_map) |
128 | if (style_map) |
129 | { |
129 | { |
130 | maptile *tmp; |
130 | style_map->unlink (); |
131 | |
131 | |
132 | if (style_map == first_map) |
|
|
133 | first_map = style_map->next; |
|
|
134 | else |
|
|
135 | { |
|
|
136 | for (tmp = first_map; tmp && tmp->next != style_map; tmp = tmp->next); |
|
|
137 | if (tmp) |
|
|
138 | tmp->next = style_map->next; |
|
|
139 | } |
|
|
140 | style_map->next = styles; |
132 | style_map->next = styles; |
141 | styles = style_map; |
133 | styles = style_map; |
142 | } |
134 | } |
|
|
135 | |
143 | return style_map; |
136 | return style_map; |
144 | } |
137 | } |
145 | |
138 | |
146 | maptile * |
139 | maptile * |
147 | find_style (const char *dirname, const char *stylename, int difficulty) |
140 | find_style (const char *dirname, const char *stylename, int difficulty) |