diff --git a/src/net/torvald/terrarum/gameworld/GameWorld.kt b/src/net/torvald/terrarum/gameworld/GameWorld.kt index a8134925c..26559e2f0 100644 --- a/src/net/torvald/terrarum/gameworld/GameWorld.kt +++ b/src/net/torvald/terrarum/gameworld/GameWorld.kt @@ -201,6 +201,7 @@ open class GameWorld( layerTerrain = BlockLayerI16(width, height) layerWall = BlockLayerI16(width, height) + layerOres = BlockLayerI16I8(width, height) // temperature layer: 2x2 is one cell //layerThermal = MapLayerHalfFloat(width, height, averageTemperature) diff --git a/src/net/torvald/terrarum/modulebasegame/serialise/QuickSaveThread.kt b/src/net/torvald/terrarum/modulebasegame/serialise/QuickSaveThread.kt index 1fbae8a24..6ae019aa7 100644 --- a/src/net/torvald/terrarum/modulebasegame/serialise/QuickSaveThread.kt +++ b/src/net/torvald/terrarum/modulebasegame/serialise/QuickSaveThread.kt @@ -109,7 +109,7 @@ class QuickSingleplayerWorldSavingThread( ingame.world.getLayer(layerNum)?.let { layer -> chunks.forEach { chunkNumber -> - printdbg(this, "Writing chunks... $chunksWrote/$chunkCount") + printdbg(this, "Writing chunks... $chunksWrote/$chunkCount (chunk# $chunkNumber at layer# $layerNum)") val chunkXY = LandUtil.chunkNumToChunkXY(ingame.world, chunkNumber) diff --git a/src/net/torvald/terrarum/modulebasegame/serialise/WorldSavingThread.kt b/src/net/torvald/terrarum/modulebasegame/serialise/WorldSavingThread.kt index 13e086fda..2e251abba 100644 --- a/src/net/torvald/terrarum/modulebasegame/serialise/WorldSavingThread.kt +++ b/src/net/torvald/terrarum/modulebasegame/serialise/WorldSavingThread.kt @@ -57,7 +57,7 @@ class WorldSavingThread( val playersList: List = allTheActors.filterIsInstance() val actorsList = allTheActors.filter { WriteWorld.actorAcceptable(it) } - val layers = intArrayOf(0,1).map { ingame.world.getLayer(it) } + val layers = intArrayOf(0,1,2).map { ingame.world.getLayer(it) } val cw = ingame.world.width / LandUtil.CHUNK_W val ch = ingame.world.height / LandUtil.CHUNK_H diff --git a/src/net/torvald/terrarum/modulebasegame/serialise/WriteSavegame.kt b/src/net/torvald/terrarum/modulebasegame/serialise/WriteSavegame.kt index 840a6301f..836d09923 100644 --- a/src/net/torvald/terrarum/modulebasegame/serialise/WriteSavegame.kt +++ b/src/net/torvald/terrarum/modulebasegame/serialise/WriteSavegame.kt @@ -5,6 +5,7 @@ import net.torvald.terrarum.* import net.torvald.terrarum.App.printdbg import net.torvald.terrarum.console.Echo import net.torvald.terrarum.gameworld.BlockLayerI16 +import net.torvald.terrarum.gameworld.BlockLayerI16I8 import net.torvald.terrarum.gameworld.GameWorld import net.torvald.terrarum.langpack.Lang import net.torvald.terrarum.modulebasegame.ChunkLoadingLoadScreen @@ -145,6 +146,7 @@ object LoadSavegame { world.layerTerrain = BlockLayerI16(world.width, world.height) world.layerWall = BlockLayerI16(world.width, world.height) + world.layerOres = BlockLayerI16I8(world.width, world.height) newIngame.world = world // must be set before the loadscreen, otherwise the loadscreen will try to read from the NullWorld which is already destroyed newIngame.worldDisk = VDUtil.readDiskArchive(worldDisk.diskFile, Level.INFO) @@ -184,10 +186,12 @@ object LoadSavegame { val cw = LandUtil.CHUNK_W val ch = LandUtil.CHUNK_H val chunkCount = world.width * world.height / (cw * ch) - val worldLayer = arrayOf(world.getLayer(0), world.getLayer(1)) + val hasOreLayer = (newIngame.worldDisk.getFile(0x1_0000_0000L or 2L.shl(24)) != null) + val worldLayer = (if (hasOreLayer) intArrayOf(0,1,2) else intArrayOf(0,1)).map { world.getLayer(it) } + val layerCount = worldLayer.size for (chunk in 0L until (world.width * world.height) / (cw * ch)) { for (layer in worldLayer.indices) { - loadscreen.addMessage("${Lang["MENU_IO_LOADING"]} ${chunk*worldLayer.size+layer+1}/${chunkCount*2}") + loadscreen.addMessage("${Lang["MENU_IO_LOADING"]} ${chunk*layerCount+layer+1}/${chunkCount*layerCount}") val chunkFile = newIngame.worldDisk.getFile(0x1_0000_0000L or layer.toLong().shl(24) or chunk)!! val chunkXY = LandUtil.chunkNumToChunkXY(world, chunk.toInt())