diff --git a/dGame/dUtilities/Preconditions.cpp b/dGame/dUtilities/Preconditions.cpp index a11cd3734..dbfabdf71 100644 --- a/dGame/dUtilities/Preconditions.cpp +++ b/dGame/dUtilities/Preconditions.cpp @@ -213,7 +213,10 @@ bool Precondition::CheckValue(Entity* player, const uint32_t value) const { case PreconditionType::DoesNotHaveFlag: return !character->GetPlayerFlag(value); default: - return true; // There are a couple more unknown preconditions. Always return true in this case. + // LWOPreconditionComponent::CheckPrecondition fails a type it does not know, and logs it. No row of + // the table has one. + LOG("Precondition with unknown type %i", static_cast(type)); + return false; } } diff --git a/tests/dGameTests/PreconditionCheckTests.cpp b/tests/dGameTests/PreconditionCheckTests.cpp index 76a68e235..ebe5b85c6 100644 --- a/tests/dGameTests/PreconditionCheckTests.cpp +++ b/tests/dGameTests/PreconditionCheckTests.cpp @@ -153,3 +153,8 @@ TEST_F(PreconditionCheckTests, VendorBuyChecksTheItemsRequirementsInItsContext) EXPECT_TRUE(BaseVendorComponent::MeetsBuyRequirements(*player, std::to_string(level))); EXPECT_TRUE(BaseVendorComponent::MeetsBuyRequirements(*player, std::to_string(notAtVendors) + ";" + std::to_string(everywhere))); } + +// A type the client does not know fails +TEST_F(PreconditionCheckTests, AnUnknownTypeFails) { + EXPECT_FALSE(Preconditions::Check(player.get(), Row(static_cast(99), "1", 1, 255))); +}