mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-19 06:54:05 +09:00
asynch update and render (aka frameskip)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.realestate
|
||||
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameactors.faction.FactionCodex
|
||||
import net.torvald.terrarum.gameworld.BlockAddress
|
||||
|
||||
@@ -9,17 +9,17 @@ import net.torvald.terrarum.gameworld.BlockAddress
|
||||
*/
|
||||
object LandUtil {
|
||||
fun getBlockAddr(x: Int, y: Int): BlockAddress =
|
||||
(TerrarumGDX.ingame!!.world.width * y).toLong() + x
|
||||
(Terrarum.ingame!!.world.width * y).toLong() + x
|
||||
|
||||
fun resolveBlockAddr(t: BlockAddress): Pair<Int, Int> =
|
||||
Pair((t % TerrarumGDX.ingame!!.world.width).toInt(), (t / TerrarumGDX.ingame!!.world.width).toInt())
|
||||
Pair((t % Terrarum.ingame!!.world.width).toInt(), (t / Terrarum.ingame!!.world.width).toInt())
|
||||
|
||||
/**
|
||||
* Get owner ID as an Actor/Faction
|
||||
*/
|
||||
fun resolveOwner(id: Int): Any =
|
||||
if (id >= 0)
|
||||
TerrarumGDX.ingame!!.getActorByID(id)
|
||||
Terrarum.ingame!!.getActorByID(id)
|
||||
else
|
||||
FactionCodex.getFactionByID(id)
|
||||
}
|
||||
Reference in New Issue
Block a user