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/graphics/engine/water.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'src/graphics/engine/water.cpp') diff --git a/src/graphics/engine/water.cpp b/src/graphics/engine/water.cpp index 6c822b3..d90652b 100644 --- a/src/graphics/engine/water.cpp +++ b/src/graphics/engine/water.cpp @@ -18,7 +18,8 @@ #include "graphics/engine/water.h" -#include "common/iman.h" +#include "app/app.h" + #include "common/logger.h" #include "graphics/core/device.h" @@ -28,6 +29,7 @@ #include "math/geometry.h" #include "object/object.h" +#include "object/robotmain.h" #include "sound/sound.h" @@ -42,14 +44,11 @@ const int WATERLINE_PREALLOCATE_COUNT = 500; const int VAPOR_SIZE = 10; -CWater::CWater(CInstanceManager* iMan, CEngine* engine) +CWater::CWater(CEngine* engine) { - m_iMan = iMan; - m_iMan->AddInstance(CLASS_WATER, this); - m_engine = engine; m_terrain = nullptr; - m_particule = nullptr; + m_particle = nullptr; m_sound = nullptr; m_type[0] = WATER_NULL; @@ -67,10 +66,9 @@ CWater::CWater(CInstanceManager* iMan, CEngine* engine) CWater::~CWater() { - m_iMan = nullptr; m_engine = nullptr; m_terrain = nullptr; - m_particule = nullptr; + m_particle = nullptr; m_sound = nullptr; } @@ -99,8 +97,8 @@ bool CWater::EventFrame(const Event &event) void CWater::LavaFrame(float rTime) { - if (m_particule == nullptr) - m_particule = static_cast( m_iMan->SearchInstance(CLASS_PARTICULE) ); + if (m_particle == nullptr) + m_particle = m_engine->GetParticle(); for (int i = 0; i < static_cast( m_vapors.size() ); i++) VaporFrame(i, rTime); @@ -183,7 +181,7 @@ void CWater::VaporFrame(int i, float rTime) m_vapors[i].time += rTime; if (m_sound == nullptr) - m_sound = static_cast(m_iMan->SearchInstance(CLASS_SOUND)); + m_sound = CApplication::GetInstancePointer()->GetSound(); if (m_vapors[i].time <= m_vapors[i].delay) { @@ -206,7 +204,7 @@ void CWater::VaporFrame(int i, float rTime) Math::Point dim; dim.x = Math::Rand()*1.5f+1.5f; dim.y = dim.x; - m_particule->CreateParticle(pos, speed, dim, PARTIERROR, 2.0f, 10.0f); + m_particle->CreateParticle(pos, speed, dim, PARTIERROR, 2.0f, 10.0f); } } else if (m_vapors[i].type == PARTIFLAME) @@ -222,7 +220,7 @@ void CWater::VaporFrame(int i, float rTime) Math::Point dim; dim.x = Math::Rand()*2.0f+2.0f; dim.y = dim.x; - m_particule->CreateParticle(pos, speed, dim, PARTIFLAME); + m_particle->CreateParticle(pos, speed, dim, PARTIFLAME); } else { @@ -237,7 +235,7 @@ void CWater::VaporFrame(int i, float rTime) Math::Point dim; dim.x = Math::Rand()*1.0f+1.0f; dim.y = dim.x; - m_particule->CreateParticle(pos, speed, dim, PARTIVAPOR); + m_particle->CreateParticle(pos, speed, dim, PARTIVAPOR); } } } @@ -497,7 +495,7 @@ void CWater::Create(WaterType type1, WaterType type2, const std::string& fileNam m_engine->LoadTexture(m_fileName); if (m_terrain == nullptr) - m_terrain = static_cast(m_iMan->SearchInstance(CLASS_TERRAIN)); + m_terrain = CRobotMain::GetInstancePointer()->GetTerrain(); m_brickCount = m_terrain->GetBrickCount()*m_terrain->GetMosaicCount(); m_brickSize = m_terrain->GetBrickSize(); -- cgit v1.2.3-1-g7c22