1 | |
1 | |
2 | /* |
2 | /* |
3 | CrossFire, A Multiplayer game for X-windows |
3 | CrossFire, A Multiplayer game for X-windows |
4 | |
4 | |
|
|
5 | Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
5 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
6 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
6 | Copyright (C) 1992 Frank Tore Johansen |
7 | Copyright (C) 1992 Frank Tore Johansen |
7 | |
8 | |
8 | This program is free software; you can redistribute it and/or modify |
9 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by |
10 | it under the terms of the GNU General Public License as published by |
… | |
… | |
167 | |
168 | |
168 | while (i < 0 && tries < 10) |
169 | while (i < 0 && tries < 10) |
169 | { |
170 | { |
170 | ix = RANDOM () % (map->width - 2) + 1; |
171 | ix = RANDOM () % (map->width - 2) + 1; |
171 | iy = RANDOM () % (map->height - 2) + 1; |
172 | iy = RANDOM () % (map->height - 2) + 1; |
172 | i = find_first_free_spot (fountain, map, ix, iy); |
173 | i = find_free_spot (fountain, map, ix, iy, 1, SIZEOFFREE1 + 1); |
173 | tries++; |
174 | tries++; |
174 | } |
175 | } |
175 | |
176 | |
176 | if (i == -1) |
177 | if (i == -1) |
177 | { /* can't place fountain */ |
178 | { /* can't place fountain */ |
… | |
… | |
191 | potion->material = M_ADAMANT; |
192 | potion->material = M_ADAMANT; |
192 | fountain->x = ix; |
193 | fountain->x = ix; |
193 | fountain->y = iy; |
194 | fountain->y = iy; |
194 | insert_ob_in_map (fountain, map, NULL, 0); |
195 | insert_ob_in_map (fountain, map, NULL, 0); |
195 | insert_ob_in_map (potion, map, NULL, 0); |
196 | insert_ob_in_map (potion, map, NULL, 0); |
196 | |
|
|
197 | } |
197 | } |
198 | |
198 | |
199 | void |
199 | void |
200 | place_special_exit (maptile *map, int hole_type, random_map_params *RP) |
200 | place_special_exit (maptile *map, int hole_type, random_map_params *RP) |
201 | { |
201 | { |
202 | int ix, iy, i = -1; |
202 | int ix, iy, i = -1; |
203 | char buf[HUGE_BUF], *style, *decor, *mon; |
203 | char buf[16384], *style, *decor, *mon; |
204 | maptile *exit_style = find_style ("/styles/misc", "obscure_exits", -1); |
204 | maptile *exit_style = find_style ("/styles/misc", "obscure_exits", -1); |
205 | int g_xsize, g_ysize; |
205 | int g_xsize, g_ysize; |
206 | |
206 | |
207 | object *the_exit = object::create (); |
207 | object *the_exit = object::create (); |
208 | |
208 | |
… | |
… | |
213 | |
213 | |
214 | while (i < 0) |
214 | while (i < 0) |
215 | { |
215 | { |
216 | ix = RANDOM () % (map->width - 2) + 1; |
216 | ix = RANDOM () % (map->width - 2) + 1; |
217 | iy = RANDOM () % (map->height - 2) + 1; |
217 | iy = RANDOM () % (map->height - 2) + 1; |
218 | i = find_first_free_spot (the_exit, map, ix, iy); |
218 | i = find_free_spot (the_exit, map, ix, iy, 1, SIZEOFFREE1 + 1); |
219 | } |
219 | } |
220 | |
220 | |
221 | ix += freearr_x[i]; |
221 | ix += freearr_x[i]; |
222 | iy += freearr_y[i]; |
222 | iy += freearr_y[i]; |
223 | the_exit->x = ix; |
223 | the_exit->x = ix; |