From a712e42596a66c6e56aafc3089b7f79264d993a5 Mon Sep 17 00:00:00 2001 From: Bluub Date: Mon, 14 Jun 2021 18:29:41 +0200 Subject: [PATCH] clear players for each update --- .../System/IAControllable/IAControllableSystem.cpp | 12 ++++++------ todolua | 4 +++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/sources/System/IAControllable/IAControllableSystem.cpp b/sources/System/IAControllable/IAControllableSystem.cpp index cf88ef17..982234de 100644 --- a/sources/System/IAControllable/IAControllableSystem.cpp +++ b/sources/System/IAControllable/IAControllableSystem.cpp @@ -17,6 +17,12 @@ namespace BBM void IAControllableSystem::UpdateMapInfos(WAL::ViewEntity &entity) { + _players.clear(); + for (auto &[other, pos, _] : _wal.getScene()->view>()) { + if (static_cast(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>()) _map.push_back(MapInfo(pos.position, MapGenerator::HOLE)); - for (auto &[other, pos, _] : _wal.getScene()->view>()) { - if (static_cast(entity).getUid() == other.getUid()) - continue; - _players.push_back(MapInfo(pos.position, MapGenerator::NOTHING)); - } for (auto &[other, pos, bomb] : _wal.getScene()->view()) _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) diff --git a/todolua b/todolua index ccf1ad93..11ae44bb 100644 --- a/todolua +++ b/todolua @@ -4,4 +4,6 @@ [ ] Closest Player [ ] GetPath to Point [ ] Closest Bonus - [ ] isInExplosionrRange \ No newline at end of file + [ ] isInExplosionrRange + +how do i do it ? \ No newline at end of file