Bitwise-based semver to int conversion

This commit is contained in:
Eddoursul 2025-08-10 20:58:55 +02:00
parent 2e978dde6d
commit 01d2b4cfd8
3 changed files with 13 additions and 4 deletions

View File

@ -8,7 +8,7 @@ Beware, spoilers ahead!
2.1.4 (TBD)
- Chinese Simplified localization revision by DaisyComment (no translation of lines added after 2.0.12.4 yet).
- Fixed a random crash, occurring in outskirts of Ark and on the Farmers Coast when guards are about to start a conversation scene and any of them is riding a horse.
- Fixed a random crash, occurring when guards on the outskirts of Ark or on the Farmers Coast are about to start a conversation scene and any of them is riding a horse.
- Fixed help messages (in the middle of the screen) sometimes getting stuck in an infinite savebaked loop.
- Dreamflower can be found without finishing The Secrets first.
- Dimension Rift might get stuck in an infinite effect+sound loop if player left the cell while it's active.

View File

@ -58,9 +58,8 @@ namespace Papyrus::PapyrusFunctions
inline std::uint32_t GetEnderalVersionInt(RE::StaticFunctionTag*)
{
const auto pluginVersion = SKSE::PluginDeclaration::GetSingleton()->GetVersion();
std::string versionStr = std::format("{}{}{}{}", pluginVersion.major(), pluginVersion.minor(), pluginVersion.patch(), pluginVersion.build());
return std::stoi(versionStr);
return SemVerToInt({ pluginVersion.major(), pluginVersion.minor(), pluginVersion.patch(), pluginVersion.build() });
}
inline RE::TESObjectREFR* GetCurrentContainer(RE::StaticFunctionTag*)

View File

@ -23,6 +23,16 @@ inline uint8_t NewGameCount(bool increment = false)
return g_NewGameStarted;
}
inline std::uint32_t SemVerToInt(std::vector<int> numbers)
{
if (numbers.size() < 4) {
logger::error("Invalid SemVerToInt argument");
return 0;
}
return (numbers[0] << 24) | (numbers[1] << 16) | (numbers[2] << 8) | numbers[3];
}
inline void CheckIncompatibleMods()
{
const auto pluginVersion = SKSE::PluginDeclaration::GetSingleton()->GetVersion();
@ -320,4 +330,4 @@ inline RE::BSFixedString StringToHex(RE::BSFixedString a_string)
}
return sstream.str();
}
}