refactoring the call order of the renderers' init code invocation

This commit is contained in:
minjaesong
2019-06-25 22:24:22 +09:00
parent d2e886aec2
commit ed58e72724
29 changed files with 283 additions and 195 deletions

View File

@@ -6,15 +6,24 @@ import net.torvald.terrarum.serialise.ReadLayerDataZip
/**
* Created by minjaesong on 2018-07-03.
*/
class GameWorldExtension: GameWorld {
class GameWorldExtension : GameWorld {
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: ReadLayerDataZip.LayerData, creationTIME_T: Long, lastPlayTIME_T: Long, totalPlayTime: Int) : super(worldIndex, layerData, creationTIME_T, lastPlayTIME_T, totalPlayTime)
val time: WorldTime
/** Extended world time */
val worldTime: WorldTime
val economy = GameEconomy()
override var TIME_T: Long
get() = worldTime.TIME_T
set(value) { worldTime.TIME_T = value }
override var dayLength: Int
get() = WorldTime.DAY_LENGTH
set(value) { throw UnsupportedOperationException() }
// delegated properties //
/*val layerWall: MapLayer; get() = baseworld.layerWall
val layerTerrain: MapLayer; get() = baseworld.layerTerrain
@@ -35,14 +44,14 @@ class GameWorldExtension: GameWorld {
val damageDataArray: ByteArray; get() = baseworld.damageDataArray*/
init {
time = WorldTime( // Year EPOCH (125), Month 1, Day 1 is implied
worldTime = WorldTime( // Year EPOCH (125), Month 1, Day 1 is implied
7 * WorldTime.HOUR_SEC +
30L * WorldTime.MINUTE_SEC
)
}
fun updateWorldTime(delta: Float) {
time.update(delta)
worldTime.update(delta)
}
}

View File

@@ -3,8 +3,6 @@ package net.torvald.terrarum.modulebasegame.gameworld
import net.torvald.terrarum.gameworld.fmod
typealias time_t = Long
/**
* Please also see:
* https://en.wikipedia.org/wiki/World_Calendar
@@ -56,8 +54,9 @@ typealias time_t = Long
* Created by minjaesong on 2016-01-24.
*/
class WorldTime(initTime: Long = 0L) {
/** It is not recommended to directly modify the TIME_T. Use provided methods instead. */
var TIME_T = 0L // Epoch: Year 125 Spring 1st, 0h00:00 (Mondag) // 125-01-01
private set
init {
TIME_T = initTime