int seek_gold(object *monster) { short i, j, rn, s; if ((rn = get_room_number(monster->row, monster->col)) < 0) { return 0; } for (i = rooms[rn].top_row + 1; i < rooms[rn].bottom_row; i++) { for (j = rooms[rn].left_col + 1; j < rooms[rn].right_col; j++) { if ((gold_at(i, j)) && !(dungeon[i][j] & MONSTER)) { monster->m_flags |= CAN_FLIT; s = mon_can_go(monster, i, j); monster->m_flags &= (~CAN_FLIT); if (s) { move_mon_to(monster, i, j); monster->m_flags |= ASLEEP; monster->m_flags &= (~(WAKENS | SEEKS_GOLD)); return 1; } monster->m_flags &= (~SEEKS_GOLD); monster->m_flags |= CAN_FLIT; mv_monster(monster, i, j); monster->m_flags &= (~CAN_FLIT); monster->m_flags |= SEEKS_GOLD; return 1; } } } return 0; }
static int mtry(object *monster, short row, short col) { if (mon_can_go(monster, row, col)) { move_mon_to(monster, row, col); return(1); } return(0); }