[colobot] 289/390: Made bf55691e444ec6b6cda8ff7d69d418fd50befaa6 work with new CObjectManager
Didier Raboud
odyx at moszumanska.debian.org
Fri Jun 12 14:21:55 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 7578f3c118b4db74a070e7a7d6f9d670e878efd3
Author: krzys-h <krzys_h at interia.pl>
Date: Sun Mar 22 14:50:54 2015 +0100
Made bf55691e444ec6b6cda8ff7d69d418fd50befaa6 work with new CObjectManager
---
src/object/task/taskdeletemark.cpp | 57 +++++++++++++-------------------------
1 file changed, 19 insertions(+), 38 deletions(-)
diff --git a/src/object/task/taskdeletemark.cpp b/src/object/task/taskdeletemark.cpp
index 733555f..98f062b 100644
--- a/src/object/task/taskdeletemark.cpp
+++ b/src/object/task/taskdeletemark.cpp
@@ -20,17 +20,17 @@
#include "object/task/taskdeletemark.h"
-#include "common/iman.h"
#include "graphics/engine/particle.h"
#include "graphics/engine/terrain.h"
+#include "object/objman.h"
+#include "object/robotmain.h"
+
#include "math/geometry.h"
#include "physics/physics.h"
-#include "object/robotmain.h"
-
CTaskDeleteMark::CTaskDeleteMark(CObject* object) : CTask(object)
{
@@ -41,12 +41,10 @@ CTaskDeleteMark::~CTaskDeleteMark()
{
}
-
// Management of an event.
-
bool CTaskDeleteMark::EventProcess(const Event &event)
{
-
+ return true;
}
Error CTaskDeleteMark::Start()
@@ -59,17 +57,15 @@ Error CTaskDeleteMark::Start()
}
// Indicates whether the action is finished.
-
Error CTaskDeleteMark::IsEnded()
{
if ( m_bExecuted )
- return ERR_STOP;
+ return ERR_STOP;
else
- return ERR_CONTINUE;
+ return ERR_CONTINUE;
}
// Suddenly ends the current action.
-
bool CTaskDeleteMark::Abort()
{
return true;
@@ -77,34 +73,19 @@ bool CTaskDeleteMark::Abort()
void CTaskDeleteMark::DeleteMark()
{
- ObjectType type;
- CObject* pObj;
- Math::Vector oPos=m_object->GetPosition(0);
- int i;
-
- CInstanceManager* iMan = CInstanceManager::GetInstancePointer();
-
- for ( i=0 ; i<1000000 ; i++ )
+ CObject* pObj = CObjectManager::GetInstancePointer()->FindNearest(m_object, {
+ OBJECT_MARKPOWER,
+ OBJECT_MARKSTONE,
+ OBJECT_MARKURANIUM,
+ OBJECT_MARKKEYa,
+ OBJECT_MARKKEYb,
+ OBJECT_MARKKEYc,
+ OBJECT_MARKKEYd
+ }, 8.0f/g_unit);
+
+ if(pObj != nullptr)
{
- pObj = static_cast<CObject*>(iMan->SearchInstance(CLASS_OBJECT, i));
- if ( pObj == 0 ) break;
-
- type = pObj->GetType();
-
- if ( type == OBJECT_MARKPOWER ||
- type == OBJECT_MARKSTONE ||
- type == OBJECT_MARKURANIUM ||
- type == OBJECT_MARKKEYa ||
- type == OBJECT_MARKKEYb ||
- type == OBJECT_MARKKEYc ||
- type == OBJECT_MARKKEYd )
- {
- if ( Math::Distance(oPos, pObj->GetPosition(0)) < 8.0f )
- {
- pObj->DeleteObject(); // removes the mark
- delete pObj;
- break;
- }
- }
+ pObj->DeleteObject(); // removes the mark
+ delete pObj;
}
}
\ No newline at end of file
--
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