mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-26 15:58:12 +00:00
clear players for each update
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user