v3.0.1: improved sync checks in game log

This commit is contained in:
Evan Debenham
2025-03-06 11:40:31 -05:00
parent c04920630a
commit 8f0a13ca22

View File

@@ -54,6 +54,7 @@ public class GameLog extends Component implements Signal.Listener<String> {
@Override
public synchronized void update() {
synchronized (textsToAdd){
if (!textsToAdd.isEmpty()){
int maxLines = SPDSettings.interfaceSize() > 0 ? 5 : 3;
for (String text : textsToAdd){
@@ -128,6 +129,7 @@ public class GameLog extends Component implements Signal.Listener<String> {
layout();
textsToAdd.clear();
}
}
super.update();
}
@@ -144,8 +146,10 @@ public class GameLog extends Component implements Signal.Listener<String> {
}
@Override
public synchronized boolean onSignal( String text ) {
public boolean onSignal( String text ) {
synchronized (textsToAdd) {
textsToAdd.add(text);
}
return false;
}
@@ -171,7 +175,9 @@ public class GameLog extends Component implements Signal.Listener<String> {
}
public static void wipe() {
synchronized (textsToAdd) {
entries.clear();
textsToAdd.clear();
}
}
}