Seq.
This commit is contained in:
@@ -40,8 +40,8 @@ import static mindustry.Vars.*;
|
||||
|
||||
/** Handles schematics.*/
|
||||
public class Schematics implements Loadable{
|
||||
private static final Schematic tmpSchem = new Schematic(new Array<>(), new StringMap(), 0, 0);
|
||||
private static final Schematic tmpSchem2 = new Schematic(new Array<>(), new StringMap(), 0, 0);
|
||||
private static final Schematic tmpSchem = new Schematic(new Seq<>(), new StringMap(), 0, 0);
|
||||
private static final Schematic tmpSchem2 = new Schematic(new Seq<>(), new StringMap(), 0, 0);
|
||||
public static final String base64Header = "bXNjaAB";
|
||||
|
||||
private static final byte[] header = {'m', 's', 'c', 'h'};
|
||||
@@ -52,7 +52,7 @@ public class Schematics implements Loadable{
|
||||
private static final int resolution = 32;
|
||||
|
||||
private OptimizedByteArrayOutputStream out = new OptimizedByteArrayOutputStream(1024);
|
||||
private Array<Schematic> all = new Array<>();
|
||||
private Seq<Schematic> all = new Seq<>();
|
||||
private OrderedMap<Schematic, FrameBuffer> previews = new OrderedMap<>();
|
||||
private ObjectSet<Schematic> errored = new ObjectSet<>();
|
||||
private FrameBuffer shadowBuffer;
|
||||
@@ -155,7 +155,7 @@ public class Schematics implements Loadable{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Array<Schematic> all(){
|
||||
public Seq<Schematic> all(){
|
||||
return all;
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ public class Schematics implements Loadable{
|
||||
//dispose unneeded previews to prevent memory outage errors.
|
||||
//only runs every 2 seconds
|
||||
if(mobile && Time.timeSinceMillis(lastClearTime) > 1000 * 2 && previews.size > maxPreviewsMobile){
|
||||
Array<Schematic> keys = previews.orderedKeys().copy();
|
||||
Seq<Schematic> keys = previews.orderedKeys().copy();
|
||||
for(int i = 0; i < previews.size - maxPreviewsMobile; i++){
|
||||
//dispose and remove unneeded previews
|
||||
previews.get(keys.get(i)).dispose();
|
||||
@@ -246,7 +246,7 @@ public class Schematics implements Loadable{
|
||||
Draw.rect(Tmp.tr1, buffer.getWidth()/2f, buffer.getHeight()/2f, buffer.getWidth(), -buffer.getHeight());
|
||||
Draw.color();
|
||||
|
||||
Array<BuildRequest> requests = schematic.tiles.map(t -> new BuildRequest(t.x, t.y, t.rotation, t.block).configure(t.config));
|
||||
Seq<BuildRequest> requests = schematic.tiles.map(t -> new BuildRequest(t.x, t.y, t.rotation, t.block).configure(t.config));
|
||||
|
||||
Draw.flush();
|
||||
//scale each request to fit schematic
|
||||
@@ -276,7 +276,7 @@ public class Schematics implements Loadable{
|
||||
}
|
||||
|
||||
/** Creates an array of build requests from a schematic's data, centered on the provided x+y coordinates. */
|
||||
public Array<BuildRequest> toRequests(Schematic schem, int x, int y){
|
||||
public Seq<BuildRequest> toRequests(Schematic schem, int x, int y){
|
||||
return schem.tiles.map(t -> new BuildRequest(t.x + x - schem.width/2, t.y + y - schem.height/2, t.rotation, t.block).original(t.x, t.y, schem.width, schem.height).configure(t.config))
|
||||
.removeAll(s -> !s.block.isVisible() || !s.block.unlockedCur());
|
||||
}
|
||||
@@ -318,7 +318,7 @@ public class Schematics implements Loadable{
|
||||
|
||||
int ox = x, oy = y, ox2 = x2, oy2 = y2;
|
||||
|
||||
Array<Stile> tiles = new Array<>();
|
||||
Seq<Stile> tiles = new Seq<>();
|
||||
|
||||
int minx = x2, miny = y2, maxx = x, maxy = y;
|
||||
boolean found = false;
|
||||
@@ -344,7 +344,7 @@ public class Schematics implements Loadable{
|
||||
x2 = maxx;
|
||||
y2 = maxy;
|
||||
}else{
|
||||
return new Schematic(new Array<>(), new StringMap(), 1, 1);
|
||||
return new Schematic(new Seq<>(), new StringMap(), 1, 1);
|
||||
}
|
||||
|
||||
int width = x2 - x + 1, height = y2 - y + 1;
|
||||
@@ -466,7 +466,7 @@ public class Schematics implements Loadable{
|
||||
}
|
||||
|
||||
int total = stream.readInt();
|
||||
Array<Stile> tiles = new Array<>(total);
|
||||
Seq<Stile> tiles = new Seq<>(total);
|
||||
for(int i = 0; i < total; i++){
|
||||
Block block = blocks.get(stream.readByte());
|
||||
int position = stream.readInt();
|
||||
|
||||
Reference in New Issue
Block a user