IS_DEVELOPMENT_BUILD key can now be toggled with vm option '-ea'

This commit is contained in:
minjaesong
2022-01-13 09:55:51 +09:00
parent 53645925ba
commit 1060d96364
14 changed files with 78 additions and 59 deletions

View File

@@ -1137,8 +1137,8 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
arrayOf(actorContainerActive, actorContainerInactive).forEach { actorContainer ->
val indexToDelete = actorContainer.searchForIndex(actor.referenceID) { it.referenceID }
if (indexToDelete != null) {
printdbg(this, "Removing actor $actor")
printStackTrace(this)
// printdbg(this, "Removing actor $actor")
// printStackTrace(this)
actor.dispose()
actorContainer.removeAt(indexToDelete)
@@ -1180,13 +1180,13 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
override fun addNewActor(actor: Actor?) {
if (actor == null) return
if (App.IS_DEVELOPMENT_BUILD && theGameHasActor(actor.referenceID)) {
if (theGameHasActor(actor.referenceID)) {
throw ReferencedActorAlreadyExistsException(actor)
}
else {
if (actor.referenceID !in ReferencingRanges.ACTORS_WIRES && actor.referenceID !in ReferencingRanges.ACTORS_WIRES_HELPER) {
printdbg(this, "Adding actor $actor")
printStackTrace(this)
// printdbg(this, "Adding actor $actor")
// printStackTrace(this)
}
actorContainerActive.add(actor)
@@ -1199,7 +1199,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
}
fun activateDormantActor(actor: Actor) {
if (App.IS_DEVELOPMENT_BUILD && !isInactive(actor.referenceID)) {
if (!isInactive(actor.referenceID)) {
/*if (isActive(actor.referenceID))
throw Error("The actor $actor is already activated")
else
@@ -1306,7 +1306,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
}
println("[Ingame] Resize event")
printdbg(this, "Resize event")
}
override fun dispose() {

View File

@@ -231,7 +231,7 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
worldFBO = FloatFrameBuffer(App.scr.width, App.scr.height, false)
// load list of savegames
println("[TitleScreen] update list of savegames")
printdbg(this, "update list of savegames")
// to show "Continue" and "Load" on the titlescreen, uncomment this line
App.updateListOfSavegames()

View File

@@ -46,7 +46,6 @@ internal class FixtureStorageChest : FixtureBase {
actorValue[AVKey.BASEMASS] = MASS
println("FixtureStorageChest constructor call")
printStackTrace(this)
}

View File

@@ -10,6 +10,7 @@ import net.torvald.terrarum.gameactors.ActorWithBody
import net.torvald.terrarum.gameitems.GameItem
import net.torvald.terrarum.gameitems.ItemID
import net.torvald.terrarum.gameitems.mouseInInteractableRange
import net.torvald.terrarum.gameitems.mouseInInteractableRangeTools
import net.torvald.terrarum.itemproperties.Calculate
import net.torvald.terrarum.modulebasegame.gameactors.DroppedItem
import net.torvald.terrarum.modulebasegame.gameitems.PickaxeCore.BASE_MASS_AND_SIZE
@@ -29,7 +30,7 @@ object PickaxeCore {
fun startPrimaryUse(
actor: ActorWithBody, delta: Float, item: GameItem?, mx: Int, my: Int,
dropProbability: Double = 1.0, mw: Int = 1, mh: Int = 1, attackActorBlocks: Boolean = true
) = mouseInInteractableRange(actor) {
) = mouseInInteractableRangeTools(actor, item) {
// un-round the mx
val ww = INGAME.world.width
val apos = actor.centrePosPoint

View File

@@ -157,7 +157,7 @@ class UILoadDemoSavefiles(val remoCon: UIRemoCon) : UICanvas() {
scrollAnimCounter = 0f
loadFired = 0
println("savelist mode: $mode")
printdbg(this, "savelist mode: $mode")
}
override fun show() {

View File

@@ -5,8 +5,7 @@ import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.App
import net.torvald.terrarum.App.printdbg
import net.torvald.terrarum.App.printdbgerr
import net.torvald.terrarum.App.*
import net.torvald.terrarum.QNDTreeNode
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.Yaml
@@ -109,7 +108,7 @@ open class UIRemoCon(val parent: TitleScreen, val treeRoot: QNDTreeNode<String>)
val tag = it.tags
if (tag.contains("WRITETOCONFIG")) WriteConfig()
print("[UIRemoCon] Returning from ${currentRemoConContents.data}")
if (IS_DEVELOPMENT_BUILD) print("[UIRemoCon] Returning from ${currentRemoConContents.data}")
if (currentRemoConContents.parent != null) {
remoConTray.consume()
@@ -120,7 +119,7 @@ open class UIRemoCon(val parent: TitleScreen, val treeRoot: QNDTreeNode<String>)
parent.uiFakeBlurOverlay.setAsClose()
println(" to ${currentlySelectedRemoConItem}")
if (IS_DEVELOPMENT_BUILD) println(" to ${currentlySelectedRemoConItem}")
}
else {
throw NullPointerException("No parent node to return")
@@ -128,8 +127,10 @@ open class UIRemoCon(val parent: TitleScreen, val treeRoot: QNDTreeNode<String>)
}
else {
// check if target exists
//println("current node: ${currentRemoConContents.data}")
//currentRemoConContents.children.forEach { println("- ${it.data}") }
if (IS_DEVELOPMENT_BUILD) {
//println("current node: ${currentRemoConContents.data}")
//currentRemoConContents.children.forEach { println("- ${it.data}") }
}
if (currentRemoConContents.children.size > selectedIndex ?: 0x7FFFFFFF) {
setNewRemoConContents(currentRemoConContents.children[selectedIndex!!])