TESForm * TempClone(TESForm * thisForm)
	{
		TESForm	* result = NULL;

		if(thisForm)
		{
			IFormFactory	* factory = IFormFactory::GetFactoryForType(thisForm->formType);
			if(factory)
			{
				result = factory->Create();
				if(result)
				{
					result->Init();
					result->CopyFrom(thisForm);
					result->CopyFromEx(thisForm);
				}
				else
				{
					_ERROR("Form::TempClone: factory for type %02X failed", thisForm->formType);
				}
			}
			else
			{
				_MESSAGE("Form::TempClone: tried to clone form %08X (type %02X), no factory found", thisForm->formID, thisForm->formType);
			}
		}

		return result;
	}
Esempio n. 2
0
TESForm * TESForm::CreateEmptyForm(FormType formType)
{
#if 0
	IFormFactory *factory = IFormFactory::GetFactoryForType(formType);
	return (factory) ? factory->Create() : nullptr;
#endif
	typedef TESForm*(*Fn)(FormType formType);
	Fn fn = (Fn)0x0043BDD0;
	return fn(formType);
}