… | |
… | |
312 | /* boundscheck */ |
312 | /* boundscheck */ |
313 | if (lx >= 0 && ly >= 0 && lx < RP->Xsize && ly < RP->Ysize) |
313 | if (lx >= 0 && ly >= 0 && lx < RP->Xsize && ly < RP->Ysize) |
314 | /* don't bother searching this square unless the map says life exists. */ |
314 | /* don't bother searching this square unless the map says life exists. */ |
315 | if (GET_MAP_FLAGS (map, lx, ly) & P_IS_ALIVE) |
315 | if (GET_MAP_FLAGS (map, lx, ly) & P_IS_ALIVE) |
316 | { |
316 | { |
317 | object *the_monster = get_map_ob (map, lx, ly); |
317 | object *the_monster = GET_MAP_OB (map, lx, ly); |
318 | |
318 | |
319 | for (; the_monster != NULL && (!QUERY_FLAG (the_monster, FLAG_MONSTER)); the_monster = the_monster->above); |
319 | for (; the_monster != NULL && (!QUERY_FLAG (the_monster, FLAG_MONSTER)); the_monster = the_monster->above); |
320 | if (the_monster && QUERY_FLAG (the_monster, FLAG_MONSTER)) |
320 | if (the_monster && QUERY_FLAG (the_monster, FLAG_MONSTER)) |
321 | return the_monster; |
321 | return the_monster; |
322 | } |
322 | } |
… | |
… | |
453 | /* check the current square for a monster. If there is one, |
453 | /* check the current square for a monster. If there is one, |
454 | set theMonsterToFind and return it. */ |
454 | set theMonsterToFind and return it. */ |
455 | layout[x][y] = 1; |
455 | layout[x][y] = 1; |
456 | if (GET_MAP_FLAGS (map, x, y) & P_IS_ALIVE) |
456 | if (GET_MAP_FLAGS (map, x, y) & P_IS_ALIVE) |
457 | { |
457 | { |
458 | object *the_monster = get_map_ob (map, x, y); |
458 | object *the_monster = GET_MAP_OB (map, x, y); |
459 | |
459 | |
460 | /* check off this point */ |
460 | /* check off this point */ |
461 | for (; the_monster != NULL && (!QUERY_FLAG (the_monster, FLAG_ALIVE)); the_monster = the_monster->above); |
461 | for (; the_monster != NULL && (!QUERY_FLAG (the_monster, FLAG_ALIVE)); the_monster = the_monster->above); |
462 | if (the_monster && QUERY_FLAG (the_monster, FLAG_ALIVE)) |
462 | if (the_monster && QUERY_FLAG (the_monster, FLAG_ALIVE)) |
463 | { |
463 | { |
… | |
… | |
673 | void |
673 | void |
674 | remove_monsters (int x, int y, maptile *map) |
674 | remove_monsters (int x, int y, maptile *map) |
675 | { |
675 | { |
676 | object *tmp; |
676 | object *tmp; |
677 | |
677 | |
678 | for (tmp = get_map_ob (map, x, y); tmp != NULL; tmp = tmp->above) |
678 | for (tmp = GET_MAP_OB (map, x, y); tmp != NULL; tmp = tmp->above) |
679 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) |
679 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) |
680 | { |
680 | { |
681 | if (tmp->head) |
681 | if (tmp->head) |
682 | tmp = tmp->head; |
682 | tmp = tmp->head; |
683 | tmp->remove (); |
683 | tmp->remove (); |
684 | tmp->destroy (); |
684 | tmp->destroy (); |
685 | tmp = get_map_ob (map, x, y); |
685 | tmp = GET_MAP_OB (map, x, y); |
686 | if (tmp == NULL) |
686 | if (tmp == NULL) |
687 | break; |
687 | break; |
688 | }; |
688 | }; |
689 | } |
689 | } |
690 | |
690 | |
… | |
… | |
739 | object * |
739 | object * |
740 | door_in_square (maptile *map, int x, int y) |
740 | door_in_square (maptile *map, int x, int y) |
741 | { |
741 | { |
742 | object *tmp; |
742 | object *tmp; |
743 | |
743 | |
744 | for (tmp = get_map_ob (map, x, y); tmp != NULL; tmp = tmp->above) |
744 | for (tmp = GET_MAP_OB (map, x, y); tmp != NULL; tmp = tmp->above) |
745 | if (tmp->type == DOOR || tmp->type == LOCKED_DOOR) |
745 | if (tmp->type == DOOR || tmp->type == LOCKED_DOOR) |
746 | return tmp; |
746 | return tmp; |
747 | return NULL; |
747 | return NULL; |
748 | } |
748 | } |
749 | |
749 | |