From 77447c59f6d03600122f14c9ab564ef2afd060b9 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 31 Mar 2020 15:01:22 -0400 Subject: [PATCH] Cleanup --- core/src/mindustry/core/World.java | 48 ------------------- core/src/mindustry/editor/MapEditor.java | 7 --- .../src/mindustry/editor/MapEditorDialog.java | 3 +- core/src/mindustry/input/InputHandler.java | 2 +- core/src/mindustry/io/SaveVersion.java | 3 +- gradle.properties | 2 +- 6 files changed, 4 insertions(+), 61 deletions(-) diff --git a/core/src/mindustry/core/World.java b/core/src/mindustry/core/World.java index 0aa9504d2f..8591eed25a 100644 --- a/core/src/mindustry/core/World.java +++ b/core/src/mindustry/core/World.java @@ -161,7 +161,6 @@ public class World{ * A WorldLoadEvent will be fire. */ public void endMapLoad(){ - prepareTiles(tiles); for(Tile tile : tiles){ //remove legacy blocks; they need to stop existing @@ -393,53 +392,6 @@ public class World{ return dark; } - /** - * 'Prepares' a tile array by:
- * - setting up multiblocks
- * - updating occlusion
- * Usually used before placing structures on a tile array. - */ - public void prepareTiles(Tiles tiles){ - - //TODO FIX - /* - //find multiblocks - IntArray multiblocks = new IntArray(); - for(Tile tile : tiles){ - if(tile.block().isMultiblock()){ - multiblocks.add(tile.pos()); - } - } - - //place multiblocks now - for(int i = 0; i < multiblocks.size; i++){ - int pos = multiblocks.get(i); - - int x = Point2.x(pos); - int y = Point2.y(pos); - Tile tile = tiles.getn(x, y); - - Block result = tile.block(); - Team team = tile.team(); - - int offsetx = -(result.size - 1) / 2; - int offsety = -(result.size - 1) / 2; - - for(int dx = 0; dx < result.size; dx++){ - for(int dy = 0; dy < result.size; dy++){ - int worldx = dx + offsetx + x; - int worldy = dy + offsety + y; - if(!(worldx == x && worldy == y)){ - Tile toplace = world.tile(worldx, worldy); - if(toplace != null){ - toplace.setBlock(BlockPart.get(dx + offsetx, dy + offsety), team); - } - } - } - } - }*/ - } - public interface Raycaster{ boolean accept(int x, int y); } diff --git a/core/src/mindustry/editor/MapEditor.java b/core/src/mindustry/editor/MapEditor.java index 3d82eca733..9e13e7881b 100644 --- a/core/src/mindustry/editor/MapEditor.java +++ b/core/src/mindustry/editor/MapEditor.java @@ -54,7 +54,6 @@ public class MapEditor{ tags.put("steamid", map.file.parent().name()); } MapIO.loadMap(map, context); - checkLinkedTiles(); renderer.resize(width(), height()); loading = false; } @@ -67,12 +66,6 @@ public class MapEditor{ renderer.resize(width(), height()); } - //adds missing blockparts - //TODO remove, may not be necessary with blockpart refactor later - public void checkLinkedTiles(){ - //TODO actually remove - } - public void load(Runnable r){ loading = true; r.run(); diff --git a/core/src/mindustry/editor/MapEditorDialog.java b/core/src/mindustry/editor/MapEditorDialog.java index 57003e2e3b..e019213012 100644 --- a/core/src/mindustry/editor/MapEditorDialog.java +++ b/core/src/mindustry/editor/MapEditorDialog.java @@ -260,8 +260,7 @@ public class MapEditorDialog extends Dialog implements Disposable{ } } player.set(world.width() * tilesize/2f, world.height() * tilesize/2f); - //TODO figure out how to kill player - //player.dead(false); + player.clearUnit(); logic.play(); }); } diff --git a/core/src/mindustry/input/InputHandler.java b/core/src/mindustry/input/InputHandler.java index d3f5170e89..b9fc0585c1 100644 --- a/core/src/mindustry/input/InputHandler.java +++ b/core/src/mindustry/input/InputHandler.java @@ -807,7 +807,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ public void breakBlock(int x, int y){ Tile tile = world.tile(x, y); //TODO hacky - if(tile.entity != null) tile = tile.entity.tile(); + if(tile != null && tile.entity != null) tile = tile.entity.tile(); player.builder().addBuild(new BuildRequest(tile.x, tile.y)); } diff --git a/core/src/mindustry/io/SaveVersion.java b/core/src/mindustry/io/SaveVersion.java index fa71dbda4e..8ff67ee747 100644 --- a/core/src/mindustry/io/SaveVersion.java +++ b/core/src/mindustry/io/SaveVersion.java @@ -84,12 +84,11 @@ public abstract class SaveVersion extends SaveFileReader{ lastReadBuild = map.getInt("build", -1); Map worldmap = maps.byName(map.get("mapname", "\\\\\\")); - Map map1 = worldmap == null ? new Map(StringMap.of( + state.map = worldmap == null ? new Map(StringMap.of( "name", map.get("mapname", "Unknown"), "width", 1, "height", 1 )) : worldmap; - state.map = map1; } public void writeMap(DataOutput stream) throws IOException{ diff --git a/gradle.properties b/gradle.properties index 63704699ee..e669c5abfc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=1b96f9149cce63e7c4b72b5798c58e8f62b1f185 +archash=50df607c88d697dc42b29b56947cda318f90d71b