Exemplo n.º 1
0
bool cWorldStorage::LoadOneChunk(void)
{
	cChunkCoords ToLoad(0, 0);
	bool ShouldLoad = m_LoadQueue.TryDequeueItem(ToLoad);

	if (ShouldLoad)
	{
		return LoadChunk(ToLoad.m_ChunkX, ToLoad.m_ChunkZ);
	}
	return false;
}
Exemplo n.º 2
0
bool cWorldStorage::LoadOneChunk(void)
{
	sChunkLoad ToLoad(0, 0, 0, false);
	bool ShouldLoad = m_LoadQueue.TryDequeueItem(ToLoad);
	if (ShouldLoad && !LoadChunk(ToLoad.m_ChunkX, ToLoad.m_ChunkY, ToLoad.m_ChunkZ))
	{
		if (ToLoad.m_Generate)
		{
			// The chunk couldn't be loaded, generate it:
			m_World->GetGenerator().QueueGenerateChunk(ToLoad.m_ChunkX, ToLoad.m_ChunkY, ToLoad.m_ChunkZ);
		}
		else
		{
			// TODO: Notify the world that the load has failed:
			// m_World->ChunkLoadFailed(ToLoad.m_ChunkX, ToLoad.m_ChunkY, ToLoad.m_ChunkZ);
		}
	}
	return ShouldLoad;
}
Exemplo n.º 3
0
bool cWorldStorage::LoadOneChunk(void)
{
	// Dequeue an item, bail out if there's none left:
	cChunkCoordsWithCallback ToLoad(0, 0, nullptr);
	bool ShouldLoad = m_LoadQueue.TryDequeueItem(ToLoad);
	if (!ShouldLoad)
	{
		return false;
	}

	// Load the chunk:
	bool res = LoadChunk(ToLoad.m_ChunkX, ToLoad.m_ChunkZ);

	// Call the callback, if specified:
	if (ToLoad.m_Callback != nullptr)
	{
		ToLoad.m_Callback->Call(ToLoad.m_ChunkX, ToLoad.m_ChunkZ);
	}
	return res;
}