Marker instruction rework

This commit is contained in:
Anuken
2023-09-28 01:04:03 -04:00
parent 68a5ab14be
commit 8bbf5b1f52
18 changed files with 202 additions and 89 deletions
+12
View File
@@ -6,12 +6,14 @@ import arc.math.geom.*;
import arc.struct.*;
import arc.util.*;
import arc.util.io.*;
import mindustry.*;
import mindustry.content.*;
import mindustry.content.TechTree.*;
import mindustry.core.*;
import mindustry.ctype.*;
import mindustry.entities.*;
import mindustry.game.*;
import mindustry.game.MapObjectives.*;
import mindustry.game.Teams.*;
import mindustry.gen.*;
import mindustry.maps.Map;
@@ -74,6 +76,7 @@ public abstract class SaveVersion extends SaveFileReader{
try{
region("map", stream, counter, in -> readMap(in, context));
region("entities", stream, counter, this::readEntities);
if(version >= 8) region("markers", stream, counter, this::readMarkers);
region("custom", stream, counter, this::readCustomChunks);
}finally{
content.setTemporaryMapper(null);
@@ -85,6 +88,7 @@ public abstract class SaveVersion extends SaveFileReader{
region("content", stream, this::writeContentHeader);
region("map", stream, this::writeMap);
region("entities", stream, this::writeEntities);
region("markers", stream, this::writeMarkers);
region("custom", stream, s -> writeCustomChunks(s, false));
}
@@ -395,6 +399,14 @@ public abstract class SaveVersion extends SaveFileReader{
writeWorldEntities(stream);
}
public void writeMarkers(DataOutput stream) throws IOException{
JsonIO.writeBytes(Vars.state.markers, ObjectiveMarker.class, (DataOutputStream)stream);
}
public void readMarkers(DataInput stream) throws IOException{
Vars.state.markers = JsonIO.readBytes(IntMap.class, ObjectiveMarker.class, (DataInputStream)stream);
}
public void readTeamBlocks(DataInput stream) throws IOException{
int teamc = stream.readInt();