Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PerkEntry virtual method override returns incorrect value #17

Closed
SteveTownsend opened this issue Jun 2, 2020 · 2 comments
Closed

PerkEntry virtual method override returns incorrect value #17

SteveTownsend opened this issue Jun 2, 2020 · 2 comments

Comments

@SteveTownsend
Copy link

SteveTownsend commented Jun 2, 2020

I wrote some code to analyze certain perks, had to manually get public field rather than call GetEntryPoint() to make it work. Example code below. Not urgent for me, more of a heads up.

void DataCase::AnalyzePerks(void)
{
	RE::TESDataHandler* dhnd = RE::TESDataHandler::GetSingleton();
	if (!dhnd)
		return;

	for (RE::TESForm* form : dhnd->GetFormArray(RE::FormType::Perk))
	{
		const RE::BGSPerk* perk(form->As<RE::BGSPerk>());
		if (!perk)
			continue;
#if _DEBUG
		_MESSAGE("Perk %s/0x%08x being checked", perk->GetName(), perk->GetFormID());
#endif
		for (const RE::BGSPerkEntry* perkEntry : perk->perkEntries)
		{
			if (perkEntry->GetType() != RE::BGSPerkEntry::Type::kEntryPoint)
				continue;

			const RE::BGSEntryPointPerkEntry* entryPoint(static_cast<const RE::BGSEntryPointPerkEntry*>(perkEntry));
			// Note that use of entryPoint->GetEntryPoint() here results in the incorrect value being returned
			if (entryPoint->entryData.entryPoint == RE::BGSEntryPoint::ENTRY_POINT::kAddLeveledListOnDeath &&
				entryPoint->entryData.function == RE::BGSEntryPointPerkEntry::EntryData::Function::kAddLeveledList)
			{
#if _DEBUG
				_MESSAGE("Leveled items added on death by perk %s/0x%08x", perk->GetName(), perk->GetFormID());
#endif
				m_leveledItemOnDeathPerks.insert(perk);
				break;
			}
		}
	}
}
@Ryan-rsm-McKenzie
Copy link
Owner

Ryan-rsm-McKenzie commented Jun 2, 2020

887d7cf
Should fix it

@SteveTownsend
Copy link
Author

SteveTownsend commented Jun 2, 2020 via email

alandtse referenced this issue in alandtse/CommonLibVR Sep 6, 2022
Add kObjectArray GetTypeInfo and TypeInfo to String
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants