I don't know if Empeg people read this or care, but here is the implementation I used in jEmplode... This appears in my WendyFlags class. Basically, the Wendy editor keeps track of what original flag indexes are deleted, and when you Apply the changes, it calls the following method for each index (basically): This code should be almost identical to the C/emptool equivalent:
/**
* Removes a Wendy Flag from all the nodes in the
* database that reference that flag.
*
* @param _flagIndex the Wendy flag index to remove
* @param _db the PlayerDatabase to update
*/
public void removeFlag(int _flagIndex, PlayerDatabase _db) {
Enumeration elements = _db.getNodeMap().elements();
while (elements.hasMoreElements()) {
AbstractFIDNode node = (AbstractFIDNode)elements.nextElement();
int wendy = node.getIntTag("wendy");
if (wendy > 0) {
int lowerPart = wendy & ((1 << _flagIndex) - 1);
int upperPart = (wendy >> (_flagIndex + 1)) << _flagIndex;
int newWendy = lowerPart | upperPart;
node.setIntTag("wendy", newWendy);
}
}
}