Ingame's Player is now mandatory; player spawn on right position

This commit is contained in:
minjaesong
2017-07-18 00:19:55 +09:00
parent 2f75e276b2
commit 3727a9d27f
17 changed files with 224 additions and 71 deletions

View File

@@ -10,6 +10,10 @@ import net.torvald.dataclass.Float16Bits
*/
class MapLayerFloat(val width: Int, val height: Int) : Iterable<Float16Bits> {
constructor(width: Int, height: Int, init: Float) : this(width, height) {
data = Array(height) { Array(width, { Float16.fromFloat(init) }) }
}
internal @Volatile var data: Array<Array<Float16Bits>> // in parallel programming: do not trust your register; always read freshly from RAM!
init {
@@ -45,7 +49,7 @@ class MapLayerFloat(val width: Int, val height: Int) : Iterable<Float16Bits> {
return if (x !in 0..width - 1 || y !in 0..height - 1)
null
else
data[y][x].toFloat()
Float16.toFloat(data[y][x])
}
internal fun setValue(x: Int, y: Int, value: Float) {