fix init of global vars, make MapTile DTO more concise, and version bump

This commit is contained in:
Adam 2022-02-21 15:36:12 +01:00
parent 8dff124a71
commit 494913d3b9
22 changed files with 137 additions and 126 deletions

View file

@ -4,6 +4,7 @@ import dev.adamko.kafkatorio.events.schema.ColourHex
import dev.adamko.kafkatorio.events.schema.FactorioEvent
import dev.adamko.kafkatorio.events.schema.MapChunk
import dev.adamko.kafkatorio.events.schema.MapChunkPosition
import dev.adamko.kafkatorio.events.schema.MapTile
import dev.adamko.kafkatorio.events.schema.MapTilePosition
import dev.adamko.kafkatorio.events.schema.MapTiles
import dev.adamko.kafkatorio.events.schema.SurfaceIndex
@ -141,3 +142,6 @@ fun groupTilesIntoChunksWithColours(
return colourisedChunkTable
}
val MapTile.position
get() = MapTilePosition(x, y)

View file

@ -17,19 +17,12 @@ import org.apache.kafka.streams.kstream.KStream
import org.apache.kafka.streams.kstream.KTable
@Serializable
@JvmInline
value class PrototypeName(val name: String) {
override fun toString() = name
}
/** Use the hashcode of Prototypes names as keys - more efficient storage */
@JvmInline
@Serializable
value class TileProtoHashCode private constructor(val code: Int) {
constructor(prototype: MapTilePrototype) : this(prototype.name.hashCode())
constructor(tile: MapTile) : this(tile.prototypeName.hashCode())
constructor(tile: MapTile) : this(tile.proto.hashCode())
}