2023-10-12 12:18:24 -04:00
|
|
|
#include "legoobjectfactory.h"
|
|
|
|
|
|
|
|
#include "decomp.h"
|
2023-10-24 19:38:27 -04:00
|
|
|
#include "infocenterstate.h"
|
2023-10-12 12:18:24 -04:00
|
|
|
|
|
|
|
// TODO: Uncomment once we have all the relevant types ready
|
|
|
|
// DECOMP_SIZE_ASSERT(LegoObjectFactory, 0x1c8);
|
|
|
|
|
|
|
|
// OFFSET: LEGO1 0x10006e40
|
|
|
|
LegoObjectFactory::LegoObjectFactory()
|
|
|
|
{
|
|
|
|
#define X(V) this->m_id##V = MxAtomId(#V, LookupMode_Exact);
|
2023-10-24 19:38:27 -04:00
|
|
|
FOR_LEGOOBJECTFACTORY_OBJECTS(X)
|
2023-10-12 12:18:24 -04:00
|
|
|
#undef X
|
|
|
|
}
|
|
|
|
|
|
|
|
// OFFSET: LEGO1 0x10009a90
|
2023-10-24 19:38:27 -04:00
|
|
|
MxCore* LegoObjectFactory::Create(const char* p_name)
|
2023-10-12 12:18:24 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
MxAtomId atom(p_name, LookupMode_Exact);
|
2023-10-12 12:18:24 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
#define X(V) \
|
|
|
|
if (this->m_id##V == atom) { \
|
|
|
|
return new V; \
|
|
|
|
} \
|
|
|
|
else
|
|
|
|
FOR_LEGOOBJECTFACTORY_OBJECTS(X)
|
2023-10-12 12:18:24 -04:00
|
|
|
#undef X
|
2023-10-24 19:38:27 -04:00
|
|
|
{
|
|
|
|
return MxObjectFactory::Create(p_name);
|
|
|
|
}
|
2023-10-12 12:18:24 -04:00
|
|
|
}
|
|
|
|
|
2023-11-05 17:41:35 -05:00
|
|
|
// OFFSET: LEGO1 0x1000fb30
|
2023-10-24 19:38:27 -04:00
|
|
|
void LegoObjectFactory::Destroy(MxCore* p_object)
|
2023-10-12 12:18:24 -04:00
|
|
|
{
|
2023-11-05 17:41:35 -05:00
|
|
|
delete p_object;
|
2023-10-12 12:18:24 -04:00
|
|
|
}
|