the placeholder "nullworld" is now singleton

This commit is contained in:
minjaesong
2019-06-11 23:52:17 +09:00
parent c41e60d29f
commit 306f45e7ee
2 changed files with 11 additions and 1 deletions

View File

@@ -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!!
}
}
}