Revert LCEMP dedicated server changes

Apparently smartcmd used their own dedicated server and not LCEMP's, starting from scratch!
This commit is contained in:
2026-08-15 03:28:51 +03:00
parent 9e3077c3bc
commit a1541c590d
29 changed files with 58 additions and 283 deletions
-23
View File
@@ -9,7 +9,6 @@
StructureFeature::StructureFeature()
{
InitializeCriticalSectionAndSpinCount(&m_csCachedStructures, 4000);
#ifdef ENABLE_STRUCTURE_SAVING
savedData = nullptr;
#endif
@@ -17,13 +16,10 @@ StructureFeature::StructureFeature()
StructureFeature::~StructureFeature()
{
EnterCriticalSection(&m_csCachedStructures);
for( AUTO_VAR(it, cachedStructures.begin()); it != cachedStructures.end(); it++ )
{
delete it->second;
}
LeaveCriticalSection(&m_csCachedStructures);
DeleteCriticalSection(&m_csCachedStructures);
}
void StructureFeature::addFeature(Level *level, int x, int z, int xOffs, int zOffs, byteArray blocks)
@@ -32,16 +28,12 @@ void StructureFeature::addFeature(Level *level, int x, int z, int xOffs, int zOf
// the chunk being generated, but not all chunks are the sources of
// structures
EnterCriticalSection(&m_csCachedStructures);
restoreSavedData(level);
if (cachedStructures.find(ChunkPos::hashCode(x, z)) != cachedStructures.end())
{
LeaveCriticalSection(&m_csCachedStructures);
return;
}
LeaveCriticalSection(&m_csCachedStructures);
// clear random key
random->nextInt();
@@ -49,9 +41,7 @@ void StructureFeature::addFeature(Level *level, int x, int z, int xOffs, int zOf
if (isFeatureChunk(x, z,level->getLevelData()->getGenerator() == LevelType::lvl_flat))
{
StructureStart *start = createStructureStart(x, z);
EnterCriticalSection(&m_csCachedStructures);
cachedStructures[ChunkPos::hashCode(x, z)] = start;
LeaveCriticalSection(&m_csCachedStructures);
saveFeature(x, z, start);
}
}
@@ -68,7 +58,6 @@ bool StructureFeature::postProcess(Level *level, Random *random, int chunkX, int
int cz = (chunkZ << 4); // + 8;
bool intersection = false;
EnterCriticalSection(&m_csCachedStructures);
for( AUTO_VAR(it, cachedStructures.begin()); it != cachedStructures.end(); it++ )
{
StructureStart *structureStart = it->second;
@@ -87,14 +76,12 @@ bool StructureFeature::postProcess(Level *level, Random *random, int chunkX, int
}
}
}
LeaveCriticalSection(&m_csCachedStructures);
return intersection;
}
bool StructureFeature::isIntersection(int cellX, int cellZ)
{
EnterCriticalSection(&m_csCachedStructures);
restoreSavedData(level);
for( AUTO_VAR(it, cachedStructures.begin()); it != cachedStructures.end(); it++ )
@@ -110,14 +97,12 @@ bool StructureFeature::isIntersection(int cellX, int cellZ)
StructurePiece *next = *it2++;
if (next->getBoundingBox()->intersects(cellX, cellZ, cellX, cellZ))
{
LeaveCriticalSection(&m_csCachedStructures);
return true;
}
}
}
}
}
LeaveCriticalSection(&m_csCachedStructures);
return false;
}
@@ -129,7 +114,6 @@ bool StructureFeature::isInsideFeature(int cellX, int cellY, int cellZ)
StructureStart *StructureFeature::getStructureAt(int cellX, int cellY, int cellZ)
{
EnterCriticalSection(&m_csCachedStructures);
//for (StructureStart structureStart : cachedStructures.values())
for(AUTO_VAR(it, cachedStructures.begin()); it != cachedStructures.end(); ++it)
{
@@ -154,14 +138,12 @@ StructureStart *StructureFeature::getStructureAt(int cellX, int cellY, int cellZ
StructurePiece* piece = *it2;
if ( piece->getBoundingBox()->isInside(cellX, cellY, cellZ) )
{
LeaveCriticalSection(&m_csCachedStructures);
return pStructureStart;
}
}
}
}
}
LeaveCriticalSection(&m_csCachedStructures);
return NULL;
}
@@ -169,17 +151,14 @@ bool StructureFeature::isInsideBoundingFeature(int cellX, int cellY, int cellZ)
{
restoreSavedData(level);
EnterCriticalSection(&m_csCachedStructures);
for(AUTO_VAR(it, cachedStructures.begin()); it != cachedStructures.end(); ++it)
{
StructureStart *structureStart = it->second;
if (structureStart->isValid())
{
LeaveCriticalSection(&m_csCachedStructures);
return (structureStart->getBoundingBox()->intersects(cellX, cellZ, cellX, cellZ));
}
}
LeaveCriticalSection(&m_csCachedStructures);
return false;
}
@@ -203,7 +182,6 @@ TilePos *StructureFeature::getNearestGeneratedFeature(Level *level, int cellX, i
double minDistance = DBL_MAX;
TilePos *selected = NULL;
EnterCriticalSection(&m_csCachedStructures);
for(AUTO_VAR(it, cachedStructures.begin()); it != cachedStructures.end(); ++it)
{
StructureStart *pStructureStart = it->second;
@@ -227,7 +205,6 @@ TilePos *StructureFeature::getNearestGeneratedFeature(Level *level, int cellX, i
}
}
}
LeaveCriticalSection(&m_csCachedStructures);
if (selected != NULL)
{
return selected;