… | |
… | |
212 | if (i == -1) |
212 | if (i == -1) |
213 | { |
213 | { |
214 | the_chest->destroy (); |
214 | the_chest->destroy (); |
215 | return NULL; |
215 | return NULL; |
216 | } |
216 | } |
|
|
217 | |
217 | xl = x + freearr_x[i]; |
218 | xl = x + freearr_x[i]; |
218 | yl = y + freearr_y[i]; |
219 | yl = y + freearr_y[i]; |
219 | |
220 | |
220 | /* if the placement is blocked, return a fail. */ |
221 | /* if the placement is blocked, return a fail. */ |
221 | if (wall_blocked (map, xl, yl)) |
222 | if (wall_blocked (map, xl, yl)) |
… | |
… | |
656 | *cy = ly; |
657 | *cy = ly; |
657 | return; |
658 | return; |
658 | } |
659 | } |
659 | } |
660 | } |
660 | /* give up and return the closest free spot. */ |
661 | /* give up and return the closest free spot. */ |
661 | i = find_first_free_spot (&archetype::find ("chest")->clone, map, x, y); |
662 | i = find_free_spot (&archetype::find ("chest")->clone, map, x, y, 1, SIZEOFFREE1 + 1); |
662 | if (i != -1 && i <= SIZEOFFREE1) |
663 | |
|
|
664 | if (i != -1) |
663 | { |
665 | { |
664 | *cx = x + freearr_x[i]; |
666 | *cx = x + freearr_x[i]; |
665 | *cy = y + freearr_y[i]; |
667 | *cy = y + freearr_y[i]; |
666 | return; |
668 | } |
|
|
669 | else |
667 | } |
670 | { |
668 | /* indicate failure */ |
671 | /* indicate failure */ |
|
|
672 | *cx = -1; |
669 | *cx = *cy = -1; |
673 | *cy = -1; |
|
|
674 | } |
670 | } |
675 | } |
671 | |
676 | |
672 | |
677 | |
673 | void |
678 | void |
674 | remove_monsters (int x, int y, maptile *map) |
679 | remove_monsters (int x, int y, maptile *map) |