tevd update; seemingly working savefile export

This commit is contained in:
minjaesong
2021-08-30 01:16:15 +09:00
parent c610bd1ac6
commit 7ae862dd05
6 changed files with 87 additions and 4 deletions

View File

@@ -13,12 +13,12 @@ import java.math.BigInteger
*/
object WriteActor {
operator fun invoke(actor: IngamePlayer): String {
operator fun invoke(actor: Actor): String {
val s = Common.jsoner.toJson(actor, actor.javaClass)
return """{"class":"${actor.javaClass.canonicalName}",${s.substring(1)}"""
}
fun encodeToByteArray64(actor: IngamePlayer): ByteArray64 {
fun encodeToByteArray64(actor: Actor): ByteArray64 {
val ba = ByteArray64()
this.invoke(actor).toByteArray().forEach { ba.add(it) }
return ba

View File

@@ -20,7 +20,7 @@ open class WriteMeta(val ingame: TerrarumIngame) {
val world = ingame.world
val json = """{
"genver": 4,
"genver": ${Common.GENVER},
"savename": "${world.worldName}",
"terrseed": ${world.generatorSeed},
"randseed0": ${RoguelikeRandomiser.RNG.state0},

View File

@@ -18,7 +18,7 @@ open class WriteWorld(val ingame: TerrarumIngame) {
}
fun encodeToByteArray64(): ByteArray64 {
val world = ingame.world
/*val world = ingame.world
world.genver = Common.GENVER
world.comp = Common.COMP_GZIP
@@ -38,6 +38,10 @@ open class WriteWorld(val ingame: TerrarumIngame) {
Common.jsoner.toJson(world, wr)
wr.flush(); wr.close()
return ba*/
val ba = ByteArray64()
this.invoke().toByteArray().forEach { ba.add(it) }
return ba
}