mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-20 23:44:04 +09:00
Tile -> Block && Map -> World
This commit is contained in:
@@ -2,16 +2,16 @@ package net.torvald.terrarum.realestate
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameactors.faction.FactionCodex
|
||||
import net.torvald.terrarum.gameworld.TileAddress
|
||||
import net.torvald.terrarum.gameworld.BlockAddress
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-27.
|
||||
*/
|
||||
object LandUtil {
|
||||
fun getTileAddr(x: Int, y: Int): TileAddress =
|
||||
fun getBlockAddr(x: Int, y: Int): BlockAddress =
|
||||
(Terrarum.ingame!!.world.width * y).toLong() + x
|
||||
|
||||
fun resolveAbsoluteTileNumber(t: TileAddress): Pair<Int, Int> =
|
||||
fun resolveAbsoluteBlockNumber(t: BlockAddress): Pair<Int, Int> =
|
||||
Pair((t % Terrarum.ingame!!.world.width).toInt(), (t / Terrarum.ingame!!.world.width).toInt())
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user