Misc bug/crash fixes
This commit is contained in:
@@ -32,6 +32,7 @@ TextButtonStyle: {
|
|||||||
clear-partial: {down: white, up: button-select, over: flat-down, font: default-font, fontColor: white, disabledFontColor: gray },
|
clear-partial: {down: white, up: button-select, over: flat-down, font: default-font, fontColor: white, disabledFontColor: gray },
|
||||||
clear-partial-2: {down: flat-over, up: none, over: flat-over, font: default-font, fontColor: white, disabledFontColor: gray },
|
clear-partial-2: {down: flat-over, up: none, over: flat-over, font: default-font, fontColor: white, disabledFontColor: gray },
|
||||||
empty: {font: default-font},
|
empty: {font: default-font},
|
||||||
|
clear-toggle: {font: default-font, fontColor: white, checked: flat-down, down: flat-down, up: flat, over: flat-over, disabled: flat, disabledFontColor: gray }
|
||||||
toggle: {font: default-font, fontColor: white, checked: button-down, down: button-down, up: button, over: button-over, disabled: button, disabledFontColor: gray }
|
toggle: {font: default-font, fontColor: white, checked: button-down, down: button-down, up: button, over: button-over, disabled: button, disabledFontColor: gray }
|
||||||
},
|
},
|
||||||
ImageButtonStyle: {
|
ImageButtonStyle: {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import java.io.IOException;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class WaveSpawner{
|
public class WaveSpawner{
|
||||||
private static final int quadsize = 4;
|
private static final int quadsize = 6;
|
||||||
|
|
||||||
private GridBits quadrants;
|
private GridBits quadrants;
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ public class WaveSpawner{
|
|||||||
for(int y = quady * quadsize; y < world.height() && y < (quady + 1) * quadsize; y++){
|
for(int y = quady * quadsize; y < world.height() && y < (quady + 1) * quadsize; y++){
|
||||||
Tile tile = world.tile(x, y);
|
Tile tile = world.tile(x, y);
|
||||||
|
|
||||||
if(tile == null || tile.solid() || world.pathfinder.getValueforTeam(Team.red, x, y) == Float.MAX_VALUE){
|
if(tile == null || tile.solid() || world.pathfinder.getValueforTeam(Team.red, x, y) == Float.MAX_VALUE || tile.floor().isLiquid){
|
||||||
setQuad(quadx, quady, false);
|
setQuad(quadx, quady, false);
|
||||||
break outer;
|
break outer;
|
||||||
}
|
}
|
||||||
@@ -217,8 +217,8 @@ public class WaveSpawner{
|
|||||||
|
|
||||||
//TODO instead of randomly scattering locations around the map, find spawns close to each other
|
//TODO instead of randomly scattering locations around the map, find spawns close to each other
|
||||||
private void findLocation(GroundSpawn spawn){
|
private void findLocation(GroundSpawn spawn){
|
||||||
spawn.x = -1;
|
spawn.x = Mathf.random(quadWidth()-1);
|
||||||
spawn.y = -1;
|
spawn.y = Mathf.random(quadHeight()-1);
|
||||||
|
|
||||||
int shellWidth = quadWidth() * 2 + quadHeight() * 2 * 6;
|
int shellWidth = quadWidth() * 2 + quadHeight() * 2 * 6;
|
||||||
shellWidth = Math.min(quadWidth() * quadHeight() / 4, shellWidth);
|
shellWidth = Math.min(quadWidth() * quadHeight() / 4, shellWidth);
|
||||||
|
|||||||
@@ -567,16 +567,16 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
button.getImage().remove();
|
button.getImage().remove();
|
||||||
button.update(() -> button.setChecked(editor.getDrawBlock() == block));
|
button.update(() -> button.setChecked(editor.getDrawBlock() == block));
|
||||||
group.add(button);
|
group.add(button);
|
||||||
content.add(button).size(60f);
|
content.add(button).size(50f);
|
||||||
|
|
||||||
if(i++ % 3 == 2){
|
if(++i % 4 == 0){
|
||||||
content.row();
|
content.row();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
group.getButtons().get(2).setChecked(true);
|
group.getButtons().get(2).setChecked(true);
|
||||||
|
|
||||||
table.table("underline", extra -> extra.labelWrap(() -> editor.getDrawBlock().formalName).width(220f).center()).growX();
|
table.table("underline", extra -> extra.labelWrap(() -> editor.getDrawBlock().formalName).width(200f).center()).growX();
|
||||||
table.row();
|
table.row();
|
||||||
table.add(pane).growY().fillX();
|
table.add(pane).growY().fillX();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public abstract class InputHandler extends InputAdapter{
|
|||||||
ItemTransfer.create(item,
|
ItemTransfer.create(item,
|
||||||
player.x + Angles.trnsx(player.rotation + 180f, backTrns), player.y + Angles.trnsy(player.rotation + 180f, backTrns),
|
player.x + Angles.trnsx(player.rotation + 180f, backTrns), player.y + Angles.trnsy(player.rotation + 180f, backTrns),
|
||||||
new Translator(tile.drawx() + stackTrns.x, tile.drawy() + stackTrns.y), () -> {
|
new Translator(tile.drawx() + stackTrns.x, tile.drawy() + stackTrns.y), () -> {
|
||||||
if(tile.block() != block || tile.entity == null) return;
|
if(tile.block() != block || tile.entity == null || tile.entity.items == null) return;
|
||||||
|
|
||||||
tile.block().handleStack(item, removed, tile, player);
|
tile.block().handleStack(item, removed, tile, player);
|
||||||
remaining[1] -= removed;
|
remaining[1] -= removed;
|
||||||
|
|||||||
@@ -53,6 +53,10 @@ public class TypeIO{
|
|||||||
|
|
||||||
@WriteClass(Unit.class)
|
@WriteClass(Unit.class)
|
||||||
public static void writeUnit(ByteBuffer buffer, Unit unit){
|
public static void writeUnit(ByteBuffer buffer, Unit unit){
|
||||||
|
if(unit.getGroup() == null){
|
||||||
|
buffer.put((byte)-1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
buffer.put((byte) unit.getGroup().getID());
|
buffer.put((byte) unit.getGroup().getID());
|
||||||
buffer.putInt(unit.getID());
|
buffer.putInt(unit.getID());
|
||||||
}
|
}
|
||||||
@@ -60,6 +64,7 @@ public class TypeIO{
|
|||||||
@ReadClass(Unit.class)
|
@ReadClass(Unit.class)
|
||||||
public static Unit readUnit(ByteBuffer buffer){
|
public static Unit readUnit(ByteBuffer buffer){
|
||||||
byte gid = buffer.get();
|
byte gid = buffer.get();
|
||||||
|
if(gid == -1) return null;
|
||||||
int id = buffer.getInt();
|
int id = buffer.getInt();
|
||||||
return (Unit) Entities.getGroup(gid).getByID(id);
|
return (Unit) Entities.getGroup(gid).getByID(id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,10 +38,6 @@ public class FileChooser extends FloatingDialog{
|
|||||||
private Consumer<FileHandle> selectListener;
|
private Consumer<FileHandle> selectListener;
|
||||||
private boolean open;
|
private boolean open;
|
||||||
|
|
||||||
public FileChooser(String title, boolean open, Consumer<FileHandle> result){
|
|
||||||
this(title, defaultFilter, open, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileChooser(String title, Predicate<FileHandle> filter, boolean open, Consumer<FileHandle> result){
|
public FileChooser(String title, Predicate<FileHandle> filter, boolean open, Consumer<FileHandle> result){
|
||||||
super(title);
|
super(title);
|
||||||
this.open = open;
|
this.open = open;
|
||||||
@@ -127,7 +123,7 @@ public class FileChooser extends FloatingDialog{
|
|||||||
updateFiles(true);
|
updateFiles(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
icontable.defaults().height(50).growX().uniform();
|
icontable.defaults().height(50).growX().padTop(5).uniform();
|
||||||
icontable.add(home);
|
icontable.add(home);
|
||||||
icontable.add(back);
|
icontable.add(back);
|
||||||
icontable.add(forward);
|
icontable.add(forward);
|
||||||
@@ -202,7 +198,7 @@ public class FileChooser extends FloatingDialog{
|
|||||||
//macs are confined to the Downloads/ directory
|
//macs are confined to the Downloads/ directory
|
||||||
if(!OS.isMac){
|
if(!OS.isMac){
|
||||||
Image upimage = new Image("icon-folder-parent");
|
Image upimage = new Image("icon-folder-parent");
|
||||||
TextButton upbutton = new TextButton(".." + directory.toString());
|
TextButton upbutton = new TextButton(".." + directory.toString(), "clear");
|
||||||
upbutton.clicked(() -> {
|
upbutton.clicked(() -> {
|
||||||
directory = directory.parent();
|
directory = directory.parent();
|
||||||
updateFiles(true);
|
updateFiles(true);
|
||||||
@@ -224,7 +220,7 @@ public class FileChooser extends FloatingDialog{
|
|||||||
|
|
||||||
String filename = file.name();
|
String filename = file.name();
|
||||||
|
|
||||||
TextButton button = new TextButton(shorten(filename), "toggle");
|
TextButton button = new TextButton(shorten(filename), "clear");
|
||||||
group.add(button);
|
group.add(button);
|
||||||
|
|
||||||
button.clicked(() -> {
|
button.clicked(() -> {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import io.anuke.annotations.Annotations.Loc;
|
|||||||
import io.anuke.annotations.Annotations.Remote;
|
import io.anuke.annotations.Annotations.Remote;
|
||||||
import io.anuke.mindustry.entities.Player;
|
import io.anuke.mindustry.entities.Player;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
|
import io.anuke.mindustry.gen.Call;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
@@ -12,7 +13,6 @@ import io.anuke.mindustry.world.meta.BlockGroup;
|
|||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
import io.anuke.mindustry.gen.Call;
|
|
||||||
|
|
||||||
import java.io.DataInput;
|
import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
|
|||||||
Reference in New Issue
Block a user