… | |
… | |
118 | } |
118 | } |
119 | |
119 | |
120 | /* all the treasure at one spot in the map. */ |
120 | /* all the treasure at one spot in the map. */ |
121 | if (treasureoptions & CONCENTRATED) |
121 | if (treasureoptions & CONCENTRATED) |
122 | { |
122 | { |
123 | |
|
|
124 | /* map_layout_style global, and is previously set */ |
123 | /* map_layout_style global, and is previously set */ |
125 | switch (RP->map_layout_style) |
124 | switch (RP->map_layout_style) |
126 | { |
125 | { |
127 | case LAYOUT_ONION: |
126 | case LAYOUT_ONION: |
128 | case LAYOUT_SPIRAL: |
127 | case LAYOUT_SPIRAL: |
… | |
… | |
140 | int tdiv = RP->symmetry_used; |
139 | int tdiv = RP->symmetry_used; |
141 | object *chest; |
140 | object *chest; |
142 | |
141 | |
143 | if (tdiv == 3) |
142 | if (tdiv == 3) |
144 | tdiv = 2; /* this symmetry uses a divisor of 2 */ |
143 | tdiv = 2; /* this symmetry uses a divisor of 2 */ |
|
|
144 | |
145 | /* don't put a chest on an exit. */ |
145 | /* don't put a chest on an exit. */ |
146 | chest = place_chest (treasureoptions, i, j, map, style_map, num_treasures / tdiv, RP); |
146 | chest = place_chest (treasureoptions, i, j, map, style_map, num_treasures / tdiv, RP); |
147 | |
147 | |
148 | if (!chest) |
148 | if (!chest) |
149 | continue; /* if no chest was placed NEXT */ |
149 | continue; /* if no chest was placed NEXT */ |
… | |
… | |
170 | while (i == -1 && tries < 100) |
170 | while (i == -1 && tries < 100) |
171 | { |
171 | { |
172 | i = rndm (RP->Xsize - 2) + 1; |
172 | i = rndm (RP->Xsize - 2) + 1; |
173 | j = rndm (RP->Ysize - 2) + 1; |
173 | j = rndm (RP->Ysize - 2) + 1; |
174 | find_enclosed_spot (map, &i, &j, RP); |
174 | find_enclosed_spot (map, &i, &j, RP); |
|
|
175 | |
175 | if (wall_blocked (map, i, j)) |
176 | if (wall_blocked (map, i, j)) |
176 | i = -1; |
177 | i = -1; |
|
|
178 | |
177 | tries++; |
179 | tries++; |
178 | } |
180 | } |
|
|
181 | |
179 | chest = place_chest (treasureoptions, i, j, map, style_map, num_treasures, RP); |
182 | chest = place_chest (treasureoptions, i, j, map, style_map, num_treasures, RP); |
|
|
183 | |
180 | if (!chest) |
184 | if (!chest) |
181 | return; |
185 | return; |
|
|
186 | |
182 | i = chest->x; |
187 | i = chest->x; |
183 | j = chest->y; |
188 | j = chest->y; |
184 | if (treasureoptions & (DOORED | HIDDEN)) |
189 | if (treasureoptions & (DOORED | HIDDEN)) |
185 | { |
190 | { |
186 | doorlist = surround_by_doors (map, layout, i, j, treasureoptions); |
191 | doorlist = surround_by_doors (map, layout, i, j, treasureoptions); |
… | |
… | |
204 | } |
209 | } |
205 | |
210 | |
206 | /* put a chest into the map, near x and y, with the treasure style |
211 | /* put a chest into the map, near x and y, with the treasure style |
207 | determined (may be null, or may be a treasure list from lib/treasures, |
212 | determined (may be null, or may be a treasure list from lib/treasures, |
208 | if the global variable "treasurestyle" is set to that treasure list's name */ |
213 | if the global variable "treasurestyle" is set to that treasure list's name */ |
209 | |
|
|
210 | object * |
214 | object * |
211 | place_chest (int treasureoptions, int x, int y, maptile *map, maptile *style_map, int n_treasures, random_map_params *RP) |
215 | place_chest (int treasureoptions, int x, int y, maptile *map, maptile *style_map, int n_treasures, random_map_params *RP) |
212 | { |
216 | { |
213 | object *the_chest; |
217 | object *the_chest; |
214 | int i, xl, yl; |
218 | int i, xl, yl; |