minor refactor + fix

This commit is contained in:
MihailRis
2024-03-03 19:20:38 +03:00
parent 90a4922201
commit 5657457edb
3 changed files with 33 additions and 24 deletions
+16 -16
View File
@@ -5,33 +5,33 @@
#include <string>
#include "typedefs.h"
const int ENGINE_VERSION_MAJOR = 0;
const int ENGINE_VERSION_MINOR = 20;
const bool ENGINE_VERSION_INDEV = true;
inline constexpr int ENGINE_VERSION_MAJOR = 0;
inline constexpr int ENGINE_VERSION_MINOR = 20;
inline constexpr bool ENGINE_VERSION_INDEV = true;
#define ENGINE_VERSION_STRING "0.20"
const int BLOCK_AIR = 0;
const int ITEM_EMPTY = 0;
inline constexpr int BLOCK_AIR = 0;
inline constexpr int ITEM_EMPTY = 0;
const int CHUNK_W = 16;
const int CHUNK_H = 256;
const int CHUNK_D = 16;
inline constexpr int CHUNK_W = 16;
inline constexpr int CHUNK_H = 256;
inline constexpr int CHUNK_D = 16;
const uint VOXEL_USER_BITS = 8;
constexpr uint VOXEL_USER_BITS_OFFSET = sizeof(blockstate_t)*8-VOXEL_USER_BITS;
inline constexpr uint VOXEL_USER_BITS = 8;
inline constexpr uint VOXEL_USER_BITS_OFFSET = sizeof(blockstate_t)*8-VOXEL_USER_BITS;
const int ITEM_ICON_SIZE = 48;
inline constexpr int ITEM_ICON_SIZE = 48;
/* Chunk volume (count of voxels per Chunk) */
constexpr int CHUNK_VOL = (CHUNK_W * CHUNK_H * CHUNK_D);
inline constexpr int CHUNK_VOL = (CHUNK_W * CHUNK_H * CHUNK_D);
/* BLOCK_VOID is block id used to mark non-existing voxel (voxel of missing chunk) */
const blockid_t BLOCK_VOID = std::numeric_limits<blockid_t>::max();
const itemid_t ITEM_VOID = std::numeric_limits<itemid_t>::max();
inline constexpr blockid_t BLOCK_VOID = std::numeric_limits<blockid_t>::max();
inline constexpr itemid_t ITEM_VOID = std::numeric_limits<itemid_t>::max();
const blockid_t MAX_BLOCKS = BLOCK_VOID;
inline constexpr blockid_t MAX_BLOCKS = BLOCK_VOID;
constexpr uint vox_index(uint x, uint y, uint z, uint w=CHUNK_W, uint d=CHUNK_D) {
inline constexpr uint vox_index(uint x, uint y, uint z, uint w=CHUNK_W, uint d=CHUNK_D) {
return (y * d + z) * w + x;
}