mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
the placeholder "nullworld" is now singleton
This commit is contained in:
@@ -25,6 +25,7 @@ import net.torvald.terrarum.controller.GdxControllerAdapter;
|
||||
import net.torvald.terrarum.controller.TerrarumController;
|
||||
import net.torvald.terrarum.controller.XinputControllerAdapter;
|
||||
import net.torvald.terrarum.gamecontroller.KeyToggler;
|
||||
import net.torvald.terrarum.gameworld.GameWorld;
|
||||
import net.torvald.terrarum.imagefont.TinyAlphNum;
|
||||
import net.torvald.terrarum.modulebasegame.Ingame;
|
||||
import net.torvald.terrarum.utils.JsonFetcher;
|
||||
@@ -546,6 +547,8 @@ public class AppLoader implements ApplicationListener {
|
||||
|
||||
ModMgr.INSTANCE.disposeMods();
|
||||
|
||||
GameWorld.Companion.makeNullWorld().dispose();
|
||||
|
||||
deleteTempfiles();
|
||||
}
|
||||
|
||||
|
||||
@@ -475,7 +475,14 @@ open class GameWorld : Disposable {
|
||||
//@Transient val SIZEOF: Byte = 2
|
||||
@Transient const val LAYERS: Byte = 4 // terrain, wall (layerTerrainLowBits + layerWallLowBits), wire
|
||||
|
||||
fun makeNullWorld() = GameWorld(1, 1, 1, 0, 0, 0)
|
||||
@Transient private var nullWorldInstance: GameWorld? = null
|
||||
|
||||
fun makeNullWorld(): GameWorld {
|
||||
if (nullWorldInstance == null)
|
||||
nullWorldInstance = GameWorld(1, 1, 1, 0, 0, 0)
|
||||
|
||||
return nullWorldInstance!!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user