Added backwards compatibility for legacy saves

This commit is contained in:
Anuken
2020-02-17 11:13:46 -05:00
parent 18d4efa315
commit e215772f30
34 changed files with 1009 additions and 855 deletions

View File

@@ -0,0 +1,29 @@
package mindustry.io.legacy;
import mindustry.game.*;
import mindustry.game.Teams.*;
import java.io.*;
import static mindustry.Vars.content;
public class Save3 extends LegacySaveVersion{
public Save3(){
super(3);
}
@Override
public void readEntities(DataInput stream) throws IOException{
int teamc = stream.readInt();
for(int i = 0; i < teamc; i++){
Team team = Team.get(stream.readInt());
TeamData data = team.data();
int blocks = stream.readInt();
for(int j = 0; j < blocks; j++){
data.brokenBlocks.addLast(new BrokenBlock(stream.readShort(), stream.readShort(), stream.readShort(), content.block(stream.readShort()).id, stream.readInt()));
}
}
readLegacyEntities(stream);
}
}