Gradual component conversion

This commit is contained in:
Anuken
2020-02-02 20:17:22 -05:00
70 changed files with 1061 additions and 1217 deletions

View File

@@ -14,7 +14,9 @@ public abstract class SaveFileReader{
protected final DataOutputStream dataBytes = new DataOutputStream(byteOutput);
protected final ReusableByteOutStream byteOutputSmall = new ReusableByteOutStream();
protected final DataOutputStream dataBytesSmall = new DataOutputStream(byteOutputSmall);
protected final ObjectMap<String, String> fallback = ObjectMap.of();
protected final ObjectMap<String, String> fallback = ObjectMap.of(
"dart-mech-pad", "dart-ship-pad"
);
protected void region(String name, DataInput stream, CounterInputStream counter, IORunner<DataInput> cons) throws IOException{
counter.resetCount();

View File

@@ -9,7 +9,6 @@ import mindustry.entities.Effects.Effect;
import mindustry.entities.type.Bullet;
import mindustry.entities.bullet.BulletType;
import mindustry.entities.traits.BuilderTrait.BuildRequest;
import mindustry.entities.traits.ShooterTrait;
import mindustry.entities.type.*;
import mindustry.entities.units.*;
import mindustry.game.*;
@@ -232,13 +231,13 @@ public class TypeIO{
return Effects.getEffect(buffer.getShort());
}
@WriteClass(UnitType.class)
public static void writeUnitType(ByteBuffer buffer, UnitType effect){
@WriteClass(UnitDef.class)
public static void writeUnitDef(ByteBuffer buffer, UnitDef effect){
buffer.putShort(effect.id);
}
@ReadClass(UnitType.class)
public static UnitType readUnitType(ByteBuffer buffer){
@ReadClass(UnitDef.class)
public static UnitDef readUnitDef(ByteBuffer buffer){
return content.getByID(ContentType.unit, buffer.getShort());
}
@@ -252,16 +251,6 @@ public class TypeIO{
return new Color(buffer.getInt());
}
@WriteClass(Mech.class)
public static void writeMech(ByteBuffer buffer, Mech mech){
buffer.put((byte)mech.id);
}
@ReadClass(Mech.class)
public static Mech readMech(ByteBuffer buffer){
return content.getByID(ContentType.mech, buffer.get());
}
@WriteClass(Liquid.class)
public static void writeLiquid(ByteBuffer buffer, Liquid liquid){
buffer.putShort(liquid == null ? -1 : liquid.id);