src/TESForms/TESForm.cpp
//get data common to all form types
get data common to all form types
get data common to all form types
void GetCommonFormData(ExtraInfoEntry* resultArray, RE::TESForm* baseForm, RE::TESForm* refForm)
{
	logger::debug("GetCommonFormData Start");
	if (baseForm->formType == RE::FormType::NPC && baseForm->formID >= 0xFF000000) {
		logger::debug("Found actor with FF base form");
		baseForm = GetRootTemplate(baseForm);
	}
	std::string name = "";
	if (baseForm->formType == RE::FormType::Race) {
		RE::TESRace* race = static_cast<RE::TESRace*>(baseForm);
		if (race) {
			name = race->fullName.c_str();
		}
	}
	else {
		name = GetName(baseForm);
	}
	ExtraInfoEntry* nameArray;
	CreateExtraInfoEntry(nameArray, "Name", name, priority_Name);
	resultArray->PushBack(nameArray);
	std::string formID = FormIDToString(baseForm->formID);
	ExtraInfoEntry* formIDArray;
	CreateExtraInfoEntry(formIDArray, "Base form ID", formID, priority_FormID);
	resultArray->PushBack(formIDArray);
	std::string baseFormType = GetFormTypeName((int)baseForm->formType.underlying());
	ExtraInfoEntry* formTypeEntry;
	CreateExtraInfoEntry(formTypeEntry, "Base Type", baseFormType, priority_FormType);
	resultArray->PushBack(formTypeEntry);
	if (refForm != nullptr) {
		std::string refFormID = FormIDToString(refForm->formID);
		ExtraInfoEntry* formIDArrayReference;
		CreateExtraInfoEntry(formIDArrayReference, "Ref form ID", refFormID, priority_FormID);
		resultArray->PushBack(formIDArrayReference);
	}
	GetFormLocationData(resultArray, baseForm, refForm);
	GetModelTextures(resultArray, baseForm);
	if (MICOptions::ExperimentalFeatures) {
		ExtraInfoEntry* scriptsEntry;
		CreateExtraInfoEntry(scriptsEntry, "Scripts", "", priority_Scripts_Scripts);
		GetScripts(scriptsEntry, baseForm);
		if (refForm) {
			GetScripts(scriptsEntry, refForm);
		}
		if (scriptsEntry->HasChildren()) {
			resultArray->PushBack(scriptsEntry);
		}
		else {
			delete (scriptsEntry);  
		}
	}
	logger::debug("GetCommonFormData: GetCommonFormData End");
}
void GetCommonFormData ( ExtraInfoEntry * resultArray , RE :: TESForm * baseForm , RE :: TESForm * refForm ) { logger :: debug ( " " ) ; if ( baseForm -> formType == RE :: FormType :: NPC && baseForm -> formID >= 0xFF000000 ) { logger :: debug ( " " ) ; baseForm = GetRootTemplate ( baseForm ) ; } std :: string name = " " ; if ( baseForm -> formType == RE :: FormType :: Race ) { RE :: TESRace * race = static_cast < RE :: TESRace * > ( baseForm ) ; if ( race ) { name = race -> fullName . c_str ( ) ; } } else { name = GetName ( baseForm ) ; } ExtraInfoEntry * nameArray ; CreateExtraInfoEntry ( nameArray , " " , name , priority_Name ) ; resultArray -> PushBack ( nameArray ) ; std :: string formID = FormIDToString ( baseForm -> formID ) ; ExtraInfoEntry * formIDArray ; CreateExtraInfoEntry ( formIDArray , " " , formID , priority_FormID ) ; resultArray -> PushBack ( formIDArray ) ; std :: string baseFormType = GetFormTypeName ( ( int ) baseForm -> formType . underlying ( ) ) ; ExtraInfoEntry * formTypeEntry ; CreateExtraInfoEntry ( formTypeEntry , " " , baseFormType , priority_FormType ) ; resultArray -> PushBack ( formTypeEntry ) ; if ( refForm != nullptr ) { std :: string refFormID = FormIDToString ( refForm -> formID ) ; ExtraInfoEntry * formIDArrayReference ; CreateExtraInfoEntry ( formIDArrayReference , " " , refFormID , priority_FormID ) ; resultArray -> PushBack ( formIDArrayReference ) ; } GetFormLocationData ( resultArray , baseForm , refForm ) ; GetModelTextures ( resultArray , baseForm ) ; if ( MICOptions :: ExperimentalFeatures ) { ExtraInfoEntry * scriptsEntry ; CreateExtraInfoEntry ( scriptsEntry , " " , " " , priority_Scripts_Scripts ) ; GetScripts ( scriptsEntry , baseForm ) ; if ( refForm ) { GetScripts ( scriptsEntry , refForm ) ; } if ( scriptsEntry -> HasChildren ( ) ) { resultArray -> PushBack ( scriptsEntry ) ; } else { delete ( scriptsEntry ) ; } } logger :: debug ( " " ) ; }
get data common to all form types
get data common to all form types
//If the base form was found in FF, get the template for that form which is going to be more relevant //The getName function returns the editor ID for race as that is more useful in identifying the actual race //but we want to display the real name when we are getting data for the form //name /* This rarely works and I suspect it might be causing crashes for some keywords
	std::string editorID = baseForm->GetFormEditorID();

	if (editorID != "")
	{
		ExtraInfoEntry* editorIDEntry;
		CreateExtraInfoEntry(editorIDEntry, "Editor ID", editorID, priority_EditorID);
		resultArray->PushBack(editorIDEntry);
	}*/ //base formid //base form type //ref formid //mod location info //Model information //Get scripts //There's no point showing an empty script entry as having no scripts is the standard and some formtypes can't even have scripts. So check if we found anything //Free up the memory