ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/style.C
(Generate patch)

Comparing deliantra/server/random_maps/style.C (file contents):
Revision 1.7 by root, Thu Dec 14 22:45:40 2006 UTC vs.
Revision 1.10 by root, Wed Dec 27 09:28:02 2006 UTC

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 != NULL; 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 maptile *tmp;
131 131
135 { 135 {
136 for (tmp = first_map; tmp && tmp->next != style_map; tmp = tmp->next); 136 for (tmp = first_map; tmp && tmp->next != style_map; tmp = tmp->next);
137 if (tmp) 137 if (tmp)
138 tmp->next = style_map->next; 138 tmp->next = style_map->next;
139 } 139 }
140
140 style_map->next = styles; 141 style_map->next = styles;
141 styles = style_map; 142 styles = style_map;
142 } 143 }
144
143 return style_map; 145 return style_map;
144} 146}
145 147
146maptile * 148maptile *
147find_style (const char *dirname, const char *stylename, int difficulty) 149find_style (const char *dirname, const char *stylename, int difficulty)
265 * any difference, but this seems clearer to me. 267 * any difference, but this seems clearer to me.
266 */ 268 */
267 do 269 do
268 { 270 {
269 limit++; 271 limit++;
270 x = RANDOM () % MAP_WIDTH (style); 272 x = RANDOM () % style->width;
271 y = RANDOM () % MAP_HEIGHT (style); 273 y = RANDOM () % style->height;
272 new_obj = get_map_ob (style, x, y); 274 new_obj = GET_MAP_OB (style, x, y);
273 } 275 }
274 while (new_obj == NULL && limit < 1000); 276 while (new_obj == NULL && limit < 1000);
275 if (new_obj->head) 277 if (new_obj->head)
276 return new_obj->head; 278 return new_obj->head;
277 else 279 else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines