mirror of
https://github.com/Anuken/Mindustry.git
synced 2024-09-22 22:07:31 +03:00
Fixed StackOverFlow exception thrown with certain block designs
This commit is contained in:
parent
dbd84103cb
commit
1c3bad0aca
@ -1,5 +1,5 @@
|
||||
#Autogenerated file. Do not modify.
|
||||
#Sat Feb 17 20:42:58 EST 2018
|
||||
#Sun Feb 18 11:29:39 EST 2018
|
||||
version=beta
|
||||
androidBuildCode=235
|
||||
name=Mindustry
|
||||
|
@ -30,7 +30,7 @@ public class Packets {
|
||||
|
||||
}
|
||||
|
||||
public static class SyncPacket implements Packet{
|
||||
public static class SyncPacket implements Packet, UnimportantPacket{
|
||||
public byte[] data;
|
||||
|
||||
@Override
|
||||
@ -99,7 +99,7 @@ public class Packets {
|
||||
}
|
||||
}
|
||||
|
||||
public static class StateSyncPacket implements Packet{
|
||||
public static class StateSyncPacket implements Packet, UnimportantPacket{
|
||||
public int[] items;
|
||||
public float countdown, time;
|
||||
public int enemies, wave;
|
||||
|
@ -90,6 +90,8 @@ public class Block{
|
||||
public Array<BlockBar> bars = Array.with(new BlockBar(Color.RED, false, tile -> tile.entity.health / (float)tile.block().health));
|
||||
/**whether this block can be replaced in all cases*/
|
||||
public boolean alwaysReplace = false;
|
||||
/**whether this block has instant transfer checking. used for calculations to prevent infinite loops.*/
|
||||
public boolean instantTransfer = false;
|
||||
|
||||
public Block(String name) {
|
||||
this.name = name;
|
||||
|
@ -16,6 +16,7 @@ public class Junction extends Block{
|
||||
super(name);
|
||||
update = true;
|
||||
solid = true;
|
||||
instantTransfer = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,6 +24,7 @@ public class Sorter extends Block{
|
||||
super(name);
|
||||
update = true;
|
||||
solid = true;
|
||||
instantTransfer = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -70,13 +71,17 @@ public class Sorter extends Block{
|
||||
}else{
|
||||
Tile a = dest.getNearby(Mathf.mod(dir - 1, 4));
|
||||
Tile b = dest.getNearby(Mathf.mod(dir + 1, 4));
|
||||
boolean ac = a.block().acceptItem(item, a, dest);
|
||||
boolean bc = b.block().acceptItem(item, b, dest);
|
||||
boolean ac = !(a.block().instantTransfer && source.block().instantTransfer) &&
|
||||
a.block().acceptItem(item, a, dest);
|
||||
boolean bc = !(b.block().instantTransfer && source.block().instantTransfer) &&
|
||||
b.block().acceptItem(item, b, dest);
|
||||
|
||||
if(ac && !bc){
|
||||
to = a;
|
||||
}else if(bc && !ac){
|
||||
to = b;
|
||||
}else if(!bc && !ac){
|
||||
return null;
|
||||
}else{
|
||||
if(dest.getDump() == 0){
|
||||
to = a;
|
||||
|
@ -9,6 +9,8 @@ public class Splitter extends Block{
|
||||
|
||||
public Splitter(String name){
|
||||
super(name);
|
||||
solid = true;
|
||||
instantTransfer = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,6 +19,7 @@ public class TunnelConveyor extends Block{
|
||||
update = true;
|
||||
solid = true;
|
||||
health = 70;
|
||||
instantTransfer = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -54,7 +54,7 @@ public class KryoServer implements ServerProvider {
|
||||
int lastconnection = 0;
|
||||
|
||||
public KryoServer(){
|
||||
server = new Server(4096*2, 2048, connection -> new ByteSerializer()); //TODO tweak
|
||||
server = new Server(4096*2, 2048, connection -> new ByteSerializer());
|
||||
server.setDiscoveryHandler((datagramChannel, fromAddress) -> {
|
||||
ByteBuffer buffer = KryoRegistrator.writeServerData();
|
||||
buffer.position(0);
|
||||
|
Loading…
Reference in New Issue
Block a user