mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user