Ejemplo n.º 1
0
bool TeleportAway::Zap(Coord dir)
{
    Monster* monster = get_monster_in_direction(dir, true);
    if (!monster)
        return true;

    //erase the monster from the screen
    if (game->hero().can_see_monster(monster))
        game->screen().add_tile(monster->position(), monster->tile_beneath());

    //pick a new location for the monster
    Coord new_pos;
    monster->invalidate_tile_beneath();
    find_empty_location(&new_pos, true);
    monster->set_position(new_pos);

    //the monster can no longer hold the player
    if (game->hero().is_held_by(monster)) {
        game->hero().clear_hold();
    }

    //the monster chases the player
    monster->start_run(&game->hero());

    return true;
}
Ejemplo n.º 2
0
void insert_at_loc(AList_WS* list, size_t prev, size_t next, double data) {
	if (list->current_size_limit == list->current_size)
		increase_size(list);

	size_t empty_cell = find_empty_location(list);
	list->data[empty_cell] = data;
	list->usage_data[empty_cell] = TRUE;

	list->next_data_addrs[empty_cell] = list->next_data_addrs[prev];
	list->next_data_addrs[prev] = empty_cell;

	list->current_size += 1;
}