clear players for each update

This commit is contained in:
Bluub
2021-06-14 18:29:41 +02:00
parent 4c0e765f41
commit a712e42596
2 changed files with 9 additions and 7 deletions
@@ -17,6 +17,12 @@ namespace BBM
void IAControllableSystem::UpdateMapInfos(WAL::ViewEntity<PositionComponent, ControllableComponent, IAControllableComponent> &entity)
{
_players.clear();
for (auto &[other, pos, _] : _wal.getScene()->view<PositionComponent, TagComponent<Player>>()) {
if (static_cast<WAL::Entity>(entity).getUid() == other.getUid())
continue;
_players.push_back(MapInfo(pos.position, MapGenerator::NOTHING));
}
if (_cached)
return;
if (!_wal.getScene())
@@ -29,11 +35,6 @@ namespace BBM
_map.push_back(MapInfo(pos.position, MapGenerator::BUMPER));
for (auto &[other, pos, _] : _wal.getScene()->view<PositionComponent, TagComponent<Hole>>())
_map.push_back(MapInfo(pos.position, MapGenerator::HOLE));
for (auto &[other, pos, _] : _wal.getScene()->view<PositionComponent, TagComponent<Player>>()) {
if (static_cast<WAL::Entity>(entity).getUid() == other.getUid())
continue;
_players.push_back(MapInfo(pos.position, MapGenerator::NOTHING));
}
for (auto &[other, pos, bomb] : _wal.getScene()->view<PositionComponent, BasicBombComponent>())
_bombs.push_back(std::make_pair(pos.position, bomb.explosionRadius));
_cached = true;
@@ -131,7 +132,6 @@ namespace BBM
_cached = false;
_map.clear();
_bombs.clear();
_players.clear();
}
bool IAControllableSystem::isInExplosionRange(float x, float y, float z)