writeworldinfo tested to be working

This commit is contained in:
minjaesong
2018-10-08 18:15:05 +09:00
parent 783313a4ae
commit d435ec4ebb
10 changed files with 27 additions and 19 deletions

View File

@@ -66,7 +66,7 @@ internal object ReadLayerData {
// create world out of tiles data
val retWorld = inWorld ?: GameWorldExtension(1, worldWidth, worldHeight)
val retWorld = inWorld ?: GameWorldExtension(1, worldWidth, worldHeight, 0, 0, 0) // FIXME null TIME_T for the (partial) test to pass
retWorld.layerTerrain.data = terrainLayerMSB
retWorld.layerWall.data = wallLayerMSB

View File

@@ -15,8 +15,6 @@ import java.io.FileOutputStream
object WriteWorldInfo {
// FIXME UNTESTED
val META_MAGIC = "TESV".toByteArray(Charsets.UTF_8)
val NULL = 0.toByte()
@@ -108,9 +106,10 @@ object WriteWorldInfo {
metaOut.write(timeNow.toLittle48())
// get playtime and save it
val timeToAdd = timeNow - world.loadTime
metaOut.write(world.lastPlayTime.plus(timeToAdd).toInt().toLittle())
val timeToAdd = (timeNow - world.loadTime).toInt()
metaOut.write((world.totalPlayTime + timeToAdd).toLittle())
world.lastPlayTime = timeNow
world.totalPlayTime += timeToAdd