diff --git a/core/src/mindustry/world/blocks/power/PowerGraph.java b/core/src/mindustry/world/blocks/power/PowerGraph.java index 6c179b4dc0..bc3b6e2fd8 100644 --- a/core/src/mindustry/world/blocks/power/PowerGraph.java +++ b/core/src/mindustry/world/blocks/power/PowerGraph.java @@ -292,6 +292,16 @@ public class PowerGraph{ } } + /** Used for unit tests only. */ + public void removeList(Building build){ + all.remove(build); + producers.remove(build); + consumers.remove(build); + batteries.remove(build); + } + + /** Note that this does not actually remove the building from the graph; + * it creates *new* graphs that contain the correct buildings. */ public void remove(Building tile){ //go through all the connections of this tile diff --git a/tests/src/test/java/power/PowerTests.java b/tests/src/test/java/power/PowerTests.java index af90f1d762..39e4b9b588 100644 --- a/tests/src/test/java/power/PowerTests.java +++ b/tests/src/test/java/power/PowerTests.java @@ -130,7 +130,7 @@ public class PowerTests extends PowerTestFixture{ assertEquals(1.0f, consumerTile.build.power.status, Mathf.FLOAT_ROUNDING_ERROR); - powerGraph.remove(producerTile.build); + powerGraph.removeList(producerTile.build); powerGraph.add(consumerTile.build); powerGraph.update();