Implemented inline void set_id_if_air

This commit is contained in:
CobaltXII
2018-12-30 17:50:01 -05:00
parent 192ae9b737
commit 3fa0b38d09

View File

@@ -104,6 +104,17 @@ struct world
voxel_set_id(voxels[x + x_res * (y + y_res * z)], id);
}
// Set the block_id information of the voxel at the specified coordinates,
// if the current block_id of the voxel at the specified coordinates is
// id_air.
inline void set_id_if_air(unsigned int x, unsigned int y, unsigned int z, block_id id)
{
if (get_id(x, y, z) == id_air)
{
voxel_set_id(voxels[x + x_res * (y + y_res * z)], id);
}
}
// Set the block_id information of the voxel at the specified coordinates,
// if the coordinates are within the bounds of the world.