mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-04-27 07:50:54 -07:00
Fixed #509
This commit is contained in:
parent
ec94267b8e
commit
10bd1d1969
8 changed files with 18 additions and 9 deletions
|
|
@ -108,9 +108,13 @@ public class ContentLoader{
|
|||
loaded = true;
|
||||
}
|
||||
|
||||
/** Initializes all content with the specified function. */
|
||||
public void initialize(Consumer<Content> callable){
|
||||
if(initialization.contains(callable)) return;
|
||||
initialize(callable, false);
|
||||
}
|
||||
|
||||
/** Initializes all content with the specified function. */
|
||||
public void initialize(Consumer<Content> callable, boolean override){
|
||||
if(initialization.contains(callable) && !override) return;
|
||||
|
||||
for(ContentType type : ContentType.values()){
|
||||
for(Content content : contentMap[type.ordinal()]){
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public class Control implements ApplicationListener{
|
|||
content.initialize(Content::init);
|
||||
Core.atlas = new TextureAtlas(maxSize < 2048 ? "sprites/sprites_fallback.atlas" : "sprites/sprites.atlas");
|
||||
Draw.scl = 1f / Core.atlas.find("scale_marker").getWidth();
|
||||
content.initialize(Content::load);
|
||||
content.initialize(Content::load, true);
|
||||
|
||||
data.load();
|
||||
|
||||
|
|
|
|||
|
|
@ -102,6 +102,8 @@ public class Units{
|
|||
|
||||
/** Returns the closest target enemy. First, units are checked, then tile entities. */
|
||||
public static TargetTrait closestTarget(Team team, float x, float y, float range, Predicate<Unit> unitPred, Predicate<Tile> tilePred){
|
||||
if(team == Team.none) return null;
|
||||
|
||||
Unit unit = closestEnemy(team, x, y, range, unitPred);
|
||||
if(unit != null){
|
||||
return unit;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public class RubbleDecal extends Decal{
|
|||
public static void create(float x, float y, int size){
|
||||
if(headless) return;
|
||||
|
||||
if(regions[size].length == 0){
|
||||
if(regions[size].length == 0 || regions[size][0].getTexture().isDisposed()){
|
||||
regions[size] = new TextureRegion[2];
|
||||
for(int j = 0; j < 2; j++){
|
||||
regions[size][j] = Core.atlas.find("rubble-" + size + "-" + j);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public class ScorchDecal extends Decal{
|
|||
public static void create(float x, float y){
|
||||
if(headless) return;
|
||||
|
||||
if(regions[0] == null){
|
||||
if(regions[0] == null || regions[0].getTexture().isDisposed()){
|
||||
for(int i = 0; i < regions.length; i++){
|
||||
regions[i] = Core.atlas.find("scorch" + (i + 1));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,6 @@ public class Rules{
|
|||
|
||||
/** Copies this ruleset exactly. Not very efficient at all, do not use often. */
|
||||
public Rules copy(){
|
||||
return JsonIO.read(Rules.class, JsonIO.write(this));
|
||||
return JsonIO.copy(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,9 +63,10 @@ public class MenuFragment extends Fragment{
|
|||
join = new MobileButton("icon-add", isize, "$joingame", ui.join::show),
|
||||
editor = new MobileButton("icon-editor", isize, "$editor", () -> ui.loadAnd(ui.editor::show)),
|
||||
tools = new MobileButton("icon-tools", isize, "$settings", ui.settings::show),
|
||||
donate = new MobileButton("icon-donate", isize, "$donate", () -> Core.net.openURI(donationURL));
|
||||
donate = new MobileButton("icon-donate", isize, "$donate", () -> Core.net.openURI(donationURL)),
|
||||
exit = new MobileButton("icon-exit", isize, "$quit", () -> Core.app.exit());
|
||||
|
||||
if(Core.graphics.getWidth() > Core.graphics.getHeight()){
|
||||
if(!Core.graphics.isPortrait()){
|
||||
container.add(play);
|
||||
container.add(join);
|
||||
container.add(custom);
|
||||
|
|
@ -79,6 +80,7 @@ public class MenuFragment extends Fragment{
|
|||
table.add(tools);
|
||||
|
||||
if(Platform.instance.canDonate()) table.add(donate);
|
||||
table.add(exit);
|
||||
}).colspan(4);
|
||||
}else{
|
||||
container.add(play);
|
||||
|
|
@ -95,6 +97,7 @@ public class MenuFragment extends Fragment{
|
|||
table.defaults().set(container.defaults());
|
||||
|
||||
if(Platform.instance.canDonate()) table.add(donate);
|
||||
table.add(exit);
|
||||
}).colspan(2);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ public class Block extends BlockStorage{
|
|||
cacheRegions[i] = Core.atlas.find(cacheRegionStrings.get(i));
|
||||
}
|
||||
|
||||
if(cracks == null){
|
||||
if(cracks == null || cracks[0][0].getTexture().isDisposed()){
|
||||
cracks = new TextureRegion[maxCrackSize][crackRegions];
|
||||
for(int size = 1; size <= maxCrackSize; size++){
|
||||
for(int i = 0; i < crackRegions; i++){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue