Fixed #4463
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user