summaryrefslogtreecommitdiffstats
path: root/Tools/QtBiomeVisualiser/RegionLoader.cpp
blob: 6cd00487fe0675f457c3198aebbd5f6bcb21bff0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "Globals.h"
#include "RegionLoader.h"
#include "ChunkSource.h"
#include "Region.h"





volatile bool RegionLoader::m_IsShuttingDown = false;





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));
			if (m_IsShuttingDown)
			{
				return;
			}
		}
	}
	m_Region->m_IsValid = true;

	emit loaded(m_RegionX, m_RegionZ);
}