mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
more on savegame migrator and virtualdisk bugfix
This commit is contained in:
BIN
lib/TerranVirtualDisk-src.jar
LFS
BIN
lib/TerranVirtualDisk-src.jar
LFS
Binary file not shown.
BIN
lib/TerranVirtualDisk.jar
LFS
BIN
lib/TerranVirtualDisk.jar
LFS
Binary file not shown.
@@ -159,7 +159,7 @@ open class IngameInstance(val batch: FlippingSpriteBatch, val isMultiplayer: Boo
|
||||
val wallChangeQueue = ArrayList<BlockChangeQueueItem?>()
|
||||
val wireChangeQueue = ArrayList<BlockChangeQueueItem?>() // if 'old' is set and 'new' is blank, it's a wire cutter
|
||||
|
||||
val modifiedChunks = Array(16) { TreeSet<Int>() }
|
||||
val modifiedChunks = Array(16) { TreeSet<Long>() }
|
||||
|
||||
var loadedTime_t = App.getTIME_T()
|
||||
protected set
|
||||
|
||||
@@ -49,11 +49,17 @@ object SavegameConverter {
|
||||
val DOM = ClusteredFormatDOM(newDisk)
|
||||
val root = DOM.getRootFile()
|
||||
|
||||
var cnt = 0
|
||||
|
||||
// do filecopy
|
||||
type254DOM.entries.filter { it.key != 0L }.forEach { entryID, diskEntry ->
|
||||
val filename = Common.type254EntryIDtoType17Filename(entryID)
|
||||
|
||||
println("Converting file $filename; old cluster size: ${DOM.usedClusterCount}; old ROOT cluster num: ${DOM.getRootDir().entryID}; fileCount: $cnt")
|
||||
|
||||
if (diskEntry.contents !is EntryFile) throw IllegalStateException("Entry in the savegame is not a file (${diskEntry.contents.javaClass.simpleName})")
|
||||
|
||||
cnt += 1
|
||||
val entry = diskEntry.contents as EntryFile
|
||||
|
||||
val oldBytes = entry.bytes.toByteArray()
|
||||
@@ -72,4 +78,11 @@ object SavegameConverter {
|
||||
DOM.dispose()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val infile = File("/home/torvald/.Terrarum/Worlds/2d3e3aa5-bf5b-45c8-acf6-66ef9f1c2217")
|
||||
val outfile = File("/home/torvald/.Terrarum/Worlds/2d3e3aa5-bf5b-45c8-acf6-66ef9f1c2217.terrarumworld")
|
||||
|
||||
SavegameConverter.type254toType11(infile, outfile)
|
||||
}
|
||||
@@ -550,7 +550,7 @@ abstract class Gen(val world: GameWorld, val isFinal: Boolean, val seed: Long, v
|
||||
protected abstract fun getGenerator(seed: Long, params: Any?): List<Joise>
|
||||
protected abstract fun draw(xStart: Int, yStart: Int, noises: List<Joise>, soff: Double)
|
||||
|
||||
private fun getChunksRange(): List<Int> {
|
||||
private fun getChunksRange(): List<Long> {
|
||||
val (yStart, yEnd) = Worldgen.getChunkGenStrip(world)
|
||||
return (0 until world.width / CHUNK_W step 2).flatMap { cx -> // skip every other column because we can :smiling_face_with_horns:
|
||||
(LandUtil.chunkXYtoChunkNum(world, cx, yStart)..LandUtil.chunkXYtoChunkNum(world, cx, yEnd)).toList()
|
||||
|
||||
@@ -761,7 +761,7 @@ object Common {
|
||||
|
||||
|
||||
fun type254EntryIDtoType17Filename(entryID: Long): String {
|
||||
return entryID.toString(16).uppercase().padStart(16,'0')
|
||||
return entryID.toULong().toString(16).uppercase().padStart(16,'0')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user