[colobot] 265/390: Fixed weird Converter behaviour, closes #431
Didier Raboud
odyx at moszumanska.debian.org
Fri Jun 12 14:21:53 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 6d85db53140332170904502e030aa0681ec7f593
Author: krzys-h <krzys_h at interia.pl>
Date: Sun Mar 8 16:05:14 2015 +0100
Fixed weird Converter behaviour, closes #431
---
src/object/auto/autoconvert.cpp | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/src/object/auto/autoconvert.cpp b/src/object/auto/autoconvert.cpp
index 1a25bf7..c56a129 100644
--- a/src/object/auto/autoconvert.cpp
+++ b/src/object/auto/autoconvert.cpp
@@ -398,7 +398,28 @@ bool CAutoConvert::Read(CLevelParserLine* line)
CObject* CAutoConvert::SearchStone(ObjectType type)
{
- return CObjectManager::GetInstancePointer()->FindNearest(m_object, type, 5.0f/g_unit);
+ CObject* pObj;
+ Math::Vector cPos, oPos;
+ ObjectType oType;
+ float dist;
+
+ cPos = m_object->GetPosition(0);
+
+ for(auto it : CObjectManager::GetInstancePointer()->GetAllObjects())
+ {
+ pObj = it.second;
+
+ oType = pObj->GetType();
+ if ( oType != type ) continue;
+ if ( pObj->GetTruck() != 0 ) continue;
+
+ oPos = pObj->GetPosition(0);
+ dist = Math::Distance(oPos, cPos);
+
+ if ( dist <= 5.0f ) return pObj;
+ }
+
+ return 0;
}
// Search if a vehicle is too close.
--
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