mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-18 01:35:27 +00:00
fix: constructions keep pending changes of five more components
The level, forced movement, possessable, possessor and combat AI parts are each read behind a flag bit (LWOLevelProgressionComponent:: Deserialize 0x00c63bd0 and the others). DLU cleared their dirty flags when it wrote a construction, which goes only to the client the object came into range of, so a change waiting for the next update never reached the clients already watching: a level up, a mount or dismount, a rail ride. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
#include "Entity.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "ItemComponent.h"
|
||||
#include "LevelProgressionComponent.h"
|
||||
#include "PlayerForcedMovementComponent.h"
|
||||
#include "Item.h"
|
||||
#include "ModelComponent.h"
|
||||
#include "MovingPlatformComponent.h"
|
||||
@@ -338,6 +340,36 @@ TEST_F(ReplicaConstructionTest, PhantomPhysicsConstructionKeepsThePendingEffect)
|
||||
EXPECT_LE(again.GetNumberOfBitsUsed(), idle);
|
||||
}
|
||||
|
||||
// A construction goes to the one client the object came into range of. It must not use up a change the clients
|
||||
// already watching are still waiting for (the level, rail and billboard flags are each read behind a flag bit).
|
||||
TEST_F(ReplicaConstructionTest, AConstructionKeepsPendingLevelAndForcedMovementChanges) {
|
||||
Entity player(1152921506064087008, info);
|
||||
auto* const level = player.AddComponent<LevelProgressionComponent>(-1);
|
||||
auto* const forcedMovement = player.AddComponent<PlayerForcedMovementComponent>(-1);
|
||||
|
||||
level->SetLevel(7);
|
||||
forcedMovement->SetPlayerOnRail(true);
|
||||
RakNet::BitStream construction;
|
||||
level->Serialize(construction, true);
|
||||
forcedMovement->Serialize(construction, true);
|
||||
|
||||
RakNet::BitStream update;
|
||||
level->Serialize(update, false);
|
||||
forcedMovement->Serialize(update, false);
|
||||
RakNet::BitStream expected;
|
||||
expected.Write1();
|
||||
expected.Write<uint32_t>(7);
|
||||
expected.Write1();
|
||||
expected.Write1(); // on rail
|
||||
expected.Write0(); // show billboard
|
||||
ExpectSameBits(update, expected);
|
||||
|
||||
RakNet::BitStream again;
|
||||
level->Serialize(again, false);
|
||||
forcedMovement->Serialize(again, false);
|
||||
EXPECT_EQ(again.GetNumberOfBitsUsed(), 2u);
|
||||
}
|
||||
|
||||
// A guild change (docs/Guilds.md) is written once: the client reads guild id, a u8 length and 16-bit characters, and
|
||||
// redraws the name billboard every time it reads a name.
|
||||
TEST_F(ReplicaConstructionTest, CharacterGuildChangeIsWrittenOnce) {
|
||||
|
||||
Reference in New Issue
Block a user