serialisation of the world is split into two packages: complex one is moved under the modulebasegame package

This commit is contained in:
minjaesong
2022-09-03 23:05:49 +09:00
parent d6144d52d2
commit 7905de5481
24 changed files with 95 additions and 70 deletions

View File

@@ -2,6 +2,7 @@ package net.torvald.terrarum.gameworld
import com.badlogic.gdx.utils.Disposable
import net.torvald.terrarum.App.printdbg
import net.torvald.terrarum.serialise.toUint
import net.torvald.unsafe.UnsafeHelper
import net.torvald.unsafe.UnsafePtr
@@ -107,5 +108,3 @@ open class BlockLayer(val width: Int, val height: Int) : Disposable {
@Transient val BYTES_PER_BLOCK = 2L
}
}
fun Byte.toUint() = java.lang.Byte.toUnsignedInt(this)

View File

@@ -32,9 +32,9 @@ class PhysicalStatus() {
}
/**
* Special version of GameWorld where layer data are not transient
* Special version of GameWorld where everything, including layer data, are saved in a single JSON file (i.e. not chunked)
*/
class GameWorldTitleScreen : GameWorld() {
class SimpleGameWorld : GameWorld() {
override lateinit var layerWall: BlockLayer
override lateinit var layerTerrain: BlockLayer
}
@@ -128,7 +128,7 @@ open class GameWorld() : Disposable {
val extraFields = HashMap<String, Any?>()
// internal var genver = -1 // only gets used when the game saves and loads
// NOTE: genver was here but removed: genver will be written by manually editing the serialising JSON. Reason: the 'genver' string must be found on a fixed offset on the file.
internal var comp = -1 // only gets used when the game saves and loads
internal val dynamicItemInventory = ItemTable()