refactor: WorldRegions and chunks saving
This commit is contained in:
@@ -113,8 +113,11 @@ bool Chunk::decode(const ubyte* data) {
|
||||
ubyte bst1 = data[CHUNK_VOL*2 + i];
|
||||
ubyte bst2 = data[CHUNK_VOL*3 + i];
|
||||
|
||||
vox.id = (blockid_t(bid1) << 8) | (blockid_t(bid2));
|
||||
vox.state = int2blockstate((blockstate_t(bst1) << 8) | (blockstate_t(bst2)));
|
||||
vox.id = (static_cast<blockid_t>(bid1) << 8) |
|
||||
static_cast<blockid_t>(bid2);
|
||||
vox.state = int2blockstate(
|
||||
(static_cast<blockstate_t>(bst1) << 8) |
|
||||
static_cast<blockstate_t>(bst2));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -122,8 +125,8 @@ bool Chunk::decode(const ubyte* data) {
|
||||
void Chunk::convert(ubyte* data, const ContentLUT* lut) {
|
||||
for (uint i = 0; i < CHUNK_VOL; i++) {
|
||||
// see encode method to understand what the hell is going on here
|
||||
blockid_t id = ((blockid_t(data[i]) << 8) |
|
||||
blockid_t(data[CHUNK_VOL+i]));
|
||||
blockid_t id = ((static_cast<blockid_t>(data[i]) << 8) |
|
||||
static_cast<blockid_t>(data[CHUNK_VOL+i]));
|
||||
blockid_t replacement = lut->getBlockId(id);
|
||||
data[i] = replacement >> 8;
|
||||
data[CHUNK_VOL+i] = replacement & 0xFF;
|
||||
|
||||
Reference in New Issue
Block a user