issue #26 resolved (someone is hoolding stale ingame context)

This commit is contained in:
minjaesong
2019-07-03 03:59:37 +09:00
parent a399d22dd1
commit c452be669b
27 changed files with 116 additions and 81 deletions

View File

@@ -1,5 +1,6 @@
package net.torvald
import net.torvald.terrarum.printStackTrace
import sun.misc.Unsafe
/**
@@ -57,7 +58,7 @@ class UnsafePtr(pointer: Long, allocSize: Long) {
UnsafeHelper.unsafe.freeMemory(ptr)
println("[UnsafePtr] Destroying pointer $this; called from:")
Thread.currentThread().stackTrace.forEach { println(it) }
printStackTrace(this)
destroyed = true
}

View File

@@ -42,6 +42,7 @@ import java.util.HashSet;
import java.util.Random;
import static net.torvald.terrarum.TerrarumKt.gdxClearAndSetBlend;
import static net.torvald.terrarum.TerrarumKt.printStackTrace;
/**
* The framework's Application Loader
@@ -253,7 +254,7 @@ public class AppLoader implements ApplicationListener {
Gdx.gl20.glViewport(0, 0, width, height);
}
public static final double UPDATE_RATE = 1.0 / 60.0; // TODO set it like 1/100, because apparent framerate is limited by update rate
public static final float UPDATE_RATE = 1f / 64f; // TODO set it like 1/100, because apparent framerate is limited by update rate
private static float loadTimer = 0f;
private static final float showupTime = 100f / 1000f;
@@ -261,8 +262,8 @@ public class AppLoader implements ApplicationListener {
private static FrameBuffer renderFBO;
public static CommonResourcePool resourcePool;
public static HashSet<File> tempFilePool = new HashSet();
public static HashSet<Disposable> disposableSingletonsPool = new HashSet();
public static HashSet<File> tempFilePool = new HashSet<>();
public static HashSet<Disposable> disposableSingletonsPool = new HashSet<>();
public static char gamepadLabelStart = 0xE000; // lateinit
public static char gamepadLabelSelect = 0xE000; // lateinit
@@ -514,7 +515,7 @@ public class AppLoader implements ApplicationListener {
}
// draw the screen
else {
currenScreen.render((float) UPDATE_RATE);
currenScreen.render(UPDATE_RATE);
}
KeyToggler.INSTANCE.update(currenScreen instanceof TerrarumIngame);
@@ -554,9 +555,7 @@ public class AppLoader implements ApplicationListener {
@Override
public void resize(int width, int height) {
printdbg(this, "Resize called");
for (StackTraceElement stackTraceElement : Thread.currentThread().getStackTrace()) {
printdbg(this, stackTraceElement);
}
printStackTrace(this);
//initViewPort(width, height);

View File

@@ -464,7 +464,7 @@ class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
override fun run() {
var updateTries = 0
while (ingame.updateDeltaCounter >= ingame.updateRate) {
ingame.updateGame(AppLoader.UPDATE_RATE.toFloat())
ingame.updateGame(AppLoader.UPDATE_RATE)
ingame.updateDeltaCounter -= ingame.updateRate
updateTries++
@@ -1090,7 +1090,7 @@ class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
}
playableActorDelegate = newActor
WorldSimulator(player, AppLoader.UPDATE_RATE.toFloat())
WorldSimulator(player, AppLoader.UPDATE_RATE)
}
private fun changePossession(refid: Int) {
@@ -1107,7 +1107,7 @@ class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
// accept new delegate
playableActorDelegate = PlayableActorDelegate(getActorByID(refid) as ActorHumanoid)
playableActorDelegate!!.actor.collisionType = ActorWithPhysics.COLLISION_KINEMATIC
WorldSimulator(player, AppLoader.UPDATE_RATE.toFloat())
WorldSimulator(player, AppLoader.UPDATE_RATE)
}
/** Send message to notifier UI and toggle the UI as opened. */

View File

@@ -22,9 +22,22 @@ open class IngameInstance(val batch: SpriteBatch) : Screen {
val ZOOM_MAXIMUM = 4.0f
val ZOOM_MINIMUM = 0.5f
open lateinit var consoleHandler: ConsoleWindow
open var consoleHandler: ConsoleWindow = ConsoleWindow()
init {
consoleHandler.setPosition(0, 0)
printdbg(this, "New ingame instance ${this.hashCode()}, called from")
printStackTrace(this)
}
open var world: GameWorld = GameWorld.makeNullWorld()
set(value) {
printdbg(this, "Ingame instance ${this.hashCode()}, accepting new world ${value.layerTerrain}; called from")
printStackTrace(this)
field = value
}
/** how many different planets/stages/etc. are thenre. Whole stages must be manually managed by YOU. */
var gameworldCount = 0
/** The actor the game is currently allowing you to control.
@@ -63,7 +76,7 @@ open class IngameInstance(val batch: SpriteBatch) : Screen {
gameInitialised = true
}
override fun render(delta: Float) {
override fun render(updateRate: Float) {
}
override fun pause() {
@@ -83,9 +96,7 @@ open class IngameInstance(val batch: SpriteBatch) : Screen {
override fun dispose() {
printdbg(this, "Thank you for properly disposing the world!")
printdbg(this, "dispose called by")
Thread.currentThread().stackTrace.forEach {
printdbg(this, "--> $it")
}
printStackTrace(this)
world.dispose()
}

View File

@@ -22,6 +22,7 @@ import net.torvald.terrarumsansbitmap.gdx.GameFontBase
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
import net.torvald.util.CircularArray
import java.io.File
import java.io.PrintStream
import kotlin.math.absoluteValue
@@ -64,7 +65,21 @@ object Terrarum : Disposable {
var previousScreen: Screen? = null // to be used with temporary states like StateMonitorCheck
/** Current ingame instance the game is holding */
/** Current ingame instance the game is holding.
*
* The ingame instance this variable is subject to change.
*
* Don't do:
* ```
* private val ingame = Terrarum.ingame
* ```
*
* Do instead:
* ```
* private val ingame: IngameInstance
* get() = Terrarum.ingame
* ```
*/
var ingame: IngameInstance? = null
private set
@@ -103,7 +118,7 @@ object Terrarum : Disposable {
init {
println("[Terrarum] init called by:")
Thread.currentThread().stackTrace.forEach { println("... $it") }
printStackTrace(this)
println("[Terrarum] ${AppLoader.GAME_NAME} version ${AppLoader.getVERSION_STRING()}")
println("[Terrarum] LibGDX version ${com.badlogic.gdx.Version.VERSION}")
@@ -157,7 +172,7 @@ object Terrarum : Disposable {
this.ingame = ingame
printdbg(this, "Accepting new ingame instance '${ingame.javaClass.canonicalName}', called by:")
Thread.currentThread().stackTrace.forEach { printdbg(this, it) }
printStackTrace(this)
}
private fun showxxx() {
@@ -551,3 +566,13 @@ fun <T> List<T>.linearSearchBy(selector: (T) -> Boolean): T? {
return null
}
inline fun printStackTrace(obj: Any) = printStackTrace(obj, System.out) // because of Java
fun printStackTrace(obj: Any, out: PrintStream = System.out) {
if (AppLoader.IS_DEVELOPMENT_BUILD) {
Thread.currentThread().stackTrace.forEach {
out.println("[${obj.javaClass.simpleName}] ... $it")
}
}
}

View File

@@ -193,16 +193,16 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
private var introUncoverDeltaCounter = 0f
private var updateAkku = 0.0
override fun render(delta: Float) {
override fun render(updateRate: Float) {
// async update and render
val dt = Gdx.graphics.rawDeltaTime
updateAkku += dt
var i = 0L
while (updateAkku >= delta) {
AppLoader.measureDebugTime("Ingame.update") { updateScreen(delta) }
updateAkku -= delta
while (updateAkku >= updateRate) {
AppLoader.measureDebugTime("Ingame.update") { updateScreen(updateRate) }
updateAkku -= updateRate
i += 1
}
AppLoader.setDebugTime("Ingame.updateCounter", i)

View File

@@ -13,7 +13,7 @@ class ActorValue(@Transient val actor: Actor) : KVHashMap() {
override fun set(key: String, value: Any) {
/*if (key == AVKey.__PLAYER_QUICKSLOTSEL) {
Thread.currentThread().stackTrace.forEach { println(it) }
printStackTrace(this)
}*/
super.set(key, value)

View File

@@ -345,7 +345,7 @@ open class ActorWBMovable(renderOrder: RenderOrder, val immobileBody: Boolean =
val feetPosTile: Point2i = Point2i(0,0)
//get() = Point2i(hIntTilewiseHitbox.centeredX.floorInt(), hIntTilewiseHitbox.endY.floorInt())
override fun run() = update(AppLoader.UPDATE_RATE.toFloat())
override fun run() = update(AppLoader.UPDATE_RATE)
/**
* Add vector value to the velocity, in the time unit of single frame.

View File

@@ -1,6 +1,7 @@
package net.torvald.terrarum.gameactors
import net.torvald.terrarum.Point2d
import net.torvald.terrarum.printStackTrace
import org.dyn4j.geometry.Vector2
/**
@@ -28,7 +29,7 @@ class Hitbox (x1: Double, y1: Double, width: Double, height: Double, var suppres
if (!suppressWarning && (width == 0.0 || height == 0.0)) {
println("[Hitbox] width or height is zero ($this), perhaps you want to check it out?")
Thread.currentThread().stackTrace.forEach { println(it) }
printStackTrace(this)
}
}
@@ -67,7 +68,7 @@ class Hitbox (x1: Double, y1: Double, width: Double, height: Double, var suppres
if (!suppressWarning && (width == 0.0 || height == 0.0)) {
println("[Hitbox] width or height is zero ($this), perhaps you want to check it out?")
Thread.currentThread().stackTrace.forEach { println(it) }
printStackTrace(this)
}
return this
@@ -85,7 +86,7 @@ class Hitbox (x1: Double, y1: Double, width: Double, height: Double, var suppres
if (!suppressWarning && (width == 0.0 || height == 0.0)) {
println("[Hitbox] width or height is zero ($this), perhaps you want to check it out?")
Thread.currentThread().stackTrace.forEach { println(it) }
printStackTrace(this)
}
return this

View File

@@ -61,10 +61,10 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
if (
Gdx.input.isButtonPressed(AppLoader.getConfigInt("mouseprimary")) ||
Gdx.input.isButtonPressed(AppLoader.getConfigInt("mousesecondary"))) {
terrarumIngame.worldPrimaryClickStart(AppLoader.UPDATE_RATE.toFloat())
terrarumIngame.worldPrimaryClickStart(AppLoader.UPDATE_RATE)
}
/*if Gdx.input.isButtonPressed(AppLoader.getConfigInt("mousesecondary")) {
ingame.worldSecondaryClickStart(AppLoader.UPDATE_RATE.toFloat())
ingame.worldSecondaryClickStart(AppLoader.UPDATE_RATE)
}*/
}
}
@@ -151,10 +151,10 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
if (
button == AppLoader.getConfigInt("mouseprimary") ||
button == AppLoader.getConfigInt("mousesecondary")) {
terrarumIngame.worldPrimaryClickEnd(AppLoader.UPDATE_RATE.toFloat())
terrarumIngame.worldPrimaryClickEnd(AppLoader.UPDATE_RATE)
}
/*if (button == AppLoader.getConfigInt("mousesecondary")) {
ingame.worldSecondaryClickEnd(AppLoader.UPDATE_RATE.toFloat())
ingame.worldSecondaryClickEnd(AppLoader.UPDATE_RATE)
}*/
}
}

View File

@@ -143,6 +143,8 @@ open class BlockLayer(val width: Int, val height: Int) : Disposable {
printdbg(this, "BlockLayer with ptr ($ptr) successfully freed")
}
override fun toString(): String = ptr.toString()
companion object {
@Transient val BYTES_PER_BLOCK = 2L
}

View File

@@ -9,6 +9,7 @@ import net.torvald.terrarum.blockproperties.Block
import net.torvald.terrarum.blockproperties.BlockCodex
import net.torvald.terrarum.blockproperties.Fluid
import net.torvald.terrarum.modulebasegame.gameworld.WorldSimulator
import net.torvald.terrarum.printStackTrace
import net.torvald.terrarum.realestate.LandUtil
import net.torvald.terrarum.serialise.ReadLayerDataZip
import net.torvald.util.SortedArrayList
@@ -28,9 +29,7 @@ open class GameWorld : Disposable {
throw Error("World index start at 1; you've entered $value")
printdbg(this, "Creation of new world with index $value, called by:")
Thread.currentThread().stackTrace.forEach {
printdbg(this, "--> $it")
}
printStackTrace(this)
field = value
}

View File

@@ -36,8 +36,6 @@ object ItemCodex {
private val itemImagePlaceholder: TextureRegion
get() = AppLoader.resourcePool.getAsTextureRegion("itemplaceholder_24") // copper pickaxe
//private val ingame = Terrarum.ingame!! as Ingame // WARNING you can't put this here, ExceptionInInitializerError
// TODO: when generalised, there's no guarantee that blocks will be used as an item. Write customised item prop loader and init it on the Ingame

View File

@@ -317,7 +317,7 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
private var updateAkku = 0.0
override fun render(delta: Float) {
override fun render(updateRate: Float) {
Gdx.graphics.setTitle(TerrarumIngame.getCanonicalTitle())
@@ -327,9 +327,9 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
updateAkku += dt
var i = 0L
while (updateAkku >= delta) {
AppLoader.measureDebugTime("Ingame.update") { updateGame(delta) }
updateAkku -= delta
while (updateAkku >= updateRate) {
AppLoader.measureDebugTime("Ingame.update") { updateGame(updateRate) }
updateAkku -= updateRate
i += 1
}
AppLoader.setDebugTime("Ingame.updateCounter", i)

View File

@@ -27,7 +27,6 @@ import net.torvald.terrarum.modulebasegame.ui.*
import net.torvald.terrarum.modulebasegame.weather.WeatherMixer
import net.torvald.terrarum.modulebasegame.worldgenerator.RoguelikeRandomiser
import net.torvald.terrarum.modulebasegame.worldgenerator.WorldGenerator
import net.torvald.terrarum.ui.ConsoleWindow
import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.worlddrawer.CreateTileAtlas
import net.torvald.terrarum.worlddrawer.CreateTileAtlas.TILE_SIZE
@@ -236,7 +235,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
*/
private fun enter(worldParams: NewWorldParameters) {
printdbg(this, "Ingame called")
printStackTrace()
printStackTrace(this)
if (gameInitialised) {
printdbg(this, "loaded successfully.")
@@ -285,8 +284,9 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
}
// init console window
consoleHandler = ConsoleWindow()
consoleHandler.setPosition(0, 0)
// TODO test put it on the IngameInstance.(init)
//consoleHandler = ConsoleWindow()
//consoleHandler.setPosition(0, 0)
// init notifier
@@ -426,9 +426,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
private var updateAkku = 0.0
override fun render(delta: Float) {
println("Vitun Perkeleen TerrarumIngame")
override fun render(`_`: Float) {
// Q&D solution for LoadScreen and Ingame, where while LoadScreen is working, Ingame now no longer has GL Context
// there's still things to load which needs GL context to be present
if (!gameFullyLoaded) {
@@ -447,6 +445,9 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
gameFullyLoaded = true
}
// define custom update rate
val updateRate = if (KeyToggler.isOn(Input.Keys.APOSTROPHE)) 1f / 8f else AppLoader.UPDATE_RATE
// ASYNCHRONOUS UPDATE AND RENDER //
/** UPDATE CODE GOES HERE */
@@ -454,9 +455,9 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
updateAkku += dt
var i = 0L
while (updateAkku >= delta) {
AppLoader.measureDebugTime("Ingame.update") { updateGame(delta) }
updateAkku -= delta
while (updateAkku >= updateRate) {
AppLoader.measureDebugTime("Ingame.update") { updateGame(updateRate) }
updateAkku -= updateRate
i += 1
}
AppLoader.setDebugTime("Ingame.updateCounter", i)
@@ -473,7 +474,9 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
private var worldWidth: Double = 0.0
/**
* Ingame (world) related updates; UI update must go to renderGame()
*/
protected fun updateGame(delta: Float) {
val world = this.world as GameWorldExtension
worldWidth = world.width.toDouble() * TILE_SIZE
@@ -532,7 +535,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
////////////////////////
// ui-related updates //
////////////////////////
uiContainer.forEach { it.update(delta) }
//uiContainer.forEach { it.update(delta) }
//debugWindow.update(delta)
//notifier.update(delta)
@@ -548,6 +551,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
Gdx.graphics.setTitle(getCanonicalTitle())
filterVisibleActors()
uiContainer.forEach { it.update(Gdx.graphics.rawDeltaTime) }
IngameRenderer.invoke(
paused,
@@ -769,7 +773,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
val indexToDelete = actorContainerActive.searchForIndex(actor.referenceID!!) { it.referenceID!! }
if (indexToDelete != null) {
printdbg(this, "Removing actor $actor")
printStackTrace()
printStackTrace(this)
actorContainerActive.removeAt(indexToDelete)
@@ -835,7 +839,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
}
else {
printdbg(this, "Adding actor $actor")
printStackTrace()
printStackTrace(this)
actorContainerActive.add(actor)
@@ -1008,11 +1012,4 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
super.dispose()
}
private fun printStackTrace() {
Thread.currentThread().getStackTrace().forEach {
printdbg(this, "--> $it")
}
}
}

View File

@@ -508,7 +508,7 @@ open class ActorHumanoid(
val timedJumpCharge = jumpFunc(MAX_JUMP_LENGTH, jmpCtr)
forceVec.y -= getJumpAcc(jumpPower, timedJumpCharge)
forceVec.y += getDrag(AppLoader.UPDATE_RATE.toFloat(), forceVec).y
forceVec.y += getDrag(AppLoader.UPDATE_RATE, forceVec).y
simYPos += forceVec.y // ignoring all the fluid drag OTHER THAN THE AIR

View File

@@ -215,7 +215,7 @@ class ActorInventory(@Transient val actor: Pocketed, var maxCapacity: Int, var c
actor.avStrength / 1000.0
else
1.0 // TODO variable: scale, strength
val swingDmgToFrameDmg = AppLoader.UPDATE_RATE.toFloat().toDouble() / actor.actorValue.getAsDouble(AVKey.ACTION_INTERVAL)!!
val swingDmgToFrameDmg = AppLoader.UPDATE_RATE.toDouble() / actor.actorValue.getAsDouble(AVKey.ACTION_INTERVAL)!!
// damage the item
newItem.durability -= (baseDamagePerSwing * swingDmgToFrameDmg).toFloat()

View File

@@ -23,7 +23,7 @@ open class ParticleBase(renderOrder: Actor.RenderOrder, val despawnUponCollision
/** Will NOT actually delete from the CircularArray */
@Volatile var flagDespawn = false
override fun run() = update(AppLoader.UPDATE_RATE.toFloat())
override fun run() = update(AppLoader.UPDATE_RATE)
var isNoSubjectToGrav = false
var dragCoefficient = 3.0

View File

@@ -28,7 +28,7 @@ interface Pocketed {
}
inventory.itemEquipped[item.equipPosition] = null
item.effectOnUnequip(AppLoader.UPDATE_RATE.toFloat())
item.effectOnUnequip(AppLoader.UPDATE_RATE)
}
fun unequipItem(itemID: ItemID?) {
@@ -56,7 +56,7 @@ interface Pocketed {
if (item.equipPosition >= 0) {
inventory.itemEquipped[item.equipPosition] = item.dynamicID
item.effectWhenEquipped(AppLoader.UPDATE_RATE.toFloat())
item.effectWhenEquipped(AppLoader.UPDATE_RATE)
}
// else do nothing
}

View File

@@ -11,13 +11,13 @@ class ThreadActorUpdate(val startIndex: Int, val endIndex: Int) : Runnable {
override fun run() {
for (i in startIndex..endIndex) {
val it = Terrarum.ingame!!.actorContainerActive[i]
it.update(AppLoader.UPDATE_RATE.toFloat())
it.update(AppLoader.UPDATE_RATE)
if (it is Pocketed) {
it.inventory.forEach { inventoryEntry ->
ItemCodex[inventoryEntry.item]?.effectWhileInPocket(AppLoader.UPDATE_RATE.toFloat())
ItemCodex[inventoryEntry.item]?.effectWhileInPocket(AppLoader.UPDATE_RATE)
if (it.equipped(inventoryEntry.item)) {
ItemCodex[inventoryEntry.item]?.effectWhenEquipped(AppLoader.UPDATE_RATE.toFloat())
ItemCodex[inventoryEntry.item]?.effectWhenEquipped(AppLoader.UPDATE_RATE)
}
}
}

View File

@@ -4,6 +4,7 @@ import com.badlogic.gdx.Input
import com.badlogic.gdx.graphics.Color
import net.torvald.aa.KDTree
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.IngameInstance
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.blockproperties.Block
import net.torvald.terrarum.blockproperties.BlockCodex
@@ -11,6 +12,7 @@ import net.torvald.terrarum.blockproperties.Fluid
import net.torvald.terrarum.gameactors.ActorWBMovable
import net.torvald.terrarum.gamecontroller.KeyToggler
import net.torvald.terrarum.gameworld.FluidType
import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
import net.torvald.terrarum.roundInt
import net.torvald.terrarum.worlddrawer.CreateTileAtlas
@@ -58,8 +60,10 @@ object WorldSimulator {
val colourNone = Color(0x808080FF.toInt())
val colourWater = Color(0x66BBFFFF.toInt())
private val ingame = Terrarum.ingame!!
private val world = ingame.world
private val ingame: IngameInstance
get() = Terrarum.ingame!!
private val world: GameWorld
get() = ingame.world
// TODO use R-Tree instead? https://stackoverflow.com/questions/10269179/find-rectangles-that-contain-point-efficient-algorithm#10269695
private var actorsKDTree: KDTree? = null
@@ -81,7 +85,6 @@ object WorldSimulator {
updateXTo = updateXFrom + DOUBLE_RADIUS
updateYTo = updateYFrom + DOUBLE_RADIUS
}
moveFluids(delta)
displaceFallables(delta)

View File

@@ -7,7 +7,7 @@ import net.torvald.terrarum.ui.UICanvas
/**
* Created by minjaesong on 2017-03-13.
*/
class NullUI : UICanvas() {
object NullUI : UICanvas() {
override var width: Int = 0
override var height: Int = 0
override var openCloseTime = 0f

View File

@@ -5,7 +5,6 @@ import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.console.Authenticator
import net.torvald.terrarum.console.CommandInterpreter
import net.torvald.terrarum.fillRect

View File

@@ -145,9 +145,7 @@ class UINSMenu(
private fun popSubMenu() {
if (listStack.size == 1) {
System.err.println("[UINSMenu] Tried to pop root menu")
Thread.currentThread().getStackTrace().forEach {
System.err.println(it)
}
printStackTrace(this, System.err)
return
}

View File

@@ -31,6 +31,7 @@ import kotlin.math.roundToInt
*/
internal object BlocksDrawer {
/** World change is managed by IngameRenderer.setWorld() */
internal var world: GameWorld = GameWorld.makeNullWorld()
private val TILE_SIZE = CreateTileAtlas.TILE_SIZE
@@ -724,9 +725,7 @@ internal object BlocksDrawer {
fun dispose() {
printdbg(this, "dispose called by")
Thread.currentThread().stackTrace.forEach {
printdbg(this, "--> $it")
}
printStackTrace(this)
weatherTerrains.forEach { it.dispose() }
tilesWire.dispose()

View File

@@ -13,6 +13,8 @@ import net.torvald.terrarum.worlddrawer.CreateTileAtlas.TILE_SIZE
* Created by minjaesong on 2015-12-31.
*/
object FeaturesDrawer {
/** World change is managed by IngameRenderer.setWorld() */
internal var world: GameWorld = GameWorld.makeNullWorld()
//const val TILE_SIZE = CreateTileAtlas.TILE_SIZE

View File

@@ -38,6 +38,7 @@ import net.torvald.terrarum.realestate.LandUtil
object LightmapRenderer {
private const val TILE_SIZE = CreateTileAtlas.TILE_SIZE
/** World change is managed by IngameRenderer.setWorld() */
private var world: GameWorld = GameWorld.makeNullWorld()
private lateinit var lightCalcShader: ShaderProgram