update blockstate.segment size
This commit is contained in:
@@ -12,8 +12,8 @@ inline constexpr int BLOCK_DIR_DOWN = 0x5;
|
|||||||
|
|
||||||
struct blockstate {
|
struct blockstate {
|
||||||
uint8_t rotation : 3; // block rotation index
|
uint8_t rotation : 3; // block rotation index
|
||||||
uint8_t segment : 1; // segment block bit
|
uint8_t segment : 3; // segment block bits
|
||||||
uint8_t reserved : 4; // reserved bits
|
uint8_t reserved : 2; // reserved bits
|
||||||
uint8_t userbits : 8; // bits for use in block script
|
uint8_t userbits : 8; // bits for use in block script
|
||||||
};
|
};
|
||||||
static_assert (sizeof(blockstate) == 2);
|
static_assert (sizeof(blockstate) == 2);
|
||||||
@@ -22,7 +22,7 @@ static_assert (sizeof(blockstate) == 2);
|
|||||||
inline constexpr blockstate_t blockstate2int(blockstate b) {
|
inline constexpr blockstate_t blockstate2int(blockstate b) {
|
||||||
return static_cast<blockstate_t>(b.rotation) |
|
return static_cast<blockstate_t>(b.rotation) |
|
||||||
static_cast<blockstate_t>(b.segment) << 3 |
|
static_cast<blockstate_t>(b.segment) << 3 |
|
||||||
static_cast<blockstate_t>(b.reserved) << 4 |
|
static_cast<blockstate_t>(b.reserved) << 6 |
|
||||||
static_cast<blockstate_t>(b.userbits) << 8;
|
static_cast<blockstate_t>(b.userbits) << 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,8 +30,8 @@ inline constexpr blockstate_t blockstate2int(blockstate b) {
|
|||||||
inline constexpr blockstate int2blockstate(blockstate_t i) {
|
inline constexpr blockstate int2blockstate(blockstate_t i) {
|
||||||
return {
|
return {
|
||||||
static_cast<uint8_t>(i & 0b111),
|
static_cast<uint8_t>(i & 0b111),
|
||||||
static_cast<uint8_t>((i >> 3) & 0b1),
|
static_cast<uint8_t>((i >> 3) & 0b111),
|
||||||
static_cast<uint8_t>((i >> 4) & 0b1111),
|
static_cast<uint8_t>((i >> 6) & 0b11),
|
||||||
static_cast<uint8_t>((i >> 8) & 0xFF)
|
static_cast<uint8_t>((i >> 8) & 0xFF)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user