Compare commits

...

2 Commits

Author SHA1 Message Date
e52988e511 disable castling buttons
Some checks failed
Linux arm64 / Build (push) Failing after 22s
2025-05-17 17:22:55 +02:00
6bc164937b prevent concurrent modification 2025-05-17 17:22:23 +02:00
2 changed files with 8 additions and 3 deletions

View File

@@ -203,13 +203,18 @@ public class DDDView extends GameAdapter implements CommandSender {
}
private void onFooterRender() {
CastlingResult allowedCastlings = getAllowedCastlings();
ImGui.beginDisabled(allowedCastlings == CastlingResult.None || allowedCastlings == CastlingResult.Big);
if (ImGui.button("Roque")) {
sendCastling();
}
ImGui.endDisabled();
ImGui.sameLine();
ImGui.beginDisabled(allowedCastlings == CastlingResult.None || allowedCastlings == CastlingResult.Small);
if (ImGui.button("Grand Roque")) {
sendBigCastling();
}
ImGui.endDisabled();
ImGui.sameLine();
if (ImGui.button("Annuler le coup précédent")) {
sendUndo();

View File

@@ -72,11 +72,11 @@ public class Window implements Closeable {
this.regularTasks = new ArrayList<>();
}
public void addRegularTask(Consumer<Float> task) {
public synchronized void addRegularTask(Consumer<Float> task) {
this.regularTasks.add(task);
}
public void removeRegularTask(Consumer<Float> task) {this.regularTasks.remove(task);}
public synchronized void removeRegularTask(Consumer<Float> task) {this.regularTasks.remove(task);}
public synchronized void scheduleTask(Runnable runnable) {
this.tasks.add(runnable);
@@ -195,7 +195,7 @@ public class Window implements Closeable {
}
}
private void executeTasks(float delta) {
private synchronized void executeTasks(float delta) {
Runnable task = getNextTask();
while (task != null) {
task.run();