Added dungeonData shell for saving

This commit is contained in:
StevenRS11 2013-11-05 02:36:12 -05:00
parent 69809df4c3
commit 58842048d4
3 changed files with 17 additions and 5 deletions

View file

@ -21,6 +21,7 @@ import StevenDimDoors.mod_pocketDim.helpers.DeleteFolder;
import StevenDimDoors.mod_pocketDim.saving.DDSaveHandler;
import StevenDimDoors.mod_pocketDim.saving.IPackable;
import StevenDimDoors.mod_pocketDim.saving.PackedDimData;
import StevenDimDoors.mod_pocketDim.saving.PackedDungeonData;
import StevenDimDoors.mod_pocketDim.saving.PackedLinkData;
import StevenDimDoors.mod_pocketDim.saving.PackedLinkTail;
import StevenDimDoors.mod_pocketDim.util.Point4D;
@ -96,6 +97,7 @@ public class PocketManager
ArrayList<Integer> ChildIDs = new ArrayList<Integer>();
ArrayList<PackedLinkData> Links = new ArrayList<PackedLinkData>();
ArrayList<PackedLinkTail> Tails = new ArrayList<PackedLinkTail>();
PackedDungeonData packedDungeon = new PackedDungeonData(); //TODO pack dungeon Data
//Make a list of children
for(NewDimData data : this.children)
{
@ -123,6 +125,8 @@ public class PocketManager
Tails.add(tempTail);
}
}
int parentID=this.id;
Point3D originPoint=new Point3D(0,0,0);
@ -135,7 +139,7 @@ public class PocketManager
originPoint=this.origin.toPoint3D();
}
return new PackedDimData(this.id, depth, this.packDepth, parentID, this.root().id(), orientation,
isDungeon, isFilled, originPoint, ChildIDs, Links, Tails);
isDungeon, isFilled,packedDungeon, originPoint, ChildIDs, Links, Tails);
// FIXME: IMPLEMENTATION PLZTHX
//I tried
}

View file

@ -66,7 +66,7 @@ public class DimDataProcessor extends BaseConfigurationProcessor<PackedDimData>
catch (IOException e)
{
// not sure if this is kosher, we need it to explode, but not by throwing the IO exception.
throw new ConfigurationProcessingException();
throw new ConfigurationProcessingException("Incorrectly formatted save data");
}
// TODO Auto-generated method stub
@ -86,6 +86,7 @@ public class DimDataProcessor extends BaseConfigurationProcessor<PackedDimData>
int PackDepth;
int ParentID;
int RootID;
PackedDungeonData Dungeon;
Point3D Origin;
int Orientation;
List<Integer> ChildIDs;
@ -121,6 +122,8 @@ public class DimDataProcessor extends BaseConfigurationProcessor<PackedDimData>
reader.nextName();
RootID= reader.nextInt();
reader.nextName();
Dungeon = createDungeonDataFromJson(reader);
reader.nextName();
Origin = createPointFromJson(reader);
@ -133,7 +136,7 @@ public class DimDataProcessor extends BaseConfigurationProcessor<PackedDimData>
reader.nextName();
Links = this.createLinksListFromJson(reader);
return new PackedDimData(ID, Depth, PackDepth, ParentID, RootID, Orientation, IsDungeon, IsFilled, Origin, ChildIDs, Links, Tails);
return new PackedDimData(ID, Depth, PackDepth, ParentID, RootID, Orientation, IsDungeon, IsFilled, Dungeon, Origin, ChildIDs, Links, Tails);
}
private Point3D createPointFromJson(JsonReader reader) throws IOException
@ -239,6 +242,9 @@ public class DimDataProcessor extends BaseConfigurationProcessor<PackedDimData>
}
private PackedDungeonData createDungeonDataFromJson(JsonReader reader) throws IOException
{
reader.beginObject();
//TODO read in dungeon Data
reader.endObject();
return null;
}
private PackedLinkTail createLinkTailFromJson(JsonReader reader) throws IOException

View file

@ -16,6 +16,7 @@ public class PackedDimData
public final int PackDepth;
public final int ParentID;
public final int RootID;
public final PackedDungeonData DungeonData;
public final Point3D Origin;
public final int Orientation;
public final List<Integer> ChildIDs;
@ -25,7 +26,7 @@ public class PackedDimData
// FIXME Missing dungeon data, not sure how to include it
public PackedDimData(int id, int depth, int packDepth, int parentID, int rootID, int orientation,
boolean isDungeon, boolean isFilled, Point3D origin, List<Integer> childIDs, List<PackedLinkData> links,
boolean isDungeon, boolean isFilled,PackedDungeonData dungeonData, Point3D origin, List<Integer> childIDs, List<PackedLinkData> links,
List<PackedLinkTail> tails)
{
ID = id;
@ -36,6 +37,7 @@ public class PackedDimData
Orientation = orientation;
IsDungeon = isDungeon;
IsFilled = isFilled;
DungeonData = dungeonData;
Origin = origin;
ChildIDs = childIDs;
Links = links;