Added a check that avoids server crash (unhandled exception) when map generation is attempted near limit
parent
e1a2b8f600
commit
ab02f0aa1b
11
src/map.cpp
11
src/map.cpp
|
@ -3587,6 +3587,17 @@ void ServerMap::initChunkMake(ChunkMakeData &data, v2s16 chunkpos)
|
||||||
s16 sectorpos_bigbase_size =
|
s16 sectorpos_bigbase_size =
|
||||||
sectorpos_base_size + 2 * max_spread_amount_sectors;
|
sectorpos_base_size + 2 * max_spread_amount_sectors;
|
||||||
|
|
||||||
|
// Check limits
|
||||||
|
const s16 limit = MAP_GENERATION_LIMIT / MAP_BLOCKSIZE;
|
||||||
|
if(sectorpos_bigbase.X < -limit
|
||||||
|
|| sectorpos_bigbase.X + sectorpos_bigbase_size >= limit
|
||||||
|
|| sectorpos_bigbase.Y < -limit
|
||||||
|
|| sectorpos_bigbase.Y + sectorpos_bigbase_size >= limit)
|
||||||
|
{
|
||||||
|
data.no_op = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
data.seed = m_seed;
|
data.seed = m_seed;
|
||||||
data.chunkpos = chunkpos;
|
data.chunkpos = chunkpos;
|
||||||
data.y_blocks_min = y_blocks_min;
|
data.y_blocks_min = y_blocks_min;
|
||||||
|
|
Loading…
Reference in New Issue