… | |
… | |
221 | if (!exit_style) |
221 | if (!exit_style) |
222 | return; |
222 | return; |
223 | |
223 | |
224 | exit_style->pick_random_object ()->copy_to (the_exit); |
224 | exit_style->pick_random_object ()->copy_to (the_exit); |
225 | |
225 | |
226 | while (i < 0) |
226 | // put an upper bound here, just in case |
|
|
227 | for (int repeat = 8192; --repeat; ) |
227 | { |
228 | { |
228 | ix = rndm (map->width - 2) + 1; |
229 | ix = rndm (map->width - 2) + 1; |
229 | iy = rndm (map->height - 2) + 1; |
230 | iy = rndm (map->height - 2) + 1; |
|
|
231 | |
230 | i = find_free_spot (the_exit, map, ix, iy, 1, SIZEOFFREE1 + 1); |
232 | i = find_free_spot (the_exit, map, ix, iy, 1, SIZEOFFREE1 + 1); |
231 | } |
233 | if (i >= 0) |
232 | |
234 | { |
233 | ix += freearr_x[i]; |
235 | ix += freearr_x[i]; |
234 | iy += freearr_y[i]; |
236 | iy += freearr_y[i]; |
|
|
237 | break; |
|
|
238 | } |
|
|
239 | } |
|
|
240 | |
235 | the_exit->x = ix; |
241 | the_exit->x = ix; |
236 | the_exit->y = iy; |
242 | the_exit->y = iy; |
237 | |
243 | |
238 | if (!hole_type) |
244 | if (!hole_type) |
239 | hole_type = rndm (NR_OF_HOLE_TYPES) + 1; |
245 | hole_type = rndm (NR_OF_HOLE_TYPES) + 1; |