mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Add GameInterface::IsLoadOrderAmbiguous()
It exposes libloadorder's lo_is_ambiguous() function.
This commit is contained in:
+1
-1
@@ -82,7 +82,7 @@ endif()
|
||||
|
||||
ExternalProject_Add(libloadorder
|
||||
PREFIX "external"
|
||||
URL "https://github.com/Ortham/libloadorder/archive/13.0.0.tar.gz"
|
||||
URL "https://github.com/Ortham/libloadorder/archive/13.1.0.tar.gz"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_IN_SOURCE 1
|
||||
BUILD_COMMAND cargo build --release --manifest-path ffi/Cargo.toml --target ${RUST_TARGET} &&
|
||||
|
||||
@@ -144,6 +144,17 @@ public:
|
||||
*/
|
||||
virtual void LoadCurrentLoadOrderState() = 0;
|
||||
|
||||
/**
|
||||
* @brief Check if the load order is ambiguous.
|
||||
* @details This checks that all plugins in the current load order state have
|
||||
* a well-defined position in the "on disk" state, and that all data
|
||||
* sources are consistent. If the load order is ambiguous, different
|
||||
* applications may read different load orders from the same source
|
||||
* data.
|
||||
* @returns True if the load order is ambiguous, false otherwise.
|
||||
*/
|
||||
virtual bool IsLoadOrderAmbiguous() const = 0;
|
||||
|
||||
/**
|
||||
* @brief Check if a plugin is active.
|
||||
* @param plugin
|
||||
|
||||
@@ -216,6 +216,10 @@ void Game::LoadCurrentLoadOrderState() {
|
||||
loadOrderHandler_.GetActivePlugins());
|
||||
}
|
||||
|
||||
bool Game::IsLoadOrderAmbiguous() const {
|
||||
return loadOrderHandler_.IsAmbiguous();
|
||||
}
|
||||
|
||||
bool Game::IsPluginActive(const std::string& pluginName) const {
|
||||
return loadOrderHandler_.IsPluginActive(pluginName);
|
||||
}
|
||||
|
||||
@@ -72,6 +72,8 @@ public:
|
||||
|
||||
void LoadCurrentLoadOrderState() override;
|
||||
|
||||
bool IsLoadOrderAmbiguous() const override;
|
||||
|
||||
bool IsPluginActive(const std::string& pluginName) const override;
|
||||
|
||||
std::vector<std::string> GetLoadOrder() const override;
|
||||
|
||||
@@ -96,6 +96,20 @@ void LoadOrderHandler::LoadCurrentState() {
|
||||
HandleError("load the current load order state", ret);
|
||||
}
|
||||
|
||||
bool LoadOrderHandler::IsAmbiguous() const {
|
||||
auto logger = getLogger();
|
||||
if (logger) {
|
||||
logger->trace("Checking if the load order is ambiguous.");
|
||||
}
|
||||
|
||||
bool result = false;
|
||||
const unsigned int ret = lo_is_ambiguous(gh_.get(), &result);
|
||||
|
||||
HandleError("check if the load order is ambiguous", ret);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool LoadOrderHandler::IsPluginActive(const std::string& pluginName) const {
|
||||
auto logger = getLogger();
|
||||
if (logger) {
|
||||
|
||||
@@ -43,6 +43,8 @@ public:
|
||||
|
||||
void LoadCurrentState();
|
||||
|
||||
bool IsAmbiguous() const;
|
||||
|
||||
std::vector<std::string> GetLoadOrder() const;
|
||||
|
||||
std::vector<std::string> GetActivePlugins() const;
|
||||
|
||||
@@ -135,6 +135,13 @@ TEST_P(LoadOrderHandlerTest,
|
||||
LoadOrderHandler(GetParam(), dataPath.parent_path(), localPath));
|
||||
}
|
||||
|
||||
TEST_P(LoadOrderHandlerTest,
|
||||
isAmbiguousShouldReturnFalseForAnUnambiguousLoadOrder) {
|
||||
auto loadOrderHandler = createHandler();
|
||||
|
||||
EXPECT_FALSE(loadOrderHandler.IsAmbiguous());
|
||||
}
|
||||
|
||||
TEST_P(LoadOrderHandlerTest,
|
||||
isPluginActiveShouldReturnFalseIfLoadOrderStateHasNotBeenLoaded) {
|
||||
auto loadOrderHandler = createHandler();
|
||||
|
||||
Reference in New Issue
Block a user