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:
Mark Johnson
2006-05-17 00:46:56 +00:00
parent 64e87bb907
commit 048338efa4
@@ -130,18 +130,34 @@ public class PlacementConstraints
}
}
ObjectData[] removedData = new ObjectData[removed.length];
for (int i = 0; i < removed.length; i++) {
removedData[i] = (ObjectData)_objectData.get(removed[i]);
if (removedData[i] == null) {
Log.warning("Couldn't match object info up to data [info=" +
removed[i] + "].");
return INTERNAL_ERROR;
}
ObjectData[] removedData = getObjectDataFromInfo(removed);
if (removedData == null) {
return INTERNAL_ERROR;
}
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