mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-04-02 04:10:43 -07:00
Synchronization
This commit is contained in:
parent
acb8496352
commit
ebbf01c6e5
1 changed files with 6 additions and 6 deletions
|
|
@ -28,7 +28,7 @@ public class PowerGraph{
|
|||
return graphID;
|
||||
}
|
||||
|
||||
public void update(){
|
||||
public synchronized void update(){
|
||||
if(threads.getFrameID() == lastFrameUpdated || consumers.size == 0 || producers.size == 0){
|
||||
return;
|
||||
}
|
||||
|
|
@ -70,13 +70,13 @@ public class PowerGraph{
|
|||
}
|
||||
}
|
||||
|
||||
public void add(PowerGraph graph){
|
||||
public synchronized void add(PowerGraph graph){
|
||||
for(Tile tile : graph.all){
|
||||
add(tile);
|
||||
}
|
||||
}
|
||||
|
||||
public void add(Tile tile){
|
||||
public synchronized void add(Tile tile){
|
||||
tile.entity.power.graph = this;
|
||||
all.add(tile);
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ public class PowerGraph{
|
|||
}
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
public synchronized void clear(){
|
||||
for(Tile other : all){
|
||||
other.entity.power.graph = null;
|
||||
}
|
||||
|
|
@ -98,7 +98,7 @@ public class PowerGraph{
|
|||
consumers.clear();
|
||||
}
|
||||
|
||||
public void reflow(Tile tile){
|
||||
public synchronized void reflow(Tile tile){
|
||||
queue.clear();
|
||||
queue.addLast(tile);
|
||||
while(queue.size > 0){
|
||||
|
|
@ -113,7 +113,7 @@ public class PowerGraph{
|
|||
}
|
||||
}
|
||||
|
||||
public void remove(Tile tile){
|
||||
public synchronized void remove(Tile tile){
|
||||
clear();
|
||||
|
||||
for(Tile other : tile.block().getPowerConnections(tile, outArray1)){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue