fix(preconditions): a precondition of an unknown type fails

LWOPreconditionComponent::CheckPrecondition fails a type it does
not know and logs it; the server passed it. No row of the table has one, so
nothing changes for the shipped data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-11 07:10:16 -06:00
parent 85975b753e
commit 01fee0d2fc
2 changed files with 9 additions and 1 deletions

View File

@@ -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<int32_t>(type));
return false;
}
}

View File

@@ -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<PreconditionType>(99), "1", 1, 255)));
}