This commit is contained in:
Anuken
2021-01-29 09:32:29 -05:00
parent 7cdf7a21fe
commit d512aa5b21
2 changed files with 11 additions and 1 deletions

View File

@@ -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){ public void remove(Building tile){
//go through all the connections of this tile //go through all the connections of this tile

View File

@@ -130,7 +130,7 @@ public class PowerTests extends PowerTestFixture{
assertEquals(1.0f, consumerTile.build.power.status, Mathf.FLOAT_ROUNDING_ERROR); assertEquals(1.0f, consumerTile.build.power.status, Mathf.FLOAT_ROUNDING_ERROR);
powerGraph.remove(producerTile.build); powerGraph.removeList(producerTile.build);
powerGraph.add(consumerTile.build); powerGraph.add(consumerTile.build);
powerGraph.update(); powerGraph.update();