|
@@ -104,7 +104,7 @@ void Chunk::generateBlock( Framework::Vec3<int> location )
|
|
void Chunk::putBlockAt( Framework::Vec3<int> location, Block* block )
|
|
void Chunk::putBlockAt( Framework::Vec3<int> location, Block* block )
|
|
{
|
|
{
|
|
int index = (location.x * CHUNK_SIZE + location.y) * WORLD_HEIGHT + location.z;
|
|
int index = (location.x * CHUNK_SIZE + location.y) * WORLD_HEIGHT + location.z;
|
|
- assert( index < CHUNK_SIZE* CHUNK_SIZE* WORLD_HEIGHT );
|
|
|
|
|
|
+ assert( index < CHUNK_SIZE* CHUNK_SIZE* WORLD_HEIGHT && index >= 0 );
|
|
Block* old = blocks[ index ];
|
|
Block* old = blocks[ index ];
|
|
if( block )
|
|
if( block )
|
|
blockIds[ index ] = (unsigned short)block->zBlockType()->getId();
|
|
blockIds[ index ] = (unsigned short)block->zBlockType()->getId();
|