public void AddMovableObjectFactory( MovableObjectFactory fact, bool overrideExisting )
{
if ( this.movableObjectFactoryMap.ContainsKey( fact.Type ) && !overrideExisting )
{
throw new AxiomException( "A factory of type '" + fact.Type + "' already exists." );
}
if ( fact.RequestTypeFlags )
{
if ( this.movableObjectFactoryMap.ContainsValue( fact ) )
{
// Copy type flags from the factory we're replacing
fact.TypeFlag = ( this.movableObjectFactoryMap[ fact.Type ] ).TypeFlag;
}
else
{
// Allocate new
fact.TypeFlag = this.NextMovableObjectTypeFlag();
}
}
// Save
this.movableObjectFactoryMap.Add( fact.Type, fact );
LogManager.Instance.Write( "Factory " + fact.GetType().Name + " registered for MovableObjectType '" + fact.Type + "'." );
}