From 001d37b257b126dd6ef1dced70f94ff3d2806d28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Dziwi=C5=84ski?= Date: Sat, 16 Feb 2013 22:37:43 +0100 Subject: 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 --- src/object/motion/motion.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'src/object/motion/motion.cpp') 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. -- cgit v1.2.3-1-g7c22