|
@@ -304,6 +304,30 @@ void Dimension::getAddrOfWorld(Punkt wPos, char* addr) const
|
|
getAddrOf(wPos, addr);
|
|
getAddrOf(wPos, addr);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void Dimension::saveStructure(MultiblockStructure* zStructure) const
|
|
|
|
+{
|
|
|
|
+ Datei d;
|
|
|
|
+ Text path = Game::INSTANCE->getWorldDirectory() + "/dim/"
|
|
|
|
+ + Text(dimensionId) + "/structures/";
|
|
|
|
+ path.appendHex(zStructure->getStructureId());
|
|
|
|
+ path += ".str";
|
|
|
|
+ d.setDatei(path);
|
|
|
|
+ d.erstellen();
|
|
|
|
+ d.open(Datei::Style::schreiben);
|
|
|
|
+ auto uPos = zStructure->getUniquePosition();
|
|
|
|
+ d.schreibe((char*)&uPos.x, 4);
|
|
|
|
+ d.schreibe((char*)&uPos.y, 4);
|
|
|
|
+ d.schreibe((char*)&uPos.z, 4);
|
|
|
|
+ int typeId = zStructure->getStructureTypeId();
|
|
|
|
+ d.schreibe((char*)&typeId, 4);
|
|
|
|
+ __int64 strId = zStructure->getStructureId();
|
|
|
|
+ d.schreibe((char*)&strId, 8);
|
|
|
|
+ StaticRegistry<MultiblockStructureType>::INSTANCE
|
|
|
|
+ .zElement(zStructure->getStructureTypeId())
|
|
|
|
+ ->saveStructure(zStructure, &d);
|
|
|
|
+ d.close();
|
|
|
|
+}
|
|
|
|
+
|
|
Chunk* Dimension::zChunk(Punkt wPos) const
|
|
Chunk* Dimension::zChunk(Punkt wPos) const
|
|
{
|
|
{
|
|
char addr[8];
|
|
char addr[8];
|
|
@@ -552,6 +576,10 @@ void Dimension::save(Text worldDir) const
|
|
}
|
|
}
|
|
file->close();
|
|
file->close();
|
|
}
|
|
}
|
|
|
|
+ for (MultiblockStructure* structure : structures)
|
|
|
|
+ {
|
|
|
|
+ saveStructure(structure);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
int Dimension::getDimensionId() const
|
|
int Dimension::getDimensionId() const
|
|
@@ -628,26 +656,7 @@ void Dimension::removeOldChunks()
|
|
}
|
|
}
|
|
else if (i->isFullyUnloaded())
|
|
else if (i->isFullyUnloaded())
|
|
{
|
|
{
|
|
- Datei d;
|
|
|
|
- Text path = Game::INSTANCE->getWorldDirectory() + "/dim/"
|
|
|
|
- + Text(dimensionId) + "/structures/";
|
|
|
|
- path.appendHex(i->getStructureId());
|
|
|
|
- path += ".str";
|
|
|
|
- d.setDatei(path);
|
|
|
|
- d.erstellen();
|
|
|
|
- d.open(Datei::Style::schreiben);
|
|
|
|
- auto uPos = i->getUniquePosition();
|
|
|
|
- d.schreibe((char*)&uPos.x, 4);
|
|
|
|
- d.schreibe((char*)&uPos.y, 4);
|
|
|
|
- d.schreibe((char*)&uPos.z, 4);
|
|
|
|
- int typeId = i->getStructureTypeId();
|
|
|
|
- d.schreibe((char*)&typeId, 4);
|
|
|
|
- __int64 strId = i->getStructureId();
|
|
|
|
- d.schreibe((char*)&strId, 8);
|
|
|
|
- StaticRegistry<MultiblockStructureType>::INSTANCE
|
|
|
|
- .zElement(i->getStructureTypeId())
|
|
|
|
- ->saveStructure(i.val(), &d);
|
|
|
|
- d.close();
|
|
|
|
|
|
+ saveStructure(i);
|
|
i.remove();
|
|
i.remove();
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
@@ -724,7 +733,7 @@ void Dimension::updateLightAtChunkBorders(Punkt chunkCenter)
|
|
if (lightUpdateQueue.getEintragAnzahl() > 300000)
|
|
if (lightUpdateQueue.getEintragAnzahl() > 300000)
|
|
{
|
|
{
|
|
std::cout
|
|
std::cout
|
|
- << "warning: light calculation queue is over 300000 blocks long";
|
|
|
|
|
|
+ << "warning: light calculation queue is over 300000 blocks long\n";
|
|
}
|
|
}
|
|
for (int i = WORLD_HEIGHT - 1; i >= 0; i--)
|
|
for (int i = WORLD_HEIGHT - 1; i >= 0; i--)
|
|
{
|
|
{
|