moved Codices out of the singleton so they can be serialised

This commit is contained in:
minjaesong
2021-09-04 17:55:37 +09:00
parent 57e4b83649
commit 6bea9c9f07
42 changed files with 180 additions and 98 deletions

View File

@@ -5,6 +5,7 @@ import net.torvald.terrarum.gameactors.faction.FactionCodex
import net.torvald.terrarum.gameworld.BlockAddress
import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.terrarum.gameworld.fmod
import net.torvald.terrarum.*
/**
* Created by minjaesong on 2016-03-27.

View File

@@ -6,13 +6,17 @@ import java.util.*
/**
* Created by minjaesong on 2016-03-27.
*/
object RealEstateCodex {
class RealEstateCodex {
/**
* HashMap<Absolute block number, Actor/Faction ID>
*
* Note that a block can have only ONE owner (as an Actor or Faction ID)
*/
private var ownershipRegistry: HashMap<Long, Int> = HashMap()
private val ownershipRegistry: HashMap<Long, Int> = HashMap()
fun clear() = ownershipRegistry.clear()
internal constructor()
fun setOwner(world: GameWorld, tileX: Int, tileY: Int, refID: Int) {
ownershipRegistry[LandUtil.getBlockAddr(world, tileX, tileY)] = refID