
/*
 * Copyright 2011-2022 Cuberite Contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#include "Globals.h"
#include "QtChunk.h"





Chunk::Chunk() :
	m_IsValid(false)
{
}





void Chunk::setBiomes(const cChunkDef::BiomeMap & a_Biomes)
{
	for (size_t idx = 0; idx < ARRAYCOUNT(a_Biomes); ++idx)
	{
		m_Biomes[idx] = static_cast<short>(a_Biomes[idx]);
	}
	m_IsValid = true;
}





EMCSBiome Chunk::getBiome(int a_RelX, int a_RelZ)
{
	if (!m_IsValid)
	{
		return biInvalidBiome;
	}
	return static_cast<EMCSBiome>(m_Biomes[a_RelX + 16 * a_RelZ]);
}




