… | |
… | |
98 | for (int tries = 0; tries < 20; tries++) |
98 | for (int tries = 0; tries < 20; tries++) |
99 | { |
99 | { |
100 | blocked = 0; |
100 | blocked = 0; |
101 | |
101 | |
102 | /* pick a random location in the layout */ |
102 | /* pick a random location in the layout */ |
103 | i = rmg_rndm (map->width - xsize - 2) + 1; |
103 | i = rmg_rndm (1, map->width - xsize - 2); |
104 | j = rmg_rndm (map->height - ysize - 2) + 1; |
104 | j = rmg_rndm (1, map->height - ysize - 2); |
105 | |
105 | |
106 | for (int l = i; l < i + xsize; l++) |
106 | for (int l = i; l < i + xsize; l++) |
107 | for (int m = j; m < j + ysize; m++) |
107 | for (int m = j; m < j + ysize; m++) |
108 | { |
108 | { |
109 | blocked = 1; |
109 | blocked = 1; |
… | |
… | |
118 | if (blocked) |
118 | if (blocked) |
119 | { /* failure, try a relaxed placer. */ |
119 | { /* failure, try a relaxed placer. */ |
120 | /* pick a random location in the layout */ |
120 | /* pick a random location in the layout */ |
121 | for (int tries = 0; tries < 10; tries++) |
121 | for (int tries = 0; tries < 10; tries++) |
122 | { |
122 | { |
123 | i = rmg_rndm (map->width - xsize - 2) + 1; |
123 | i = rmg_rndm (1, map->width - xsize - 2); |
124 | j = rmg_rndm (map->height - ysize - 2) + 1; |
124 | j = rmg_rndm (1, map->height - ysize - 2); |
125 | |
125 | |
126 | blocked = 0; |
126 | blocked = 0; |
127 | |
127 | |
128 | for (int l = i; l < i + xsize; l++) |
128 | for (int l = i; l < i + xsize; l++) |
129 | for (int m = j; m < j + ysize; m++) |
129 | for (int m = j; m < j + ysize; m++) |
… | |
… | |
210 | object *the_exit = exit_style->pick_random_object (rmg_rndm)->clone (); |
210 | object *the_exit = exit_style->pick_random_object (rmg_rndm)->clone (); |
211 | |
211 | |
212 | // put an upper bound here, just in case |
212 | // put an upper bound here, just in case |
213 | for (int repeat = 8192; --repeat; ) |
213 | for (int repeat = 8192; --repeat; ) |
214 | { |
214 | { |
215 | ix = rmg_rndm (map->width - 2) + 1; |
215 | ix = rmg_rndm (1, map->width - 2); |
216 | iy = rmg_rndm (map->height - 2) + 1; |
216 | iy = rmg_rndm (1, map->height - 2); |
217 | |
217 | |
218 | i = find_free_spot (the_exit, map, ix, iy, 1, SIZEOFFREE1 + 1); |
218 | i = find_free_spot (the_exit, map, ix, iy, 1, SIZEOFFREE1 + 1); |
219 | if (i >= 0) |
219 | if (i >= 0) |
220 | { |
220 | { |
221 | ix += freearr_x[i]; |
221 | ix += freearr_x[i]; |