2013-11-25 12:51:58 +01:00
|
|
|
#include "RefManager.h"
|
|
|
|
|
|
|
|
using namespace GameLogic;
|
|
|
|
|
2013-12-03 11:47:04 +01:00
|
|
|
typedef std::pair<const Oyster::Physics::ICustomBody*, Object*> mapData;
|
2013-11-25 12:51:58 +01:00
|
|
|
|
2013-11-28 11:23:11 +01:00
|
|
|
RefManager* RefManager::instance = 0;
|
|
|
|
|
2013-11-25 12:51:58 +01:00
|
|
|
RefManager::RefManager(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
RefManager::~RefManager(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-11-28 11:23:11 +01:00
|
|
|
void RefManager::Release()
|
|
|
|
{
|
|
|
|
if (instance)
|
|
|
|
{
|
|
|
|
delete instance;
|
|
|
|
instance = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
RefManager* RefManager::getInstance( )
|
|
|
|
{
|
|
|
|
if (!instance)
|
|
|
|
{
|
|
|
|
instance = new RefManager();
|
|
|
|
};
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
2013-12-03 11:47:04 +01:00
|
|
|
Object* RefManager::GetMap(const Oyster::Physics::ICustomBody &body)
|
2013-11-25 12:51:58 +01:00
|
|
|
{
|
2013-11-26 09:19:59 +01:00
|
|
|
return mapper[&body];
|
2013-11-25 12:51:58 +01:00
|
|
|
}
|
|
|
|
|
2013-12-03 11:47:04 +01:00
|
|
|
void RefManager::AddMapping( const Oyster::Physics::ICustomBody &body, Object &obj)
|
2013-11-25 12:51:58 +01:00
|
|
|
{
|
2013-11-26 09:19:59 +01:00
|
|
|
mapper.insert(mapData(&body,&obj));
|
2013-11-25 12:51:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|