noggit: liquid_chunk: fix layer count not being updated when cleaning up the chunk
f4518497d0
This commit is contained in:
@@ -133,7 +133,7 @@ void ChunkWater::save(util::sExtendableArray& adt, int base_pos, int& header_pos
|
||||
|
||||
if (hasData(0))
|
||||
{
|
||||
header.nLayers = static_cast<std::uint32_t>(_layers.size());
|
||||
header.nLayers = _layer_count;;
|
||||
|
||||
// fagique only for single layer ocean chunk
|
||||
bool fatigue = _layers[0].has_fatigue();
|
||||
@@ -151,7 +151,7 @@ void ChunkWater::save(util::sExtendableArray& adt, int base_pos, int& header_pos
|
||||
header.ofsInformation = current_pos - base_pos;
|
||||
int info_pos = current_pos;
|
||||
|
||||
std::size_t info_size = sizeof(MH2O_Information) * _layers.size();
|
||||
std::size_t info_size = sizeof(MH2O_Information) * _layer_count;
|
||||
current_pos += static_cast<std::uint32_t>(info_size);
|
||||
|
||||
adt.Extend(static_cast<long>(info_size));
|
||||
@@ -174,7 +174,7 @@ void ChunkWater::save_mclq(util::sExtendableArray& adt, int mcnk_pos, int& curre
|
||||
|
||||
if (hasData(0))
|
||||
{
|
||||
adt.Extend(sizeof(mclq) * _layers.size() + 8);
|
||||
adt.Extend(sizeof(mclq) * _layer_count + 8);
|
||||
// size seems to be 0 in vanilla adts in the mclq chunk's header and set right in the mcnk header (layer_size * n_layer + 8)
|
||||
SetChunkHeader(adt, current_pos, 'MCLQ', 0);
|
||||
|
||||
@@ -440,7 +440,7 @@ void ChunkWater::paintLiquid( glm::vec3 const& pos
|
||||
|
||||
void ChunkWater::cleanup()
|
||||
{
|
||||
for (int i = static_cast<int>(_layers.size() - 1); i >= 0; --i)
|
||||
for (int i = static_cast<int>(_layer_count - 1); i >= 0; --i)
|
||||
{
|
||||
if (_layers[i].empty())
|
||||
{
|
||||
@@ -448,6 +448,7 @@ void ChunkWater::cleanup()
|
||||
_water_tile->tagUpdate();
|
||||
}
|
||||
}
|
||||
update_layers();
|
||||
}
|
||||
|
||||
void ChunkWater::copy_height_to_layer(liquid_layer& target, glm::vec3 const& pos, float radius)
|
||||
|
||||
Reference in New Issue
Block a user