v0.4.2b: fixed some concurrent modification exceptions

This commit is contained in:
Evan Debenham 2016-09-15 04:39:10 -04:00
parent 433a89b07e
commit 1aed7a7501
2 changed files with 8 additions and 8 deletions

View File

@ -320,7 +320,7 @@ public abstract class Char extends Actor {
}
@SuppressWarnings("unchecked")
public <T extends Buff> HashSet<T> buffs( Class<T> c ) {
public synchronized <T extends Buff> HashSet<T> buffs( Class<T> c ) {
HashSet<T> filtered = new HashSet<>();
for (Buff b : buffs) {
if (c.isInstance( b )) {
@ -331,7 +331,7 @@ public abstract class Char extends Actor {
}
@SuppressWarnings("unchecked")
public <T extends Buff> T buff( Class<T> c ) {
public synchronized <T extends Buff> T buff( Class<T> c ) {
for (Buff b : buffs) {
if (c.isInstance( b )) {
return (T)b;

View File

@ -94,7 +94,7 @@ public class RenderedTextMultiline extends Component {
return maxWidth;
}
private void build(){
private synchronized void build(){
clear();
words = new ArrayList<>();
boolean highlighting = false;
@ -133,21 +133,21 @@ public class RenderedTextMultiline extends Component {
layout();
}
public void zoom(float zoom){
public synchronized void zoom(float zoom){
this.zoom = zoom;
for (RenderedText word : words) {
if (word != null) word.scale.set(zoom);
}
}
public void hardlight(int color){
public synchronized void hardlight(int color){
this.color = color;
for (RenderedText word : words) {
if (word != null) word.hardlight( color );
}
}
public void invert(){
public synchronized void invert(){
if (words != null) {
for (RenderedText word : words) {
if (word != null) {
@ -163,7 +163,7 @@ public class RenderedTextMultiline extends Component {
}
@Override
protected void layout() {
protected synchronized void layout() {
super.layout();
float x = this.x;
float y = this.y;