コード例 #1
0
static
void find_entities_in_area_c(dumb_ptr<block_list> target,
                             std::vector<int> *entities_vp,
                             FOREACH_FILTER filter)
{
    switch (target->bl_type)
    {

    case BL::PC:
        if (filter == FOREACH_FILTER::PC
                || filter == FOREACH_FILTER::ENTITY
                || (filter == FOREACH_FILTER::TARGET
                    && target->bl_m->flag.pvp))
            break;
        else if (filter == FOREACH_FILTER::SPELL)
        {   /* Check all spells bound to the caster */
            dumb_ptr<invocation> invoc = target->is_player()->active_spells;
            /* Add all spells locked onto thie PC */

            while (invoc)
            {
                entities_vp->push_back(invoc->bl_id);
                invoc = invoc->next_invocation;
            }
        }
        return;

    case BL::MOB:
        if (filter == FOREACH_FILTER::MOB
                || filter == FOREACH_FILTER::ENTITY
                || filter == FOREACH_FILTER::TARGET)
            break;
        else
            return;

    case BL::SPELL:
        if (filter == FOREACH_FILTER::SPELL)
        {
            dumb_ptr<invocation> invocation = target->is_spell();

            /* Check whether the spell is `bound'-- if so, we'll consider it iff we see the caster(case BL::PC). */
            if (bool(invocation->flags & INVOCATION_FLAG::BOUND))
                return;
            else
                break;      /* Add the spell */
        }
        else
            return;

    case BL::NPC:
        if (filter == FOREACH_FILTER::NPC)
            break;
        else
            return;

    default:
        return;
    }

    entities_vp->push_back(target->bl_id);
}