fixed a bug where wire graphs would not laid down correctly

This commit is contained in:
minjaesong
2021-08-07 16:23:42 +09:00
parent 4112dc333f
commit e4542af75c
7 changed files with 73 additions and 3 deletions

View File

@@ -79,6 +79,7 @@ open class GameWorld : Disposable {
private val wiringGraph = HashMap<BlockAddress, HashMap<ItemID, WiringSimCell>>()
private val WIRE_POS_MAP = byteArrayOf(1,2,4,8)
private val WIRE_ANTIPOS_MAP = byteArrayOf(4,8,1,2)
/**
* Used by the renderer. When wirings are updated, `wirings` and this properties must be synchronised.
@@ -341,7 +342,7 @@ open class GameWorld : Disposable {
if (matchingNeighbours and WIRE_POS_MAP[i] > 0) {
val (tx, ty) = WireActor.WIRE_NEARBY[i]
val old = getWireGraphOf(x + tx, y + ty, tile) ?: 0
setWireGraphOf(x + tx, y + ty, tile, old or WIRE_POS_MAP[i])
setWireGraphOf(x + tx, y + ty, tile, old or WIRE_ANTIPOS_MAP[i])
}
}
}