diff --git a/src/net/torvald/terrarum/gameworld/BlockLayer.kt b/src/net/torvald/terrarum/gameworld/BlockLayer.kt index dacc7fc2a..08ed76528 100644 --- a/src/net/torvald/terrarum/gameworld/BlockLayer.kt +++ b/src/net/torvald/terrarum/gameworld/BlockLayer.kt @@ -23,6 +23,9 @@ open class BlockLayer(val width: Int, val height: Int) : Disposable { // using unsafe pointer gets you 100 fps, whereas using directbytebuffer gets you 90 internal val ptr: UnsafePtr = UnsafeHelper.allocate(width * height * BYTES_PER_BLOCK) + val ptrDestroyed: Boolean + get() = ptr.destroyed + init { ptr.fillWith(0) } diff --git a/src/net/torvald/terrarum/modulebasegame/WorldgenLoadScreen.kt b/src/net/torvald/terrarum/modulebasegame/WorldgenLoadScreen.kt index 33ab5ea29..69ae5ef3b 100644 --- a/src/net/torvald/terrarum/modulebasegame/WorldgenLoadScreen.kt +++ b/src/net/torvald/terrarum/modulebasegame/WorldgenLoadScreen.kt @@ -95,13 +95,16 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, private val worldwidt val wx = (world.width.toFloat() / previewWidth * x).roundToInt() val wy = (world.height.toFloat() / previewHeight * y).roundToInt() - try { // q&d solution for the dangling pointer; i'm doing this only because it's this fucking load screen that's fucking the dead pointer - val outCol = if (BlockCodex[world.getTileFromTerrain(wx, wy)].isSolid) COL_TERR - else if (BlockCodex[world.getTileFromWall(wx, wy)].isSolid) COL_WALLED - else COL_AIR + try { + // q&d solution for the dangling pointer; i'm doing this only because it's this fucking load screen that's fucking the dead pointer + if (!world.layerTerrain.ptrDestroyed) { + val outCol = if (BlockCodex[world.getTileFromTerrain(wx, wy)].isSolid) COL_TERR + else if (BlockCodex[world.getTileFromWall(wx, wy)].isSolid) COL_WALLED + else COL_AIR - previewPixmap.setColor(outCol) - previewPixmap.drawPixel(x, previewHeight - 1 - y) // this flips Y + previewPixmap.setColor(outCol) + previewPixmap.drawPixel(x, previewHeight - 1 - y) // this flips Y + } } catch (e: NoSuchElementException) {} } diff --git a/work_files/UI/modlist.kra b/work_files/UI/modlist.kra new file mode 100644 index 000000000..1ba879f4a --- /dev/null +++ b/work_files/UI/modlist.kra @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1eb7a3f91b33fa082965657a7b073d5fd35f4f8ded6b9456872524d61f682a35 +size 71502