2013-11-25 12:51:58 +01:00
|
|
|
#include "RefManager.h"
|
|
|
|
|
|
|
|
using namespace GameLogic;
|
|
|
|
|
|
|
|
typedef std::pair<Oyster::Physics::ICustomBody*, Object*> mapData;
|
|
|
|
|
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-11-26 09:19:59 +01:00
|
|
|
Object* RefManager::GetMap(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-11-26 09:19:59 +01:00
|
|
|
void RefManager::AddMapping(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
|
|
|
}
|
|
|
|
|
|
|
|
|