|
|
|
@ -2,6 +2,9 @@ |
|
|
|
|
|
|
|
|
|
#include <SimpleIni.h> |
|
|
|
|
|
|
|
|
|
using namespace SKSE; |
|
|
|
|
using namespace SKSE::log; |
|
|
|
|
|
|
|
|
|
inline void ListRemoveItem(RE::BGSListForm* a_List, RE::TESForm* a_form) |
|
|
|
|
{ |
|
|
|
|
using func_t = decltype(&ListRemoveItem); |
|
|
|
@ -83,7 +86,7 @@ inline std::int32_t GetItemCount(RE::TESObjectREFR* a_container, RE::FormID a_fo |
|
|
|
|
inline bool RefListHasItem(RE::TESForm* a_refOrList, RE::FormID a_formID) |
|
|
|
|
{ |
|
|
|
|
if (!a_refOrList || !a_formID) { |
|
|
|
|
SKSE::log::warn("Invalid arguments in RefHasItem"); |
|
|
|
|
log::warn("Invalid arguments in RefListHasItem"); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -135,11 +138,11 @@ inline bool IsInSameCell(RE::TESObjectREFR* ref) |
|
|
|
|
inline void LoadINI(std::map<std::string, bool>* settings, const char* iniPath) |
|
|
|
|
{ |
|
|
|
|
for (auto it = settings->begin(); it != settings->end(); it++) { |
|
|
|
|
SKSE::log::info("[DEFAULT] {} = {}", it->first, it->second); |
|
|
|
|
log::info("[DEFAULT] {} = {}", it->first, it->second); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!std::filesystem::exists(iniPath)) { |
|
|
|
|
SKSE::log::warn("{} does not exist, using default values.", iniPath); |
|
|
|
|
log::warn("{} does not exist, using default values.", iniPath); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -158,7 +161,7 @@ inline void LoadINI(std::map<std::string, bool>* settings, const char* iniPath) |
|
|
|
|
for (const auto& k : keysList) { |
|
|
|
|
if (it->first == k.pItem) { |
|
|
|
|
settings->insert_or_assign(k.pItem, ini.GetBoolValue("", k.pItem, settings->at(k.pItem))); |
|
|
|
|
SKSE::log::info("[INI] {} = {}", k.pItem, settings->at(k.pItem)); |
|
|
|
|
log::info("[INI] {} = {}", k.pItem, settings->at(k.pItem)); |
|
|
|
|
bExists = true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
@ -170,12 +173,12 @@ inline void LoadINI(std::map<std::string, bool>* settings, const char* iniPath) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (bUpdateINI) { |
|
|
|
|
SKSE::log::info("New settings detected, adding to ArtifactTracker.ini"); |
|
|
|
|
log::info("New settings detected, adding to ArtifactTracker.ini"); |
|
|
|
|
ini.SaveFile(iniPath); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} catch (const std::exception& e) { |
|
|
|
|
SKSE::log::error(e.what()); |
|
|
|
|
log::error(e.what()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -186,7 +189,7 @@ inline void RunBenchmark(std::function<void()> benchmark, std::string desc) |
|
|
|
|
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()); |
|
|
|
|
log::info("{}: Elapsed time: {} seconds", desc, elapsed.count()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inline std::vector<RE::Actor*> GetPlayerFollowers() |
|
|
|
|