mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-17 14:04:05 +09:00
Former-commit-id: b72d0b018c084e80cf4fef77e1b1a81101d6daea Former-commit-id: 32da6a2998826de6519a901dcff7bf058f689b2f
27 lines
808 B
Kotlin
27 lines
808 B
Kotlin
package net.torvald.terrarum.realestate
|
|
|
|
import java.io.Serializable
|
|
import java.util.*
|
|
|
|
/**
|
|
* Created by minjaesong on 16-03-27.
|
|
*/
|
|
object RealEstateCodex {
|
|
/**
|
|
* HashMap<Absolute tile number, Actor/Faction ID>
|
|
*
|
|
* Note that a tile can have only ONE owner (as an Actor or Faction ID)
|
|
*/
|
|
private var ownershipRegistry: HashMap<Long, Int> = HashMap()
|
|
|
|
fun setOwner(tileX: Int, tileY: Int, refID: Int) {
|
|
ownershipRegistry[RealEstateUtility.getAbsoluteTileNumber(tileX, tileY)] = refID
|
|
}
|
|
|
|
fun removeOwner(tileX: Int, tileY: Int) {
|
|
ownershipRegistry.remove(RealEstateUtility.getAbsoluteTileNumber(tileX, tileY))
|
|
}
|
|
|
|
fun getOwner(tileX: Int, tileY: Int): Int? =
|
|
ownershipRegistry[RealEstateUtility.getAbsoluteTileNumber(tileX, tileY)]
|
|
} |