… | |
… | |
80 | treasureoptions = RANDOM () % (2 * LAST_OPTION); |
80 | treasureoptions = RANDOM () % (2 * LAST_OPTION); |
81 | |
81 | |
82 | /* filter out the mutually exclusive options */ |
82 | /* filter out the mutually exclusive options */ |
83 | if ((treasureoptions & RICH) && (treasureoptions & SPARSE)) |
83 | if ((treasureoptions & RICH) && (treasureoptions & SPARSE)) |
84 | { |
84 | { |
85 | if (RANDOM () % 2) |
85 | if (rndm (2)) |
86 | treasureoptions -= 1; |
86 | treasureoptions -= 1; |
87 | else |
87 | else |
88 | treasureoptions -= 2; |
88 | treasureoptions -= 2; |
89 | } |
89 | } |
90 | |
90 | |
… | |
… | |
463 | return theMonsterToFind; |
463 | return theMonsterToFind; |
464 | } |
464 | } |
465 | } |
465 | } |
466 | |
466 | |
467 | /* now search all the 8 squares around recursively for a monster,in random order */ |
467 | /* now search all the 8 squares around recursively for a monster,in random order */ |
468 | for (i = RANDOM () % 8, j = 0; j < 8 && theMonsterToFind == NULL; i++, j++) |
468 | for (i = rndm (8), j = 0; j < 8 && theMonsterToFind == NULL; i++, j++) |
469 | { |
469 | { |
470 | theMonsterToFind = find_monster_in_room_recursive (layout, map, x + freearr_x[i % 8 + 1], y + freearr_y[i % 8 + 1], RP); |
470 | theMonsterToFind = find_monster_in_room_recursive (layout, map, x + freearr_x[i % 8 + 1], y + freearr_y[i % 8 + 1], RP); |
471 | if (theMonsterToFind != NULL) |
471 | if (theMonsterToFind != NULL) |
472 | return theMonsterToFind; |
472 | return theMonsterToFind; |
473 | } |
473 | } |
… | |
… | |
536 | room_free_spots_x[number_of_free_spots_in_room] = x; |
536 | room_free_spots_x[number_of_free_spots_in_room] = x; |
537 | room_free_spots_y[number_of_free_spots_in_room] = y; |
537 | room_free_spots_y[number_of_free_spots_in_room] = y; |
538 | number_of_free_spots_in_room++; |
538 | number_of_free_spots_in_room++; |
539 | |
539 | |
540 | /* now search all the 8 squares around recursively for free spots,in random order */ |
540 | /* now search all the 8 squares around recursively for free spots,in random order */ |
541 | for (i = RANDOM () % 8, j = 0; j < 8 && theMonsterToFind == NULL; i++, j++) |
541 | for (i = rndm (8), j = 0; j < 8 && theMonsterToFind == NULL; i++, j++) |
542 | find_spot_in_room_recursive (layout, x + freearr_x[i % 8 + 1], y + freearr_y[i % 8 + 1], RP); |
542 | find_spot_in_room_recursive (layout, x + freearr_x[i % 8 + 1], y + freearr_y[i % 8 + 1], RP); |
543 | |
543 | |
544 | } |
544 | } |
545 | |
545 | |
546 | /* find a random non-blocked spot in this room to drop a key. */ |
546 | /* find a random non-blocked spot in this room to drop a key. */ |
… | |
… | |
775 | } |
775 | } |
776 | else |
776 | else |
777 | { |
777 | { |
778 | layout[x][y] = 1; |
778 | layout[x][y] = 1; |
779 | /* now search all the 8 squares around recursively for free spots,in random order */ |
779 | /* now search all the 8 squares around recursively for free spots,in random order */ |
780 | for (i = RANDOM () % 8, j = 0; j < 8 && theMonsterToFind == NULL; i++, j++) |
780 | for (i = rndm (8), j = 0; j < 8 && theMonsterToFind == NULL; i++, j++) |
781 | find_doors_in_room_recursive (layout, map, x + freearr_x[i % 8 + 1], y + freearr_y[i % 8 + 1], doorlist, ndoors, RP); |
781 | find_doors_in_room_recursive (layout, map, x + freearr_x[i % 8 + 1], y + freearr_y[i % 8 + 1], doorlist, ndoors, RP); |
782 | } |
782 | } |
783 | } |
783 | } |
784 | |
784 | |
785 | /* find a random non-blocked spot in this room to drop a key. */ |
785 | /* find a random non-blocked spot in this room to drop a key. */ |