Fixed some more synchronization bugs

This commit is contained in:
Anuken
2018-02-19 14:57:43 -05:00
parent ffabdba119
commit 5cc092f58c
4 changed files with 10 additions and 8 deletions

View File

@@ -98,12 +98,14 @@ public abstract class InputHandler extends InputAdapter{
Vector2 offset = type.getPlaceOffset();
rect.setCenter(offset.x + x * tilesize, offset.y + y * tilesize);
for(SolidEntity e : Entities.getNearby(enemyGroup, x * tilesize, y * tilesize, tilesize * 2f)){
if(e == null) continue; //not sure why this happens?
Rectangle rect = e.hitbox.getRect(e.x, e.y);
synchronized (Entities.entityLock) {
for (SolidEntity e : Entities.getNearby(enemyGroup, x * tilesize, y * tilesize, tilesize * 2f)) {
if (e == null) continue; //not sure why this happens?
Rectangle rect = e.hitbox.getRect(e.x, e.y);
if(this.rect.overlaps(rect)){
return false;
if (this.rect.overlaps(rect)) {
return false;
}
}
}

View File

@@ -208,7 +208,7 @@ public class Tile{
/**Returns the list of all tiles linked to this multiblock, or an empty array if it's not a multiblock.
* This array contains all linked tiles, including this tile itself.*/
public Array<Tile> getLinkedTiles(){
public synchronized Array<Tile> getLinkedTiles(){
Block block = block();
tmpArray.clear();
if(!(block.width == 1 && block.height == 1)){