|
@@ -62,11 +62,19 @@ Chunk *Dimension::zChunk( Punkt wPos ) const
|
|
return chunks->z( addr, 9 );
|
|
return chunks->z( addr, 9 );
|
|
}
|
|
}
|
|
|
|
|
|
-Block *Dimension::zBlock( Vec3<int> location )
|
|
|
|
|
|
+Block *Dimension::zBlock( Vec3<int> location, const Game *zGame )
|
|
{
|
|
{
|
|
- Chunk *c = zChunk( Punkt( location.x, location.y ) );
|
|
|
|
|
|
+ Chunk *c = zChunk( zGame->getChunkCenter( location.x, location.y ) );
|
|
if( c )
|
|
if( c )
|
|
- return c->zBlockAt( Vec3<int>( location.x % CHUNK_SIZE, location.y % CHUNK_SIZE, location.z ) );
|
|
|
|
|
|
+ {
|
|
|
|
+ int x = location.x % CHUNK_SIZE;
|
|
|
|
+ int y = location.y % CHUNK_SIZE;
|
|
|
|
+ if( x < 0 )
|
|
|
|
+ x += CHUNK_SIZE;
|
|
|
|
+ if( y < 0 )
|
|
|
|
+ y += CHUNK_SIZE;
|
|
|
|
+ return c->zBlockAt( Vec3<int>( x, y, location.z ) );
|
|
|
|
+ }
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|