re3/src/buildings/Building.cpp

23 lines
632 B
C++
Raw Permalink Normal View History

2019-05-15 16:52:37 +02:00
#include "common.h"
2020-04-17 15:31:11 +02:00
2019-05-15 16:52:37 +02:00
#include "Building.h"
2019-06-19 23:41:43 +02:00
#include "Streaming.h"
2019-05-15 16:52:37 +02:00
#include "Pools.h"
2021-06-25 23:27:12 +02:00
void *CBuilding::operator new(size_t sz) throw() { return CPools::GetBuildingPool()->New(); }
void CBuilding::operator delete(void *p, size_t sz) throw() { CPools::GetBuildingPool()->Delete((CBuilding*)p); }
2019-06-19 23:41:43 +02:00
void
CBuilding::ReplaceWithNewModel(int32 id)
{
DeleteRwObject();
2020-05-05 14:06:55 +02:00
if (CModelInfo::GetModelInfo(m_modelIndex)->GetNumRefs() == 0)
2019-06-19 23:41:43 +02:00
CStreaming::RemoveModel(m_modelIndex);
m_modelIndex = id;
if(bIsBIGBuilding)
2020-07-13 16:43:09 +02:00
if(m_level == LEVEL_GENERIC || m_level == CGame::currLevel)
2019-06-20 14:49:16 +02:00
CStreaming::RequestModel(id, STREAMFLAGS_DONT_REMOVE);
2019-06-19 23:41:43 +02:00
}