mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-17 20:10:23 +03:00
* Add getChunkDontCreate. Will be useful for multiplayer.
This commit is contained in:
@@ -94,6 +94,24 @@ LevelChunk* RandomLevelSource::getChunk(int x, int z)
|
||||
return pChunk;
|
||||
}
|
||||
|
||||
LevelChunk* RandomLevelSource::getChunkDontCreate(int x, int z)
|
||||
{
|
||||
int hashCode = GetChunkHash(x, z);
|
||||
auto iter = m_chunks.find(hashCode);
|
||||
if (iter != m_chunks.end())
|
||||
return iter->second;
|
||||
|
||||
// have to create the chunk. Create an empty one
|
||||
|
||||
TileID* pLevelData = new TileID[32768];
|
||||
memset (pLevelData, 0, sizeof *pLevelData * 32768);
|
||||
|
||||
LevelChunk* pChunk = new LevelChunk(m_pLevel, pLevelData, x, z);
|
||||
m_chunks.insert(std::pair<int, LevelChunk*>(hashCode, pChunk));
|
||||
|
||||
return pChunk;
|
||||
}
|
||||
|
||||
float* RandomLevelSource::getHeights(float* fptr, int a3, int a4, int a5, int a6, int a7, int a8)
|
||||
{
|
||||
if (fptr == nullptr)
|
||||
|
||||
Reference in New Issue
Block a user