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

View file

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

View file

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