mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-10 02:08:20 +00:00
Address quickbuilds being unbuildable
Address an issue where quickbuilds would become unbuildable. The main issue lied within serializing parent/child info too often for some reason / serializing it when the info wasnt dirty. Only serializing this info when it is actually dirty and has changed has addressed the issue and allows quickbuilds to never break.
This commit is contained in:
parent
4556faf833
commit
8bdd5b6e2c
@ -79,6 +79,7 @@ Entity::Entity(const LWOOBJID& objectID, EntityInfo info, Entity* parentEntity)
|
||||
m_Components = {};
|
||||
m_DieCallbacks = {};
|
||||
m_PhantomCollisionCallbacks = {};
|
||||
m_IsParentChildDirty = true;
|
||||
|
||||
m_Settings = info.settings;
|
||||
m_NetworkSettings = info.networkSettings;
|
||||
@ -974,8 +975,9 @@ void Entity::WriteBaseReplicaData(RakNet::BitStream* outBitStream, eReplicaPacke
|
||||
}
|
||||
else outBitStream->Write0(); //No GM Level
|
||||
}
|
||||
outBitStream->Write((m_ParentEntity != nullptr || m_ChildEntities.size() > 0));
|
||||
if (m_ParentEntity || m_ChildEntities.size() > 0) {
|
||||
outBitStream->Write((m_ParentEntity != nullptr || m_ChildEntities.size() > 0) && (m_IsParentChildDirty || packetType == PACKET_TYPE_CONSTRUCTION));
|
||||
if ((m_ParentEntity != nullptr || m_ChildEntities.size() > 0) && (m_IsParentChildDirty || packetType == PACKET_TYPE_CONSTRUCTION)) {
|
||||
m_IsParentChildDirty = false;
|
||||
outBitStream->Write(m_ParentEntity != nullptr);
|
||||
if (m_ParentEntity) {
|
||||
outBitStream->Write(m_ParentEntity->GetObjectID());
|
||||
@ -1661,6 +1663,7 @@ void Entity::RegisterCoinDrop(uint64_t count) {
|
||||
}
|
||||
|
||||
void Entity::AddChild(Entity* child) {
|
||||
m_IsParentChildDirty = true;
|
||||
m_ChildEntities.push_back(child);
|
||||
}
|
||||
|
||||
|
@ -322,6 +322,8 @@ protected:
|
||||
|
||||
int8_t m_Observers = 0;
|
||||
|
||||
bool m_IsParentChildDirty = true;
|
||||
|
||||
/*
|
||||
* Collision
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user