[colobot] 33/74: Allow multiple objects with exactly the same distance to be returned by `radarall`

Didier Raboud odyx at moszumanska.debian.org
Mon Nov 7 07:50:02 UTC 2016


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch debian/master
in repository colobot.

commit 88227a3647e88508d817af236b81aeb4d5e522d0
Author: Jeremy Mickelson <Jeremy.Mickelson at gmail.com>
Date:   Sat Aug 13 12:13:41 2016 -0600

    Allow multiple objects with exactly the same distance to be returned by `radarall`
---
 src/object/object_manager.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/object/object_manager.cpp b/src/object/object_manager.cpp
index 9c1126c..0e6e28a 100644
--- a/src/object/object_manager.cpp
+++ b/src/object/object_manager.cpp
@@ -282,7 +282,8 @@ std::vector<CObject*> CObjectManager::RadarAll(CObject* pThis, Math::Vector this
     RadarFilter filter_flying = static_cast<RadarFilter>(filter & (FILTER_ONLYLANDING | FILTER_ONLYFLYING));
     RadarFilter filter_enemy = static_cast<RadarFilter>(filter & (FILTER_FRIENDLY | FILTER_ENEMY | FILTER_NEUTRAL));
 
-    std::map<float, CObject*> best;
+    std::multimap<float, CObject*> best;
+
     for ( auto it = m_objects.begin() ; it != m_objects.end() ; ++it )
     {
         pObj = it->second.get();
@@ -357,7 +358,7 @@ std::vector<CObject*> CObjectManager::RadarAll(CObject* pThis, Math::Vector this
         a = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z);  // CW !
         if ( Math::TestAngle(a, iAngle-focus/2.0f, iAngle+focus/2.0f) || focus >= Math::PI*2.0f )
         {
-            best[d] = pObj;
+            best.insert(std::make_pair(d, pObj));
         }
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git



More information about the Pkg-games-commits mailing list