some variable renaming

This commit is contained in:
minjaesong
2021-08-10 18:41:43 +09:00
parent c8b5578a91
commit bfdfa17e3e
2 changed files with 5 additions and 6 deletions

View File

@@ -354,7 +354,7 @@ open class GameWorld : Disposable {
} }
fun getWireGraphUnsafe(blockAddr: BlockAddress, itemID: ItemID): Byte? { fun getWireGraphUnsafe(blockAddr: BlockAddress, itemID: ItemID): Byte? {
return wiringGraph[blockAddr]?.get(itemID)?.con return wiringGraph[blockAddr]?.get(itemID)?.connections
} }
fun getWireEmitStateOf(x: Int, y: Int, itemID: ItemID): Vector2? { fun getWireEmitStateOf(x: Int, y: Int, itemID: ItemID): Vector2? {
@@ -389,7 +389,7 @@ open class GameWorld : Disposable {
if (wiringGraph[blockAddr]!![itemID] == null) if (wiringGraph[blockAddr]!![itemID] == null)
wiringGraph[blockAddr]!![itemID] = WiringSimCell(byte) wiringGraph[blockAddr]!![itemID] = WiringSimCell(byte)
wiringGraph[blockAddr]!![itemID]!!.con = byte wiringGraph[blockAddr]!![itemID]!!.connections = byte
} }
fun setWireEmitStateOf(x: Int, y: Int, itemID: ItemID, vector: Vector2) { fun setWireEmitStateOf(x: Int, y: Int, itemID: ItemID, vector: Vector2) {
@@ -647,7 +647,7 @@ open class GameWorld : Disposable {
* These values must be updated by none other than [WorldSimulator]() * These values must be updated by none other than [WorldSimulator]()
*/ */
data class WiringSimCell( data class WiringSimCell(
var con: Byte = 0, // connections var connections: Byte = 0, // connections
var emitState: Vector2 = Vector2(0.0, 0.0), // i'm emitting this much power var emitState: Vector2 = Vector2(0.0, 0.0), // i'm emitting this much power
var recvStates: ArrayList<WireRecvState> = ArrayList() // how far away are the power sources var recvStates: ArrayList<WireRecvState> = ArrayList() // how far away are the power sources
) )

View File

@@ -10,7 +10,6 @@ import net.torvald.terrarum.blockproperties.WireCodex
import net.torvald.terrarum.gameactors.ActorWithBody import net.torvald.terrarum.gameactors.ActorWithBody
import net.torvald.terrarum.gamecontroller.KeyToggler import net.torvald.terrarum.gamecontroller.KeyToggler
import net.torvald.terrarum.gameitem.ItemID import net.torvald.terrarum.gameitem.ItemID
import net.torvald.terrarum.itemproperties.ItemCodex
import net.torvald.terrarum.modulebasegame.TerrarumIngame.Companion.inUpdateRange import net.torvald.terrarum.modulebasegame.TerrarumIngame.Companion.inUpdateRange
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
import net.torvald.terrarum.modulebasegame.gameactors.BlockBoxIndex import net.torvald.terrarum.modulebasegame.gameactors.BlockBoxIndex
@@ -487,8 +486,8 @@ object WorldSimulator {
// get all wires that matches 'accepts' (such as Red/Green/Blue wire) and propagate signal for each of them // get all wires that matches 'accepts' (such as Red/Green/Blue wire) and propagate signal for each of them
world.getAllWiresFrom(point.x, point.y)?.filter { WireCodex[it].accepts == wireType }?.forEach { wire -> world.getAllWiresFrom(point.x, point.y)?.filter { WireCodex[it].accepts == wireType }?.forEach { wire ->
world.getAllWiringGraph(point.x, point.y)?.get(wire)?.let { node -> world.getAllWiringGraph(point.x, point.y)?.get(wire)?.let { node ->
val connexion = node.con.toInt() val cnx = node.connections.toInt()
when (wireConToStatus[connexion]) { when (wireConToStatus[cnx]) {
WireConStatus.THRU -> { WireConStatus.THRU -> {
// TODO // TODO
} }