// copy entries over in order of level so the index mapping is easier
for( InfoType type : InfoType.getSortedByLevel() )
{
for( int index : indices )
{
ConstInfoAccessor entry = editorSrc.getItem( index );
// skip entries that aren't this type
if( entry.getType() != type )
{
continue;
}
// make sure the source entry is valid before we copy it
assert( type.subIndicesAreValid( entry, editorSrc ) );
assert( type.selfIndexIsValid( entry, editorSrc ) );
// make a copy of the entry so we can modify it safely
ConstInfoAccessor entryCopy = editorSrc.getItem( index ).copy();
assert( type.subIndicesAreValid( entryCopy, editorSrc ) );
assert( type.selfIndexIsValid( entryCopy, editorSrc ) );
// remap the indices
type.remapIndices( indexMap, entryCopy );
assert( type.subIndicesAreValid( entryCopy, editorDest ) );
// put the copy in the destination pool
int newIndex = editorDest.addItem( entryCopy.getItem() );
entryCopy.setIndex( newIndex );
assert( type.selfIndexIsValid( entryCopy, editorDest ) ) : type + ", self: " + entryCopy + " dest: " + editorDest.getItem( entryCopy.getIndex() );
// make sure the source entry is unchanged
assert( type.subIndicesAreValid( entry, editorSrc ) );
assert( type.selfIndexIsValid( entry, editorSrc ) );