diff options
author | Piotr Dziwiński <piotr.dziwinski@nsn.com> | 2013-02-16 22:37:43 +0100 |
---|---|---|
committer | Piotr Dziwiński <piotr.dziwinski@nsn.com> | 2013-02-17 12:11:56 +0100 |
commit | 001d37b257b126dd6ef1dced70f94ff3d2806d28 (patch) | |
tree | 1025979c635c899f196d606f7d74170e33ef4f3a /src/object/motion/motion.cpp | |
parent | 45040318b026f8864d244e39f1703685ad688470 (diff) | |
download | colobot-001d37b257b126dd6ef1dced70f94ff3d2806d28.tar.gz colobot-001d37b257b126dd6ef1dced70f94ff3d2806d28.tar.bz2 colobot-001d37b257b126dd6ef1dced70f94ff3d2806d28.zip |
CInstanceManager refactoring
* removed classes managed by CInstanceManager
except for CObject, CPyro, CBrain and CPhysics
because of dependencies
* refactored instance searching to use existing singleton instances of
CApplication, CEngine and CRobotMain and calling their getter
functions
Diffstat (limited to 'src/object/motion/motion.cpp')
-rw-r--r-- | src/object/motion/motion.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/object/motion/motion.cpp b/src/object/motion/motion.cpp index 605091f..00b3073 100644 --- a/src/object/motion/motion.cpp +++ b/src/object/motion/motion.cpp @@ -19,7 +19,7 @@ #include "app/app.h" -#include "common/iman.h" +#include "object/robotmain.h" #include "script/cmdtoken.h" @@ -30,20 +30,16 @@ // Object's constructor. -CMotion::CMotion(CInstanceManager* iMan, CObject* object) +CMotion::CMotion(CObject* object) { - m_iMan = iMan; - m_iMan->AddInstance(CLASS_MOTION, this, 100); - m_app = CApplication::GetInstancePointer(); - m_engine = static_cast< Gfx::CEngine* >(m_iMan->SearchInstance(CLASS_ENGINE)); - m_light = static_cast< Gfx::CLight* >(m_iMan->SearchInstance(CLASS_LIGHT)); - m_particle = static_cast< Gfx::CParticle* >(m_iMan->SearchInstance(CLASS_PARTICULE)); - m_terrain = static_cast< Gfx::CTerrain* >(m_iMan->SearchInstance(CLASS_TERRAIN)); - m_water = static_cast< Gfx::CWater* >(m_iMan->SearchInstance(CLASS_WATER)); - m_camera = static_cast< Gfx::CCamera* >(m_iMan->SearchInstance(CLASS_CAMERA)); - m_main = static_cast< CRobotMain* >(m_iMan->SearchInstance(CLASS_MAIN)); - m_sound = static_cast< CSoundInterface* >(m_iMan->SearchInstance(CLASS_SOUND)); + m_sound = m_app->GetSound(); + m_engine = Gfx::CEngine::GetInstancePointer(); + m_particle = m_engine->GetParticle(); + m_water = m_engine->GetWater(); + m_main = CRobotMain::GetInstancePointer(); + m_terrain = m_main->GetTerrain(); + m_camera = m_main->GetCamera(); m_object = object; m_physics = 0; @@ -62,7 +58,6 @@ CMotion::CMotion(CInstanceManager* iMan, CObject* object) CMotion::~CMotion() { - m_iMan->DeleteInstance(CLASS_MOTION, this); } // Deletes the object. |