Exemplo n.º 1
0
void GameState::sayAround(Actor *obj, const std::string &text)
{
    Point speakerPosition = obj->getPosition();
    int visualRange = Configuration::getValue("game_visualRange", 448);

    for (CharacterIterator i(obj->getMap()->getAroundActorIterator(obj, visualRange)); i; ++i)
    {
        if (speakerPosition.inRangeOf((*i)->getPosition(), visualRange))
        {
            sayTo(*i, obj, text);
        }
    }
}
Exemplo n.º 2
0
void GameState::sayAround(Entity *entity, const std::string &text)
{
    Point speakerPosition = entity->getComponent<ActorComponent>()->getPosition();
    int visualRange = Configuration::getValue("game_visualRange", 448);

    for (CharacterIterator i(entity->getMap()->getAroundActorIterator(entity, visualRange)); i; ++i)
    {
        const Point &point =
                (*i)->getComponent<ActorComponent>()->getPosition();
        if (speakerPosition.inRangeOf(point, visualRange))
        {
            sayTo(*i, entity, text);
        }
    }
}