private void updateLinks(World world, DiffBuffer buf) {
// turtles, on the other hand, can die, so we move each one to a new
// map as we encounter it...
Map<ClientWorld.LinkKey, LinkData> newLinks = new HashMap<ClientWorld.LinkKey, LinkData>();
for (Agent a : world.links().agents()) {
Link link = (Link) a;
LinkData diffs = updateLink(link);
if (diffs != null) {
buf.addLink(diffs);
}
ClientWorld.LinkKey key =
new ClientWorld.LinkKey(link.id(), link.end1().id(), link.end2().id(), link.getBreedIndex());
LinkData tmp = links.remove(key);
newLinks.put(key, tmp);
}
// now, any link left in the old map must have died...
for (LinkData data : links.values()) {