update blocks data lifetime
This commit is contained in:
parent
4f559c1086
commit
e84c79839c
@ -491,7 +491,7 @@ static int l_get_field(lua::State* L) {
|
||||
}
|
||||
const ubyte* src = chunk->blocksMetadata.find(voxelIndex);
|
||||
if (src == nullptr) {
|
||||
throw std::runtime_error("block data is not allocated");
|
||||
return 0;
|
||||
}
|
||||
return get_field(L, src, *field, index, dataStruct);
|
||||
}
|
||||
@ -555,7 +555,7 @@ static int l_set_field(lua::State* L) {
|
||||
}
|
||||
ubyte* dst = chunk->blocksMetadata.find(voxelIndex);
|
||||
if (dst == nullptr) {
|
||||
throw std::runtime_error("block data is not allocated");
|
||||
dst = chunk->blocksMetadata.allocate(voxelIndex, dataStruct.size());
|
||||
}
|
||||
return set_field(L, dst, *field, index, dataStruct, value);
|
||||
}
|
||||
|
||||
@ -394,9 +394,6 @@ void Chunks::set(
|
||||
if (!state.segment && newdef.rt.extended) {
|
||||
repairSegments(newdef, state, gx, y, gz);
|
||||
}
|
||||
if (newdef.dataStruct) {
|
||||
chunk->blocksMetadata.allocate(index, newdef.dataStruct->size());
|
||||
}
|
||||
|
||||
if (y < chunk->bottom)
|
||||
chunk->bottom = y;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user