private void applyPerceptionModifiedRPObjects(MessageS2CPerception message,
Map<RPObject.ID, RPObject> world) throws RPObjectNotFoundException {
try {
/* First we remove the deleted attributes */
for (RPObject object : message.getModifiedDeletedRPObjects()) {
RPObject w_object = world.get(object.getID());
if (!listener.onModifiedDeleted(w_object, object)) {
w_object.applyDifferences(null, object);
}
}
/* And then we add the new and modified attributes */
for (RPObject object : message.getModifiedAddedRPObjects()) {
RPObject w_object = world.get(object.getID());
if (w_object == null) {
logger.warn("Missing base object for modified added RPObject with id " + object.getID());
continue;
}
if (!listener.onModifiedAdded(w_object, object)) {
w_object.applyDifferences(object, null);
}
}
} catch (RPObjectNotFoundException e) {
logger.error("error in applyModifiedRPObjects", e);
logger.error("world is [" + world.toString() + "]");