Pulled out functionality to allow overriding.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4123 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -130,19 +130,35 @@ public class PlacementConstraints
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectData[] removedData = new ObjectData[removed.length];
|
ObjectData[] removedData = getObjectDataFromInfo(removed);
|
||||||
for (int i = 0; i < removed.length; i++) {
|
if (removedData == null) {
|
||||||
removedData[i] = (ObjectData)_objectData.get(removed[i]);
|
return INTERNAL_ERROR;
|
||||||
if (removedData[i] == null) {
|
|
||||||
Log.warning("Couldn't match object info up to data [info=" +
|
|
||||||
removed[i] + "].");
|
|
||||||
return INTERNAL_ERROR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return allowModifyObjects(addedData, removedData);
|
return allowModifyObjects(addedData, removedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an ObjectData array that corresponds to the supplied
|
||||||
|
* ObjectInfo array. Returns null on error.
|
||||||
|
*/
|
||||||
|
protected ObjectData[] getObjectDataFromInfo (ObjectInfo[] info)
|
||||||
|
{
|
||||||
|
if (info == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
ObjectData[] data = new ObjectData[info.length];
|
||||||
|
for (int ii = 0; ii < info.length; ii++) {
|
||||||
|
data[ii] = (ObjectData)_objectData.get(info[ii]);
|
||||||
|
if (data[ii] == null) {
|
||||||
|
Log.warning("Couldn't match object info up to data [info=" +
|
||||||
|
info[ii] + "].");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the constraints allow the specified objects to be
|
* Determines whether the constraints allow the specified objects to be
|
||||||
* added and removed simultaneously. Subclasses that wish to define
|
* added and removed simultaneously. Subclasses that wish to define
|
||||||
|
|||||||
Reference in New Issue
Block a user