Fix cached plugin CRCs failing checksum conditions

If a plugin's CRC value was cached, it would cause any condition that
checks it to evaluate to false. This wouldn't occur when LOOT is
launched, but could have caused messages to disappear if the masterlist
was re-evaluated after sorting.
This commit is contained in:
Oliver Hamlet
2016-08-24 07:48:34 +01:00
parent 96bd4479a5
commit 69a71d0c8e
2 changed files with 15 additions and 2 deletions
@@ -135,8 +135,6 @@ bool ConditionEvaluator::checksumMatches(const std::string& filePath, const uint
realChecksum = GetCrc32(game_->DataPath() / filePath);
else if ((boost::iends_with(filePath, ".esp") || boost::iends_with(filePath, ".esm")) && boost::filesystem::exists(game_->DataPath() / (filePath + ".ghost")))
realChecksum = GetCrc32(game_->DataPath() / (filePath + ".ghost"));
} else {
return false;
}
}
@@ -247,6 +247,21 @@ TEST_P(ConditionGrammarTest, aChecksumConditionWithACrcThatMatchesTheActualPlugi
EXPECT_TRUE(result_);
}
TEST_P(ConditionGrammarTest, aChecksumConditionWithACrcThatMatchesTheActualCachedPluginCrcShouldEvaluateToTrue) {
ASSERT_NO_THROW(game_.LoadAllInstalledPlugins(false));
Grammar grammar(&game_);
std::string condition("checksum(\"" + blankEsm + "\", " + IntToHexString(blankEsmCrc) + ")");
success_ = boost::spirit::qi::phrase_parse(std::cbegin(condition),
std::cend(condition),
grammar,
skipper_,
result_);
EXPECT_TRUE(success_);
EXPECT_TRUE(result_);
}
TEST_P(ConditionGrammarTest, aChecksumConditionWithACrcThatDoesNotMatchTheActualPluginCrcShouldEvaluateToFalse) {
Grammar grammar(&game_);
std::string condition("checksum(\"" + blankEsm + "\", DEADBEEF)");