-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: LUP Exhibit component type and use delta compression on serializ…
…ation (#1365) * fix: component type and use delta compression on serialization * sorry jett, emo made me do it
- Loading branch information
1 parent
1595441
commit 1bdce83
Showing
2 changed files
with
19 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,24 @@ | ||
#include "LUPExhibitComponent.h" | ||
|
||
#include "EntityManager.h" | ||
|
||
LUPExhibitComponent::LUPExhibitComponent(Entity* parent) : Component(parent) { | ||
m_Exhibits = { 11121, 11295, 11423, 11979 }; | ||
|
||
m_ExhibitIndex = 0; | ||
|
||
m_Exhibit = m_Exhibits[m_ExhibitIndex]; | ||
|
||
|
||
} | ||
|
||
LUPExhibitComponent::~LUPExhibitComponent() { | ||
|
||
} | ||
|
||
void LUPExhibitComponent::Update(float deltaTime) { | ||
m_UpdateTimer += deltaTime; | ||
|
||
if (m_UpdateTimer > 20.0f) { | ||
NextExhibit(); | ||
|
||
NextLUPExhibit(); | ||
m_UpdateTimer = 0.0f; | ||
} | ||
} | ||
|
||
void LUPExhibitComponent::NextExhibit() { | ||
m_ExhibitIndex++; | ||
|
||
if (m_ExhibitIndex >= m_Exhibits.size()) { | ||
m_ExhibitIndex = 0; | ||
} | ||
|
||
m_Exhibit = m_Exhibits[m_ExhibitIndex]; | ||
|
||
void LUPExhibitComponent::NextLUPExhibit() { | ||
m_LUPExhibitIndex++; | ||
m_DirtyLUPExhibit = true; | ||
Game::entityManager->SerializeEntity(m_Parent); | ||
} | ||
|
||
void LUPExhibitComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) { | ||
outBitStream->Write1(); // Dirty flag? | ||
outBitStream->Write(m_Exhibit); | ||
outBitStream->Write(m_DirtyLUPExhibit); | ||
if (m_DirtyLUPExhibit) { | ||
outBitStream->Write(m_LUPExhibits[m_LUPExhibitIndex % m_LUPExhibits.size()]); | ||
if (!bIsInitialUpdate) m_DirtyLUPExhibit = false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters