1

Compare commits

..

2 Commits

Author SHA1 Message Date
ef0ce50833 Removed persistent cells 2023-09-09 23:02:35 +02:00
2ae83c9b7c Updated to CommonLibSSE-NG 3.7 2023-09-09 22:33:58 +02:00
5 changed files with 7 additions and 30 deletions

Binary file not shown.

Binary file not shown.

View File

@ -22,8 +22,6 @@ namespace ArtifactTracker
RE::BGSListForm* g_listStored; RE::BGSListForm* g_listStored;
RE::BGSListForm* g_listFound; RE::BGSListForm* g_listFound;
RE::BGSListForm* g_persistentStorage; RE::BGSListForm* g_persistentStorage;
RE::BGSListForm* g_persistentCells;
RE::BGSListForm* g_persistentCellStorageList;
RE::BGSKeyword* g_homeKeyword; RE::BGSKeyword* g_homeKeyword;
std::unordered_map<RE::FormID, RE::TESForm*> g_artifactMap; std::unordered_map<RE::FormID, RE::TESForm*> g_artifactMap;
std::unordered_set<RE::FormType> g_artifactFormTypes; std::unordered_set<RE::FormType> g_artifactFormTypes;
@ -54,8 +52,6 @@ namespace ArtifactTracker
g_listStored = dataHandler->LookupForm<RE::BGSListForm>(0x801, "Artifact Tracker.esp"); // ETR_ItemsStored g_listStored = dataHandler->LookupForm<RE::BGSListForm>(0x801, "Artifact Tracker.esp"); // ETR_ItemsStored
g_listFound = dataHandler->LookupForm<RE::BGSListForm>(0x802, "Artifact Tracker.esp"); // ETR_ItemsFound g_listFound = dataHandler->LookupForm<RE::BGSListForm>(0x802, "Artifact Tracker.esp"); // ETR_ItemsFound
g_persistentStorage = dataHandler->LookupForm<RE::BGSListForm>(0x803, "Artifact Tracker.esp"); // ETR_PersistentStorageList g_persistentStorage = dataHandler->LookupForm<RE::BGSListForm>(0x803, "Artifact Tracker.esp"); // ETR_PersistentStorageList
g_persistentCells = dataHandler->LookupForm<RE::BGSListForm>(0x805, "Artifact Tracker.esp"); // ETR_PersistentCellList
g_persistentCellStorageList = dataHandler->LookupForm<RE::BGSListForm>(0x806, "Artifact Tracker.esp"); // ETR_PersistentCellStorageList
g_homeKeyword = dataHandler->LookupForm<RE::BGSKeyword>(0xFC1A3, "Skyrim.esm"); // LocTypePlayerHouse g_homeKeyword = dataHandler->LookupForm<RE::BGSKeyword>(0xFC1A3, "Skyrim.esm"); // LocTypePlayerHouse
@ -63,7 +59,7 @@ namespace ArtifactTracker
const auto notArtifactKeyword = dataHandler->LookupForm<RE::BGSKeyword>(0xAFC111, "Update.esm"); // ETR_NotArtifact const auto notArtifactKeyword = dataHandler->LookupForm<RE::BGSKeyword>(0xAFC111, "Update.esm"); // ETR_NotArtifact
const auto npcRaceKeyword = dataHandler->LookupForm<RE::BGSKeyword>(0x13794, "Skyrim.esm"); // ActorTypeNPC const auto npcRaceKeyword = dataHandler->LookupForm<RE::BGSKeyword>(0x13794, "Skyrim.esm"); // ActorTypeNPC
if (!g_cellContainer || !g_listNew || !g_listStored || !g_listFound || !g_persistentStorage || !g_persistentCells || !g_persistentCellStorageList || !g_homeKeyword || !extraArtifactKeyword || !notArtifactKeyword || !npcRaceKeyword) { if (!g_cellContainer || !g_listNew || !g_listStored || !g_listFound || !g_persistentStorage || !g_homeKeyword || !extraArtifactKeyword || !notArtifactKeyword || !npcRaceKeyword) {
log::warn("Unable to load data from Artifact Tracker.esp"); log::warn("Unable to load data from Artifact Tracker.esp");
RE::DebugMessageBox("Unable to load data from Artifact Tracker.esp, the mod is disabled."); RE::DebugMessageBox("Unable to load data from Artifact Tracker.esp, the mod is disabled.");
return false; return false;
@ -210,26 +206,6 @@ namespace ArtifactTracker
return RE::BSContainer::ForEachResult::kContinue; return RE::BSContainer::ForEachResult::kContinue;
}); });
const auto parentCell = RE::PlayerCharacter::GetSingleton()->GetParentCell();
ListRevert(g_persistentCellStorageList);
g_persistentCells->ForEachForm([&](RE::TESForm& a_exform) {
if (&a_exform) {
const auto cell = a_exform.As<RE::TESObjectCELL>();
if (cell && cell != parentCell) {
cell->ForEachReference([&parentCell](RE::TESObjectREFR& a_ref) {
if (&a_ref && (a_ref.formFlags & RE::TESObjectREFR::RecordFlags::kPersistent) != 0 && a_ref.GetBaseObject()->Is(RE::FormType::Container)) {
//RE::DebugNotification(a_ref.GetBaseObject()->GetName());
g_persistentMap[a_ref.formID] = &a_ref;
g_persistentCellStorageList->AddForm(&a_ref);
}
return RE::BSContainer::ForEachResult::kContinue;
});
}
}
return RE::BSContainer::ForEachResult::kContinue;
});
std::uint32_t savedCount = g_listStored->forms.size() + g_listFound->forms.size() + g_listNew->forms.size(); std::uint32_t savedCount = g_listStored->forms.size() + g_listFound->forms.size() + g_listNew->forms.size();
if (savedCount != g_artifactMap.size()) { if (savedCount != g_artifactMap.size()) {
ListRevert(g_listNew); ListRevert(g_listNew);
@ -387,7 +363,7 @@ namespace ArtifactTracker
RE::TESObjectCELL* cell = RE::TESForm::LookupByID<RE::TESObjectCELL>(a_formID); RE::TESObjectCELL* cell = RE::TESForm::LookupByID<RE::TESObjectCELL>(a_formID);
RE::BGSLocation* location = cell ? cell->GetLocation() : nullptr; RE::BGSLocation* location = cell ? cell->GetLocation() : nullptr;
if (!cell || !location || !cell->IsInteriorCell() || !location->HasKeyword(g_homeKeyword) || g_persistentCells->HasForm(cell)) { if (!cell || !location || !cell->IsInteriorCell() || !location->HasKeyword(g_homeKeyword)) {
if (IsHome()) { if (IsHome()) {
RE::ScriptEventSourceHolder::GetSingleton()->RemoveEventSink<RE::TESCellFullyLoadedEvent>(EventListener::GetSingleton()); RE::ScriptEventSourceHolder::GetSingleton()->RemoveEventSink<RE::TESCellFullyLoadedEvent>(EventListener::GetSingleton());
ToggleHomeMode(nullptr); ToggleHomeMode(nullptr);
@ -433,7 +409,7 @@ namespace ArtifactTracker
return; return;
} }
if (!location || !cell->IsInteriorCell() || cell != RE::PlayerCharacter::GetSingleton()->GetParentCell() || !location->HasKeyword(g_homeKeyword) || g_persistentCells->HasForm(cell)) { if (!location || !cell->IsInteriorCell() || cell != RE::PlayerCharacter::GetSingleton()->GetParentCell() || !location->HasKeyword(g_homeKeyword)) {
ToggleHomeMode(nullptr); ToggleHomeMode(nullptr);
return; return;
} }
@ -575,7 +551,7 @@ namespace ArtifactTracker
if (count > 0 && !cellItems.contains(item->formID)) { if (count > 0 && !cellItems.contains(item->formID)) {
g_cellStorage->RemoveItem(item, count, RE::ITEM_REMOVE_REASON::kRemove, nullptr, nullptr); g_cellStorage->RemoveItem(item, count, RE::ITEM_REMOVE_REASON::kRemove, nullptr, nullptr);
if (IsArtifact(item) && !RefListHasItem(g_persistentStorage, item->formID) && !RefListHasItem(g_persistentCellStorageList, item->formID)) { if (IsArtifact(item) && !RefListHasItem(g_persistentStorage, item->formID)) {
ListRemoveItem(g_listStored, item); ListRemoveItem(g_listStored, item);
if (GetItemCount(RE::PlayerCharacter::GetSingleton(), item) || FollowersHaveItem(item)) { if (GetItemCount(RE::PlayerCharacter::GetSingleton(), item) || FollowersHaveItem(item)) {
ListRemoveItem(g_listNew, item); ListRemoveItem(g_listNew, item);
@ -851,7 +827,6 @@ namespace ArtifactTracker
{ {
ListRevert(g_listStored); ListRevert(g_listStored);
AddRefArtifactsToList(g_persistentStorage, g_listStored); AddRefArtifactsToList(g_persistentStorage, g_listStored);
AddRefArtifactsToList(g_persistentCellStorageList, g_listStored);
} }
void RescanNewArtifacts() void RescanNewArtifacts()

View File

@ -182,6 +182,7 @@ inline void LoadINI(std::map<std::string, bool>* settings, const char* iniPath)
} }
} }
/*
inline void RunBenchmark(std::function<void()> benchmark, std::string desc) inline void RunBenchmark(std::function<void()> benchmark, std::string desc)
{ {
const auto start = std::chrono::high_resolution_clock::now(); const auto start = std::chrono::high_resolution_clock::now();
@ -191,6 +192,7 @@ inline void RunBenchmark(std::function<void()> benchmark, std::string desc)
const auto elapsed = std::chrono::duration<double>(end - start); const auto elapsed = std::chrono::duration<double>(end - start);
log::info("{}: Elapsed time: {} seconds", desc, elapsed.count()); log::info("{}: Elapsed time: {} seconds", desc, elapsed.count());
} }
*/
inline std::vector<RE::Actor*> GetPlayerFollowers() inline std::vector<RE::Actor*> GetPlayerFollowers()
{ {

View File

@ -3,7 +3,7 @@
{ {
"kind": "git", "kind": "git",
"repository": "https://gitlab.com/colorglass/vcpkg-colorglass", "repository": "https://gitlab.com/colorglass/vcpkg-colorglass",
"baseline": "6fb127f7d425ae3cf3fab0f79005d907c885c0d8", "baseline": "6309841a1ce770409708a67a9ba5c26c537d2937",
"packages": [ "packages": [
"commonlibsse-ng", "commonlibsse-ng",
"gluino", "gluino",