mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-07-05 15:19:07 +02:00
BlockType: replace list of booleans with flags bitfield
This commit is contained in:
parent
446e74791f
commit
ef4b6eac02
8 changed files with 800 additions and 787 deletions
|
@ -42,7 +42,7 @@ struct Block {
|
|||
|
||||
|
||||
Resource::Color getColor() const {
|
||||
if (!type || !type->opaque)
|
||||
if (!type || !(type->flags & BLOCK_OPAQUE))
|
||||
return Resource::Color {};
|
||||
|
||||
return (Resource::BIOMES[biome] ?: Resource::BIOME_DEFAULT)->getBlockColor(type, height);
|
||||
|
|
|
@ -84,7 +84,7 @@ bool Chunk::getBlock(Block *block, const Section *section, size_t x, size_t y, s
|
|||
return false;
|
||||
|
||||
const Resource::BlockType *type = section->getBlockStateAt(x, y, z);
|
||||
if (!type || !type->opaque)
|
||||
if (!type || !(type->flags & BLOCK_OPAQUE))
|
||||
return false;
|
||||
|
||||
if (!block->type) {
|
||||
|
@ -93,7 +93,7 @@ bool Chunk::getBlock(Block *block, const Section *section, size_t x, size_t y, s
|
|||
block->biome = getBiome(x, y, z);
|
||||
}
|
||||
|
||||
if (type->blue)
|
||||
if (type->flags & BLOCK_WATER)
|
||||
return false;
|
||||
|
||||
block->height = SIZE*section->getY() + y;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue