Save unit variables in processors

This commit is contained in:
Anuken
2021-11-29 10:57:42 -05:00
parent ea6d794c36
commit 635027bb81
11 changed files with 76 additions and 18 deletions

View File

@@ -86,7 +86,11 @@ public class SaveIO{
try{
readHeader(stream);
int version = stream.readInt();
SaveMeta meta = versions.get(version).getMeta(stream);
SaveVersion ver = versions.get(version);
if(ver == null) throw new IOException("Unknown save version: " + version + ". Are you trying to load a save from a newer version?");
SaveMeta meta = ver.getMeta(stream);
stream.close();
return meta;
}catch(IOException e){
@@ -158,6 +162,8 @@ public class SaveIO{
int version = stream.readInt();
SaveVersion ver = versions.get(version);
if(ver == null) throw new IOException("Unknown save version: " + version + ". Are you trying to load a save from a newer version?");
ver.read(stream, counter, context);
Events.fire(new SaveLoadEvent());
}catch(Throwable e){