*
This commit is contained in:
@@ -111,7 +111,7 @@ void GameServer::BackingChunkPressure_t::run(int id) {
|
||||
for(int y = 0; y < 4; y++)
|
||||
for(int x = 0; x < 4; x++)
|
||||
{
|
||||
auto &toPtr = dumpRegion.Nodes[Pos::bvec4u(x, y, z).pack()];
|
||||
auto &toPtr = dumpRegion.Nodes[Pos::bvec4u(x, y, z)];
|
||||
const Node *fromPtr = (const Node*) ®ionObj.Nodes[0][0][0][x][y][z];
|
||||
std::copy(fromPtr, fromPtr+16*16*16, toPtr.data());
|
||||
}
|
||||
@@ -227,7 +227,7 @@ void GameServer::BackingChunkPressure_t::run(int id) {
|
||||
for(auto& [chunkPos, chunk] : region.Nodes) {
|
||||
CompressedNodes cmp = compressNodes(chunk.data());
|
||||
Pos::GlobalChunk chunkPosR = (Pos::GlobalChunk(regionPos) << 2) + chunkPos;
|
||||
|
||||
|
||||
for(auto& ptr : region.NewCECs) {
|
||||
bool accepted = ptr->Remote->maybe_prepareChunkUpdate_Nodes(worldId,
|
||||
chunkPosR, cmp.Compressed, cmp.Defines);
|
||||
@@ -845,12 +845,24 @@ void GameServer::stepGeneratorAndLuaAsync(IWorldSaveBackend::TickSyncInfo_Out db
|
||||
for(int z = 0; z < 64; z++)
|
||||
for(int y = 0; y < 64; y++)
|
||||
for(int x = 0; x < 64; x++, ptr++) {
|
||||
DefVoxelId_t id = *ptr > 0.5 ? 1 : 0;
|
||||
// DefVoxelId_t id = *ptr > 0.9 ? 1 : 0;
|
||||
Pos::bvec64u nodePos(x, y, z);
|
||||
auto &node = obj.Nodes[Pos::bvec4u(nodePos >> 4).pack()][Pos::bvec16u(nodePos & 0xf).pack()];
|
||||
node.NodeId = id;
|
||||
// node.NodeId = id;
|
||||
// node.Meta = 0;
|
||||
|
||||
if(y == (key.RegionPos.y % 64))
|
||||
node.NodeId = 1;
|
||||
else
|
||||
node.NodeId = 0;
|
||||
|
||||
node.Meta = 0;
|
||||
}
|
||||
|
||||
// Node node;
|
||||
// node.Data = 0;
|
||||
// std::fill((Node*) obj.Nodes.data(), ((Node*) obj.Nodes.data())+64*64*64, node);
|
||||
// obj.Nodes[0][0].NodeId = 1;
|
||||
}
|
||||
|
||||
// Обработка идентификаторов на стороне луа
|
||||
|
||||
@@ -211,8 +211,9 @@ class GameServer : public AsyncObject {
|
||||
auto lock = Input.lock();
|
||||
|
||||
for(auto& [worldId, region] : input) {
|
||||
for(auto& regionPos : region)
|
||||
for(auto& regionPos : region) {
|
||||
lock->push({worldId, regionPos});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,9 @@ bool RemoteClient::maybe_prepareChunkUpdate_Voxels(WorldId_t worldId, Pos::Globa
|
||||
if(lock)
|
||||
return false;
|
||||
|
||||
Pos::bvec4u localChunk = chunkPos & 0x3;
|
||||
Pos::GlobalRegion regionPos = chunkPos >> 2;
|
||||
|
||||
/*
|
||||
Обновить зависимости
|
||||
Запросить недостающие
|
||||
@@ -98,7 +101,6 @@ bool RemoteClient::maybe_prepareChunkUpdate_Voxels(WorldId_t worldId, Pos::Globa
|
||||
}
|
||||
|
||||
auto iterWorld = ResUses.RefChunk.find(worldId);
|
||||
Pos::bvec4u lChunk = (chunkPos & 0xf);
|
||||
|
||||
if(iterWorld != ResUses.RefChunk.end())
|
||||
// Исключим зависимости предыдущей версии чанка
|
||||
@@ -106,7 +108,7 @@ bool RemoteClient::maybe_prepareChunkUpdate_Voxels(WorldId_t worldId, Pos::Globa
|
||||
auto iterRegion = iterWorld->second.find(chunkPos);
|
||||
if(iterRegion != iterWorld->second.end()) {
|
||||
// Уменьшим счётчик зависимостей
|
||||
for(const DefVoxelId_t& id : iterRegion->second[lChunk.pack()].Voxel) {
|
||||
for(const DefVoxelId_t& id : iterRegion->second[localChunk.pack()].Voxel) {
|
||||
auto iter = ResUses.DefVoxel.find(id);
|
||||
assert(iter != ResUses.DefVoxel.end()); // Воксель должен быть в зависимостях
|
||||
if(--iter->second == 0) {
|
||||
@@ -121,7 +123,7 @@ bool RemoteClient::maybe_prepareChunkUpdate_Voxels(WorldId_t worldId, Pos::Globa
|
||||
iterWorld = ResUses.RefChunk.find(worldId);
|
||||
}
|
||||
|
||||
iterWorld->second[chunkPos][lChunk.pack()].Voxel = uniq_sorted_defines;
|
||||
iterWorld->second[regionPos][localChunk.pack()].Voxel = uniq_sorted_defines;
|
||||
|
||||
if(!newTypes.empty()) {
|
||||
// Добавляем новые типы в запрос
|
||||
@@ -154,6 +156,9 @@ bool RemoteClient::maybe_prepareChunkUpdate_Nodes(WorldId_t worldId, Pos::Global
|
||||
if(lock)
|
||||
return false;
|
||||
|
||||
Pos::bvec4u localChunk = chunkPos & 0x3;
|
||||
Pos::GlobalRegion regionPos = chunkPos >> 2;
|
||||
|
||||
std::vector<DefNodeId_t>
|
||||
newTypes, /* Новые типы нод */
|
||||
lostTypes /* Потерянные типы нод */;
|
||||
@@ -172,7 +177,6 @@ bool RemoteClient::maybe_prepareChunkUpdate_Nodes(WorldId_t worldId, Pos::Global
|
||||
}
|
||||
|
||||
auto iterWorld = ResUses.RefChunk.find(worldId);
|
||||
Pos::bvec4u lChunk = (chunkPos & 0xf);
|
||||
|
||||
if(iterWorld != ResUses.RefChunk.end())
|
||||
// Исключим зависимости предыдущей версии чанка
|
||||
@@ -180,7 +184,7 @@ bool RemoteClient::maybe_prepareChunkUpdate_Nodes(WorldId_t worldId, Pos::Global
|
||||
auto iterRegion = iterWorld->second.find(chunkPos);
|
||||
if(iterRegion != iterWorld->second.end()) {
|
||||
// Уменьшим счётчик зависимостей
|
||||
for(const DefNodeId_t& id : iterRegion->second[lChunk.pack()].Node) {
|
||||
for(const DefNodeId_t& id : iterRegion->second[localChunk.pack()].Node) {
|
||||
auto iter = ResUses.DefNode.find(id);
|
||||
assert(iter != ResUses.DefNode.end()); // Нода должна быть в зависимостях
|
||||
if(--iter->second == 0) {
|
||||
@@ -195,7 +199,7 @@ bool RemoteClient::maybe_prepareChunkUpdate_Nodes(WorldId_t worldId, Pos::Global
|
||||
iterWorld = ResUses.RefChunk.find(worldId);
|
||||
}
|
||||
|
||||
iterWorld->second[chunkPos][lChunk.pack()].Node = uniq_sorted_defines;
|
||||
iterWorld->second[regionPos][localChunk.pack()].Node = uniq_sorted_defines;
|
||||
|
||||
if(!newTypes.empty()) {
|
||||
// Добавляем новые типы в запрос
|
||||
|
||||
Reference in New Issue
Block a user