mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-08 06:13:28 +07:00
Fixed map resize not preserving links
This commit is contained in:
parent
0cc64c6a8d
commit
0d084d380d
@ -8,6 +8,7 @@ import arc.math.geom.*;
|
||||
import arc.struct.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.editor.DrawOperation.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.io.*;
|
||||
@ -259,7 +260,7 @@ public class MapEditor{
|
||||
clearOp();
|
||||
|
||||
Tiles previous = world.tiles;
|
||||
int offsetX = -(width - width()) / 2, offsetY = -(height - height()) / 2;
|
||||
int offsetX = (width() - width) / 2, offsetY = (height() - height) / 2;
|
||||
loading = true;
|
||||
|
||||
Tiles tiles = world.resize(width, height);
|
||||
@ -275,7 +276,17 @@ public class MapEditor{
|
||||
if(tile.build != null && tile.isCenter()){
|
||||
tile.build.x = x * tilesize + tile.block().offset;
|
||||
tile.build.y = y * tilesize + tile.block().offset;
|
||||
|
||||
//shift links to account for map resize
|
||||
Object config = tile.build.config();
|
||||
if(config != null){
|
||||
Object out = BuildPlan.pointConfig(tile.block(), config, p -> p.sub(offsetX, offsetY));
|
||||
if(out != config){
|
||||
tile.build.configureAny(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
tiles.set(x, y, new EditorTile(x, y, Blocks.stone.id, (short)0, (short)0));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user