Fixed null DDProperties reference in DimData

Fixed null DDProperties reference in DimData. Changed the code so that
it requests an instance in each of its functions instead of relying on
loading a reference when it's first instantiated. I'm not sure how the
null references are slipping through, that shouldn't be possible.
This commit is contained in:
SenseiKiwi 2013-06-14 05:14:34 -04:00
parent 5f5569e9b9
commit cb966210bd

View file

@ -33,8 +33,6 @@ public class DimData implements Serializable
static final long serialVersionUID = 454342L; static final long serialVersionUID = 454342L;
private static DDProperties properties = null;
public DimData(int dimID, boolean isPocket, int depth, LinkData exitLinkData) public DimData(int dimID, boolean isPocket, int depth, LinkData exitLinkData)
{ {
this.dimID=dimID; this.dimID=dimID;
@ -42,9 +40,6 @@ public class DimData implements Serializable
this.isPocket=isPocket; this.isPocket=isPocket;
this.exitDimLink= exitLinkData; this.exitDimLink= exitLinkData;
if (properties == null)
properties = DDProperties.instance();
} }
public DimData(int dimID, boolean isPocket, int depth, int exitLinkDimID, int exitX, int exitY, int exitZ) public DimData(int dimID, boolean isPocket, int depth, int exitLinkDimID, int exitX, int exitY, int exitZ)
@ -59,6 +54,7 @@ public class DimData implements Serializable
int i=-range; int i=-range;
int j=-range; int j=-range;
int k=-range; int k=-range;
DDProperties properties = DDProperties.instance();
while (i<range) while (i<range)
{ {
@ -98,6 +94,7 @@ public class DimData implements Serializable
int i=-range; int i=-range;
int j=-range; int j=-range;
int k=-range; int k=-range;
DDProperties properties = DDProperties.instance();
while (i<range) while (i<range)
{ {
@ -167,43 +164,23 @@ public class DimData implements Serializable
public LinkData addLinkToDim( int destinationDimID, int locationXCoord, int locationYCoord, int locationZCoord, int destinationXCoord, int destinationYCoord, int destinationZCoord, int linkOrientation) public LinkData addLinkToDim( int destinationDimID, int locationXCoord, int locationYCoord, int locationZCoord, int destinationXCoord, int destinationYCoord, int destinationZCoord, int linkOrientation)
{ {
LinkData linkData= new LinkData(this.dimID, destinationDimID, locationXCoord, locationYCoord, locationZCoord, destinationXCoord, destinationYCoord,destinationZCoord,this.isPocket,linkOrientation); LinkData linkData= new LinkData(this.dimID, destinationDimID, locationXCoord, locationYCoord, locationZCoord, destinationXCoord, destinationYCoord,destinationZCoord,this.isPocket,linkOrientation);
return this.addLinkToDim(linkData); return this.addLinkToDim(linkData);
} }
public boolean isLimbo() public boolean isLimbo()
{ {
if(this.dimID==properties.LimboDimensionID) return (this.dimID == DDProperties.instance().LimboDimensionID);
{ }
return true;
}
else
{
return false;
}
}
public void removeLinkAtCoords(LinkData link) public void removeLinkAtCoords(LinkData link)
{ {
this.removeLinkAtCoords(link.locDimID, link.locXCoord, link.locYCoord, link.locZCoord); this.removeLinkAtCoords(link.locDimID, link.locXCoord, link.locYCoord, link.locZCoord);
} }
public void removeLinkAtCoords(int locationID, int locationXCoord, int locationYCoord, int locationZCoord) public void removeLinkAtCoords(int locationID, int locationXCoord, int locationYCoord, int locationZCoord)
{ {
if (this.linksInThisDim.containsKey(locationZCoord)) if (this.linksInThisDim.containsKey(locationZCoord))
{ {
this.dimY=this.linksInThisDim.get(locationZCoord); this.dimY=this.linksInThisDim.get(locationZCoord);