summaryrefslogtreecommitdiffstats
path: root/src/object/objman.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/object/objman.cpp')
-rw-r--r--src/object/objman.cpp65
1 files changed, 22 insertions, 43 deletions
diff --git a/src/object/objman.cpp b/src/object/objman.cpp
index e4102b8..b0bac1a 100644
--- a/src/object/objman.cpp
+++ b/src/object/objman.cpp
@@ -30,7 +30,7 @@ CObjectManager::CObjectManager()
{
m_table[i] = nullptr;
}
- usedCount = 0;
+ m_usedCount = 0;
}
CObjectManager::~CObjectManager()
@@ -39,16 +39,16 @@ CObjectManager::~CObjectManager()
bool CObjectManager::AddInstance(CObject* instance)
{
- if (usedCount >= MAX_OBJECTS) return false;
+ if (m_usedCount >= MAX_OBJECTS) return false;
m_table[instance->GetID()] = instance;
- usedCount++;
+ m_usedCount++;
return true;
}
bool CObjectManager::DeleteInstance(CObject* instance)
{
- for (int i = 0; i < usedCount; i++)
+ for (int i = 0; i < m_usedCount; i++)
{
if (m_table[i] == instance)
m_table[i] = nullptr;
@@ -63,10 +63,9 @@ CObject* CObjectManager::SearchInstance(int id)
return m_table[id];
}
-CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, float zoom, float height,
- ObjectType type, float power,
- bool trainer, bool toy,
- int option)
+CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, ObjectType type,
+ float power, float zoom, float height,
+ bool trainer, bool toy, int option)
{
CObject* object = nullptr;
@@ -161,8 +160,7 @@ CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, float zoom,
if ( type == OBJECT_BARRIER0 ||
type == OBJECT_BARRIER1 ||
type == OBJECT_BARRIER2 ||
- type == OBJECT_BARRIER3 ||
- type == OBJECT_BARRIER4 )
+ type == OBJECT_BARRIER3 )
{
object = new CObject();
object->CreateBarrier(pos, angle, height, type);
@@ -193,26 +191,14 @@ CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, float zoom,
type == OBJECT_TREE2 ||
type == OBJECT_TREE3 ||
type == OBJECT_TREE4 ||
- type == OBJECT_TREE5 ||
- type == OBJECT_TREE6 ||
- type == OBJECT_TREE7 ||
- type == OBJECT_TREE8 ||
- type == OBJECT_TREE9 )
+ type == OBJECT_TREE5 )
{
object = new CObject();
object->CreatePlant(pos, angle, height, type);
}
else
- if ( type == OBJECT_MUSHROOM0 ||
- type == OBJECT_MUSHROOM1 ||
- type == OBJECT_MUSHROOM2 ||
- type == OBJECT_MUSHROOM3 ||
- type == OBJECT_MUSHROOM4 ||
- type == OBJECT_MUSHROOM5 ||
- type == OBJECT_MUSHROOM6 ||
- type == OBJECT_MUSHROOM7 ||
- type == OBJECT_MUSHROOM8 ||
- type == OBJECT_MUSHROOM9 )
+ if ( type == OBJECT_MUSHROOM1 ||
+ type == OBJECT_MUSHROOM2 )
{
object = new CObject();
object->CreateMushroom(pos, angle, height, type);
@@ -262,12 +248,7 @@ CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, float zoom,
type == OBJECT_TEEN41 ||
type == OBJECT_TEEN42 ||
type == OBJECT_TEEN43 ||
- type == OBJECT_TEEN44 ||
- type == OBJECT_TEEN45 ||
- type == OBJECT_TEEN46 ||
- type == OBJECT_TEEN47 ||
- type == OBJECT_TEEN48 ||
- type == OBJECT_TEEN49 )
+ type == OBJECT_TEEN44 )
{
object = new CObject();
object->SetOption(option);
@@ -277,13 +258,7 @@ CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, float zoom,
if ( type == OBJECT_QUARTZ0 ||
type == OBJECT_QUARTZ1 ||
type == OBJECT_QUARTZ2 ||
- type == OBJECT_QUARTZ3 ||
- type == OBJECT_QUARTZ4 ||
- type == OBJECT_QUARTZ5 ||
- type == OBJECT_QUARTZ6 ||
- type == OBJECT_QUARTZ7 ||
- type == OBJECT_QUARTZ8 ||
- type == OBJECT_QUARTZ9 )
+ type == OBJECT_QUARTZ3 )
{
object = new CObject();
object->CreateQuartz(pos, angle, height, type);
@@ -294,11 +269,7 @@ CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, float zoom,
type == OBJECT_ROOT2 ||
type == OBJECT_ROOT3 ||
type == OBJECT_ROOT4 ||
- type == OBJECT_ROOT5 ||
- type == OBJECT_ROOT6 ||
- type == OBJECT_ROOT7 ||
- type == OBJECT_ROOT8 ||
- type == OBJECT_ROOT9 )
+ type == OBJECT_ROOT5 )
{
object = new CObject();
object->CreateRoot(pos, angle, height, type);
@@ -387,3 +358,11 @@ CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, float zoom,
return object;
}
+void CObjectManager::Flush()
+{
+ for (int i = 0; i < MAX_OBJECTS; i++)
+ {
+ m_table[i] = nullptr;
+ }
+ m_usedCount = 0;
+}