mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 19:44:05 +09:00
new map data format and its read/writer
!! UNTESTED !! UNTESTED !! UNTESTED !!
This commit is contained in:
@@ -3,7 +3,10 @@ package net.torvald.terrarum.gameworld
|
||||
/**
|
||||
* Created by minjaesong on 2016-02-15.
|
||||
*/
|
||||
open class PairedMapLayer(width: Int, val height: Int) : Iterable<Byte> {
|
||||
open class PairedMapLayer : Iterable<Byte> {
|
||||
|
||||
val width: Int; val height: Int
|
||||
|
||||
|
||||
/**
|
||||
* 0b_xxxx_yyyy, x for lower index, y for higher index
|
||||
@@ -15,14 +18,19 @@ open class PairedMapLayer(width: Int, val height: Int) : Iterable<Byte> {
|
||||
*/
|
||||
internal @Volatile var data: ByteArray
|
||||
|
||||
val width: Int
|
||||
|
||||
init {
|
||||
constructor(width: Int, height: Int) {
|
||||
this.width = width / 2
|
||||
|
||||
this.height = height
|
||||
data = ByteArray(width * height / 2)
|
||||
}
|
||||
|
||||
constructor(width: Int, height: Int, data: ByteArray) {
|
||||
this.data = data
|
||||
this.width = width / 2
|
||||
this.height = height
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an iterator over elements of type `T`.
|
||||
* Note: this iterator will return combined damage, that is 0bxxxx_yyyy as whole.
|
||||
|
||||
Reference in New Issue
Block a user