… | |
… | |
497 | /* sets up some data structures: the _recursive form does the |
497 | /* sets up some data structures: the _recursive form does the |
498 | real work. */ |
498 | real work. */ |
499 | static object * |
499 | static object * |
500 | find_monster_in_room (maptile *map, int x, int y, random_map_params *RP) |
500 | find_monster_in_room (maptile *map, int x, int y, random_map_params *RP) |
501 | { |
501 | { |
502 | Layout layout2 (RP); |
502 | Layout layout2 (map->width, map->height); |
503 | |
503 | |
504 | layout2->clear (); |
504 | // find walls |
505 | |
|
|
506 | /* allocate and copy the layout, converting C to 0. */ |
|
|
507 | for (int i = 0; i < layout2->w; i++) |
505 | for (int i = 0; i < layout2.w; i++) |
508 | for (int j = 0; j < layout2->h; j++) |
506 | for (int j = 0; j < layout2.h; j++) |
509 | if (wall_blocked (map, i, j)) |
507 | layout2[i][j] = wall_blocked (map, i, j) ? '#' : 0; |
510 | layout2[i][j] = '#'; |
|
|
511 | |
508 | |
512 | theMonsterToFind = 0; |
509 | theMonsterToFind = 0; |
513 | theMonsterToFind = find_monster_in_room_recursive (layout2, map, x, y, RP); |
510 | theMonsterToFind = find_monster_in_room_recursive (layout2, map, x, y, RP); |
514 | |
|
|
515 | layout2.free (); |
|
|
516 | |
511 | |
517 | return theMonsterToFind; |
512 | return theMonsterToFind; |
518 | } |
513 | } |
519 | |
514 | |
520 | /* a datastructure needed by find_spot_in_room and find_spot_in_room_recursive */ |
515 | /* a datastructure needed by find_spot_in_room and find_spot_in_room_recursive */ |
… | |
… | |
791 | int i, j; |
786 | int i, j; |
792 | int ndoors = 0; |
787 | int ndoors = 0; |
793 | |
788 | |
794 | object **doorlist = (object **)calloc (sizeof (int), 1024); |
789 | object **doorlist = (object **)calloc (sizeof (int), 1024); |
795 | |
790 | |
796 | LayoutData layout2 (RP->Xsize, RP->Ysize); |
791 | Layout layout2 (RP->Xsize, RP->Ysize); |
797 | layout2.clear (); |
792 | layout2.clear (); |
798 | |
793 | |
799 | /* allocate and copy the layout, converting C to 0. */ |
794 | /* allocate and copy the layout, converting C to 0. */ |
800 | for (i = 0; i < RP->Xsize; i++) |
795 | for (i = 0; i < RP->Xsize; i++) |
801 | for (j = 0; j < RP->Ysize; j++) |
796 | for (j = 0; j < RP->Ysize; j++) |