2014-10-27 15:58:09 -07:00
|
|
|
#include "Globals.h"
|
|
|
|
#include "RegionLoader.h"
|
|
|
|
#include "ChunkSource.h"
|
|
|
|
#include "Region.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-28 14:19:24 -07:00
|
|
|
volatile bool RegionLoader::m_IsShuttingDown = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-27 15:58:09 -07:00
|
|
|
RegionLoader::RegionLoader(int a_RegionX, int a_RegionZ, RegionPtr a_Region, ChunkSourcePtr a_ChunkSource) :
|
|
|
|
m_RegionX(a_RegionX),
|
|
|
|
m_RegionZ(a_RegionZ),
|
|
|
|
m_Region(a_Region),
|
|
|
|
m_ChunkSource(a_ChunkSource)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void RegionLoader::run()
|
|
|
|
{
|
|
|
|
// Load all the chunks in this region:
|
|
|
|
for (int z = 0; z < 32; z++)
|
|
|
|
{
|
|
|
|
for (int x = 0; x < 32; x++)
|
|
|
|
{
|
|
|
|
m_ChunkSource->getChunkBiomes(m_RegionX * 32 + x, m_RegionZ * 32 + z, m_Region->getRelChunk(x, z));
|
2014-10-28 14:19:24 -07:00
|
|
|
if (m_IsShuttingDown)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-10-27 15:58:09 -07:00
|
|
|
}
|
|
|
|
}
|
2014-10-28 12:49:29 -07:00
|
|
|
m_Region->m_IsValid = true;
|
|
|
|
|
2014-10-27 15:58:09 -07:00
|
|
|
emit loaded(m_RegionX, m_RegionZ);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|