1
Fork 0

Removed redundant IsDeleted checks

ae-1.6.629
Eddoursul 2 years ago
parent f2cbb5ea8a
commit 11311399ce
  1. BIN
      SKSE/Plugins/ArtifactTracker.dll
  2. 14
      Source/ArtifactTrackerDLL/src/ArtifactTracker.cpp
  3. 10
      Source/ArtifactTrackerDLL/src/Util.h

Binary file not shown.

@ -62,7 +62,7 @@ namespace ArtifactTracker
g_artifactFormTypes.insert(RE::FormType::Weapon);
for (const auto& form : dataHandler->GetFormArray<RE::TESObjectWEAP>()) {
if (form->GetPlayable() && !form->IsBound() && !form->weaponData.flags.all(RE::TESObjectWEAP::Data::Flag::kCantDrop) && !form->IsDeleted()) {
if (form->GetPlayable() && !form->IsBound() && !form->weaponData.flags.all(RE::TESObjectWEAP::Data::Flag::kCantDrop)) {
if ((!form->HasKeyword(notArtifactKeyword) || form->HasKeyword(extraArtifactKeyword)) && strlen(form->GetName()) > 0) {
g_artifactMap[form->formID] = form;
}
@ -72,7 +72,7 @@ namespace ArtifactTracker
g_artifactFormTypes.insert(RE::FormType::Armor);
for (const auto& form : dataHandler->GetFormArray<RE::TESObjectARMO>()) {
if (form->GetPlayable() && !form->IsDeleted() && form->race && (form->race->formID == 0x19 || form->race->HasKeyword(npcRaceKeyword))) {
if (form->GetPlayable() && form->race && (form->race->formID == 0x19 || form->race->HasKeyword(npcRaceKeyword))) {
if ((!form->HasKeyword(notArtifactKeyword) || form->HasKeyword(extraArtifactKeyword)) && strlen(form->GetName()) > 0) {
g_artifactMap[form->formID] = form;
}
@ -84,14 +84,14 @@ namespace ArtifactTracker
g_artifactFormTypes.insert(RE::FormType::Book);
for (const auto& form : dataHandler->GetFormArray<RE::TESObjectBOOK>()) {
if (!form->IsDeleted() && (form->HasKeyword(extraArtifactKeyword) || (!form->TeachesSpell() && BookCheck::IsBook(form))) && !form->HasKeyword(notArtifactKeyword)) {
if ((form->HasKeyword(extraArtifactKeyword) || (!form->TeachesSpell() && BookCheck::IsBook(form))) && !form->HasKeyword(notArtifactKeyword)) {
g_artifactMap[form->formID] = form;
}
}
g_artifactFormTypes.insert(RE::FormType::Misc);
for (const auto& form : dataHandler->GetFormArray<RE::TESObjectMISC>()) {
if (form->GetPlayable() && !form->IsDeleted() && (form->GetNumKeywords() == 0 || (!bKID && form->HasKeyword(extraArtifactKeyword)) || (bKID && (!form->HasKeyword(notArtifactKeyword) || form->HasKeyword(extraArtifactKeyword)))) && strlen(form->GetName()) > 0) {
if (form->GetPlayable() && (form->GetNumKeywords() == 0 || (!bKID && form->HasKeyword(extraArtifactKeyword)) || (bKID && (!form->HasKeyword(notArtifactKeyword) || form->HasKeyword(extraArtifactKeyword)))) && strlen(form->GetName()) > 0) {
g_artifactMap[form->formID] = form;
}
}
@ -99,21 +99,21 @@ namespace ArtifactTracker
g_artifactMap.erase(0xF); // Gold
for (const auto& form : dataHandler->GetFormArray<RE::AlchemyItem>()) {
if (!form->IsDeleted() && form->HasKeyword(extraArtifactKeyword) && !form->HasKeyword(notArtifactKeyword)) {
if (form->HasKeyword(extraArtifactKeyword) && !form->HasKeyword(notArtifactKeyword)) {
g_artifactMap[form->formID] = form;
g_artifactFormTypes.insert(RE::FormType::AlchemyItem);
}
}
for (const auto& form : dataHandler->GetFormArray<RE::IngredientItem>()) {
if (!form->IsDeleted() && form->HasKeyword(extraArtifactKeyword) && !form->HasKeyword(notArtifactKeyword)) {
if (form->HasKeyword(extraArtifactKeyword) && !form->HasKeyword(notArtifactKeyword)) {
g_artifactMap[form->formID] = form;
g_artifactFormTypes.insert(RE::FormType::Ingredient);
}
}
for (const auto& form : dataHandler->GetFormArray<RE::TESSoulGem>()) {
if (!form->IsDeleted() && form->HasKeyword(extraArtifactKeyword) && !form->HasKeyword(notArtifactKeyword)) {
if (form->HasKeyword(extraArtifactKeyword) && !form->HasKeyword(notArtifactKeyword)) {
g_artifactMap[form->formID] = form;
g_artifactFormTypes.insert(RE::FormType::SoulGem);
}

@ -177,4 +177,14 @@ inline void LoadINI(std::map<std::string, bool>* settings, const char* iniPath)
} catch (const std::exception& e) {
SKSE::log::error(e.what());
}
}
inline void RunBenchmark(std::function<void()> benchmark, std::string desc)
{
const auto start = std::chrono::high_resolution_clock::now();
benchmark();
const auto end = std::chrono::high_resolution_clock::now();
const auto elapsed = std::chrono::duration<double>(end - start);
SKSE::log::info("{}: Elapsed time: {} seconds", desc, elapsed.count());
}
Loading…
Cancel
Save