chore: Change entity and component logic to use bitstream references (#1468)

* chore: Change entity and component logic to use bitstream references

* merge
This commit is contained in:
jadebenn
2024-02-27 01:25:44 -06:00
committed by GitHub
parent 75544e3eec
commit b261e63233
190 changed files with 915 additions and 915 deletions

View File

@@ -10,14 +10,14 @@
#include "eReplicaComponentType.h"
void StunBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
void StunBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
if (this->m_stunCaster || branch.target == context->originator) {
return;
}
bool blocked{};
if (!bitStream->Read(blocked)) {
LOG("Unable to read blocked from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
if (!bitStream.Read(blocked)) {
LOG("Unable to read blocked from bitStream, aborting Handle! %i", bitStream.GetNumberOfUnreadBits());
return;
};
@@ -42,7 +42,7 @@ void StunBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
combatAiComponent->Stun(branch.duration);
}
void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
if (this->m_stunCaster || branch.target == context->originator) {
auto* self = Game::entityManager->GetEntity(context->originator);
@@ -79,7 +79,7 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr
}
}
bitStream->Write(blocked);
bitStream.Write(blocked);
if (target == nullptr) {
LOG("Failed to find target (%llu)!", branch.target);