fixed compilation for latest versions
parent
7614b3b395
commit
03b2271621
|
@ -23,7 +23,7 @@ TreeNodeStatus TriggerCooldownOnSelection::doAction(backend::AICharacter& chr, l
|
|||
Npc& npc = ai->getCharacterCast<AICharacter>().getNpc();
|
||||
npc.cooldownMgr().triggerCooldown(_cooldownId);
|
||||
};
|
||||
zone->execute(id, func);
|
||||
zone->executeAsync(id, func);
|
||||
}
|
||||
return FINISHED;
|
||||
}
|
||||
|
|
|
@ -31,19 +31,17 @@ public:
|
|||
if (selection.empty())
|
||||
return false;
|
||||
|
||||
bool closeEnough = false;
|
||||
auto func = [&] (const ai::AIPtr& ai) {
|
||||
auto func = [&] (const ai::AIPtr& ai) -> bool {
|
||||
const Npc& npc = ai->getCharacterCast<AICharacter>().getNpc();
|
||||
const glm::vec3& pos = npc.pos();
|
||||
const ai::Vector3f& ownPos = entity->getCharacter()->getPosition();
|
||||
const int distance = ownPos.distance(ai::Vector3f(pos.x, pos.y, pos.z));
|
||||
if (distance <= _distance)
|
||||
closeEnough = true;
|
||||
return distance <= _distance;
|
||||
};
|
||||
|
||||
if (!zone->execute(selection[0], func))
|
||||
return false;
|
||||
return closeEnough;
|
||||
const AIPtr& selected = zone->getAI(selection[0]);
|
||||
auto future = zone->executeAsync(selected, func);
|
||||
return future.get();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -17,14 +17,14 @@ public:
|
|||
const FilteredEntities& selection = entity->getFilteredEntities();
|
||||
if (selection.empty())
|
||||
return true;
|
||||
bool alive = false;
|
||||
auto func = [&] (const AIPtr& ai) {
|
||||
static const auto func = [] (const AIPtr& ai) -> bool {
|
||||
AICharacter& chr = ai->getCharacterCast<AICharacter>();
|
||||
alive = !chr.getNpc().dead();
|
||||
return !chr.getNpc().dead();
|
||||
};
|
||||
if (!entity->getZone()->execute(selection[0], func))
|
||||
return false;
|
||||
return alive;
|
||||
const Zone* zone = entity->getZone();
|
||||
const AIPtr& selected = zone->getAI(selection[0]);
|
||||
auto future = zone->executeAsync(selected, func);
|
||||
return future.get();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ void SpawnMgr::spawnEntity(ai::Zone& zone, network::messages::NpcType start, net
|
|||
const int offset = start + 1;
|
||||
int count[end - offset];
|
||||
memset(count, 0, sizeof(count));
|
||||
zone.visit([&] (const ai::AIPtr& ai) {
|
||||
zone.execute([&] (const ai::AIPtr& ai) {
|
||||
const AICharacter& chr = ai::character_cast<AICharacter>(ai->getCharacter());
|
||||
const Npc& npc = chr.getNpc();
|
||||
const network::messages::NpcType type = npc.npcType();
|
||||
|
@ -74,7 +74,7 @@ int SpawnMgr::spawn(ai::Zone& zone, network::messages::NpcType type, int amount,
|
|||
NpcPtr npc(new Npc(type, _entityStorage, behaviour, _world, _messageSender, _timeProvider, _containerProvider, _poiProvider));
|
||||
npc->init(pos);
|
||||
// now let it tick
|
||||
zone.scheduleAdd(npc->ai());
|
||||
zone.addAI(npc->ai());
|
||||
_entityStorage->addNpc(npc);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue