mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-30 01:41:40 +00:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user