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

@@ -23,7 +23,9 @@ import kotlin.system.measureNanoTime
*/
class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
val gameWorld = GameWorldExtension(1, 1024, 256)
private val timeNow = System.currentTimeMillis() / 1000
val gameWorld = GameWorldExtension(1, 1024, 256, timeNow, timeNow, 0)
init {
// ghetto world for building

View File

@@ -231,7 +231,8 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
// init map as chosen size
gameworld = GameWorldExtension(1, worldParams.width, worldParams.height)
val timeNow = System.currentTimeMillis() / 1000
gameworld = GameWorldExtension(1, worldParams.width, worldParams.height, timeNow, timeNow, 0) // new game, so the creation time is right now
gameworldCount++
world = gameworld as GameWorld

View File

@@ -5,6 +5,7 @@ import net.torvald.terrarum.console.Echo
import net.torvald.terrarum.console.EchoError
import net.torvald.terrarum.serialise.WriteLayerDataLzma
import net.torvald.terrarum.serialise.WriteLayerDataZip
import net.torvald.terrarum.serialise.WriteWorldInfo
/**
* Created by minjaesong on 2017-07-18.
@@ -12,7 +13,8 @@ import net.torvald.terrarum.serialise.WriteLayerDataZip
object ExportLayerData : ConsoleCommand {
override fun execute(args: Array<String>) {
try {
val outfile = WriteLayerDataLzma()
val outfile = WriteLayerDataZip()
WriteWorldInfo()
Echo("Layer data exported to ${outfile!!.canonicalPath}")
}
catch (e: Exception) {

View File

@@ -22,7 +22,7 @@ object ImportLayerData : ConsoleCommand {
val layerData = ReadLayerDataLzma(file)
Terrarum.ingame!!.world = GameWorldExtension(1, layerData)
Terrarum.ingame!!.world = GameWorldExtension(1, layerData, 0, 0, 0) // FIXME null TIME_T for the (partial) test to pass
Terrarum.ingame!!.actorNowPlaying?.setPosition(
(Terrarum.ingame!!.world).spawnY * FeaturesDrawer.TILE_SIZE.toDouble(),
(Terrarum.ingame!!.world).spawnX * FeaturesDrawer.TILE_SIZE.toDouble()

View File

@@ -8,8 +8,8 @@ import net.torvald.terrarum.serialise.ReadLayerDataLzma
*/
class GameWorldExtension: GameWorld {
constructor(worldIndex: Int, width: Int, height: Int) : super(worldIndex, width, height)
internal constructor(worldIndex: Int, layerData: ReadLayerDataLzma.LayerData) : super(worldIndex, layerData)
constructor(worldIndex: Int, width: Int, height: Int, creationTIME_T: Long, lastPlayTIME_T: Long, totalPlayTime: Int) : super(worldIndex, width, height, creationTIME_T, lastPlayTIME_T, totalPlayTime)
internal constructor(worldIndex: Int, layerData: ReadLayerDataLzma.LayerData, creationTIME_T: Long, lastPlayTIME_T: Long, totalPlayTime: Int) : super(worldIndex, layerData, creationTIME_T, lastPlayTIME_T, totalPlayTime)
val time: WorldTime

View File

@@ -27,11 +27,11 @@ class UITitleCharactersList : UICanvas() {
override var height = Terrarum.HEIGHT - moduleAreaHMargin * 2
private val moduleInfoCells = ArrayList<UIItemSavegameInfoCell>()
// build module list
// build characters list
init {
SavegameLedger.getSavefileList()?.forEachIndexed { index, file ->
}
//SavegameLedger.getSavefileList()?.forEachIndexed { index, file ->
//
//}
}
private val mouduleArea = UIItemList<UIItemSavegameInfoCell>(