More code cleanup

This commit is contained in:
Anuken
2019-03-24 21:10:59 -04:00
parent 97f5bf3cc4
commit 71c2c7ad05
25 changed files with 28 additions and 12 deletions

View File

@@ -457,9 +457,7 @@ public class World implements ApplicationListener{
}
for(int x = 0; x < tiles.length; x++){
for(int y = 0; y < tiles[0].length; y++){
dark[x][y] = writeBuffer[x][y];
}
System.arraycopy(writeBuffer[x], 0, dark[x], 0, tiles[0].length);
}
}

View File

@@ -1,7 +1,6 @@
package io.anuke.mindustry.editor.generation;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.editor.generation.FilterOption.BlockOption;
import io.anuke.mindustry.editor.generation.FilterOption.SliderOption;
import io.anuke.mindustry.world.Block;

View File

@@ -305,9 +305,10 @@ public class Puddle extends SolidEntity implements SaveTrait, Poolable, DrawTrai
y = data.readFloat();
liquid = content.liquid(data.readByte());
targetAmount = data.readShort() / 4f;
tile = world.tile(data.readInt());
int pos = data.readInt();
tile = world.tile(pos);
map.put(tile.pos(), this);
map.put(pos, this);
}
@Override

View File

@@ -237,9 +237,8 @@ public class TreeLayout{
}
executeShifts(v);
float midpoint = (v.children[0].prelim + v.children[v.children.length-1].prelim) / 2f;
TreeNode w = leftSibling;
if(w != null){
v.prelim = w.prelim + getDistance(v, w);
if(leftSibling != null){
v.prelim = leftSibling.prelim + getDistance(v, leftSibling);
v.mode = v.prelim - midpoint;
}else{
v.prelim = midpoint;

View File

@@ -186,7 +186,8 @@ public class Build{
Tile tile = world.tile(x + point.x, y + point.y);
if(tile != null && !tile.floor().isDeep()) return true;
}
return world.tile(x, y) != null && !world.tile(x, y).floor().isDeep();
Tile tile = world.tile(x, y);
return tile != null && !tile.floor().isDeep();
}
return false;
}

View File

@@ -231,7 +231,7 @@ public class Conveyor extends Block{
pos.y = Mathf.clamp(pos.y, 0, nextMax);
if(pos.y >= 0.9999f && offloadDir(tile, pos.item)){
if(next.block() instanceof Conveyor){
if(next != null && next.block() instanceof Conveyor){
ConveyorEntity othere = next.entity();
ItemPos ni = pos2.set(othere.convey.get(othere.lastInserted), ItemPos.updateShorts);