re3-mirror/src/buildings/Building.cpp

23 lines
632 B
C++
Raw Normal View History

2019-05-15 15:52:37 +01:00
#include "common.h"
2020-04-17 14:31:11 +01:00
2019-05-15 15:52:37 +01:00
#include "Building.h"
2019-06-19 22:41:43 +01:00
#include "Streaming.h"
2019-05-15 15:52:37 +01:00
#include "Pools.h"
2021-06-25 22:27:12 +01: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 22:41:43 +01:00
void
CBuilding::ReplaceWithNewModel(int32 id)
{
DeleteRwObject();
2020-05-05 13:06:55 +01:00
if (CModelInfo::GetModelInfo(m_modelIndex)->GetNumRefs() == 0)
2019-06-19 22:41:43 +01:00
CStreaming::RemoveModel(m_modelIndex);
m_modelIndex = id;
if(bIsBIGBuilding)
2020-07-13 15:43:09 +01:00
if(m_level == LEVEL_GENERIC || m_level == CGame::currLevel)
2019-06-20 13:49:16 +01:00
CStreaming::RequestModel(id, STREAMFLAGS_DONT_REMOVE);
2019-06-19 22:41:43 +01:00
}