[colobot] 321/390: Fixed Vault not unlocking vehicle (#459)

Didier Raboud odyx at moszumanska.debian.org
Fri Jun 12 14:22:00 UTC 2015


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

odyx pushed a commit to branch upstream/latest
in repository colobot.

commit be74b61ad3c426bf76422a3cd5ab38e44f07347d
Author: krzys-h <krzys_h at interia.pl>
Date:   Fri Apr 17 21:28:30 2015 +0200

    Fixed Vault not unlocking vehicle (#459)
---
 src/object/auto/autosafe.cpp | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/object/auto/autosafe.cpp b/src/object/auto/autosafe.cpp
index 03c851c..e147ab2 100644
--- a/src/object/auto/autosafe.cpp
+++ b/src/object/auto/autosafe.cpp
@@ -574,6 +574,23 @@ void CAutoSafe::DeleteKeys()
 
 CObject* CAutoSafe::SearchVehicle()
 {
-    return CObjectManager::GetInstancePointer()->FindNearest(m_object, OBJECT_NULL, 4.0f/g_unit);
+    CObject*    pObj;
+    Math::Vector    cPos, oPos;
+    float       dist;
+
+    cPos = m_object->GetPosition(0);
+
+    for(auto it : CObjectManager::GetInstancePointer()->GetAllObjects())
+    {
+        pObj = it.second;
+
+        if ( pObj == m_object )  continue;
+        if ( pObj->GetTruck() != 0 )  continue;
+
+        oPos = pObj->GetPosition(0);
+        dist = Math::DistanceProjected(oPos, cPos);
+        if ( dist <= 4.0f )  return pObj;
+    }
+    return 0;
 }
 

-- 
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