From 3fa0b38d091ba7939f639dd04a6ca234c19f182c Mon Sep 17 00:00:00 2001 From: CobaltXII Date: Sun, 30 Dec 2018 17:50:01 -0500 Subject: [PATCH] Implemented inline void set_id_if_air --- src/inc/world.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/inc/world.hpp b/src/inc/world.hpp index 4d87f39..7ca8a1f 100644 --- a/src/inc/world.hpp +++ b/src/inc/world.hpp @@ -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.