From 2a4a5e13cc9430eb9485bbfcd86af67385a63485 Mon Sep 17 00:00:00 2001 From: MarcEricMartel Date: Mon, 30 Oct 2023 15:42:02 -0400 Subject: [PATCH] Correction pour pr20 --- SQCSim-common/bullet.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/SQCSim-common/bullet.cpp b/SQCSim-common/bullet.cpp index d59d635..09dde11 100644 --- a/SQCSim-common/bullet.cpp +++ b/SQCSim-common/bullet.cpp @@ -13,22 +13,12 @@ bool Bullet::Update(World* world, float elapsedtime, int perframe, std::map::iterator it = mapPlayer.begin(); - - while (it != mapPlayer.end()) - { - - Player* player = it->second; - Vector3f playerPos = player->GetPosition(); - if (playerPos == m_currentpos) - { + for (auto& [key, player] : mapPlayer) { + if ((m_currentpos - player->GetPosition()).Length() < .4f) { player->InflictDamage(damage); return true; } - it++; } - if (!world->ChunkAt(m_currentpos)) return true;