mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-21 21:17:25 +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:
parent
75544e3eec
commit
b261e63233
@ -899,34 +899,34 @@ void Entity::SetGMLevel(eGameMasterLevel value) {
|
||||
}
|
||||
}
|
||||
|
||||
void Entity::WriteBaseReplicaData(RakNet::BitStream* outBitStream, eReplicaPacketType packetType) {
|
||||
void Entity::WriteBaseReplicaData(RakNet::BitStream& outBitStream, eReplicaPacketType packetType) {
|
||||
if (packetType == eReplicaPacketType::CONSTRUCTION) {
|
||||
outBitStream->Write(m_ObjectID);
|
||||
outBitStream->Write(m_TemplateID);
|
||||
outBitStream.Write(m_ObjectID);
|
||||
outBitStream.Write(m_TemplateID);
|
||||
|
||||
if (IsPlayer()) {
|
||||
std::string name = m_Character != nullptr ? m_Character->GetName() : "Invalid";
|
||||
outBitStream->Write<uint8_t>(uint8_t(name.size()));
|
||||
outBitStream.Write<uint8_t>(uint8_t(name.size()));
|
||||
|
||||
for (size_t i = 0; i < name.size(); ++i) {
|
||||
outBitStream->Write<uint16_t>(name[i]);
|
||||
outBitStream.Write<uint16_t>(name[i]);
|
||||
}
|
||||
} else {
|
||||
const auto& name = GetVar<std::string>(u"npcName");
|
||||
outBitStream->Write<uint8_t>(uint8_t(name.size()));
|
||||
outBitStream.Write<uint8_t>(uint8_t(name.size()));
|
||||
|
||||
for (size_t i = 0; i < name.size(); ++i) {
|
||||
outBitStream->Write<uint16_t>(name[i]);
|
||||
outBitStream.Write<uint16_t>(name[i]);
|
||||
}
|
||||
}
|
||||
|
||||
outBitStream->Write<uint32_t>(0); //Time since created on server
|
||||
outBitStream.Write<uint32_t>(0); //Time since created on server
|
||||
|
||||
const auto& syncLDF = GetVar<std::vector<std::u16string>>(u"syncLDF");
|
||||
|
||||
// Only sync for models.
|
||||
if (m_Settings.size() > 0 && (GetComponent<ModelComponent>() && !GetComponent<PetComponent>())) {
|
||||
outBitStream->Write1(); //ldf data
|
||||
outBitStream.Write1(); //ldf data
|
||||
|
||||
RakNet::BitStream settingStream;
|
||||
int32_t numberOfValidKeys = m_Settings.size();
|
||||
@ -947,9 +947,9 @@ void Entity::WriteBaseReplicaData(RakNet::BitStream* outBitStream, eReplicaPacke
|
||||
}
|
||||
}
|
||||
|
||||
outBitStream->Write(settingStream.GetNumberOfBytesUsed() + 1);
|
||||
outBitStream->Write<uint8_t>(0); //no compression used
|
||||
outBitStream->Write(settingStream);
|
||||
outBitStream.Write(settingStream.GetNumberOfBytesUsed() + 1);
|
||||
outBitStream.Write<uint8_t>(0); //no compression used
|
||||
outBitStream.Write(settingStream);
|
||||
} else if (!syncLDF.empty()) {
|
||||
std::vector<LDFBaseData*> ldfData;
|
||||
|
||||
@ -957,7 +957,7 @@ void Entity::WriteBaseReplicaData(RakNet::BitStream* outBitStream, eReplicaPacke
|
||||
ldfData.push_back(GetVarData(data));
|
||||
}
|
||||
|
||||
outBitStream->Write1(); //ldf data
|
||||
outBitStream.Write1(); //ldf data
|
||||
|
||||
RakNet::BitStream settingStream;
|
||||
settingStream.Write<uint32_t>(ldfData.size());
|
||||
@ -967,69 +967,69 @@ void Entity::WriteBaseReplicaData(RakNet::BitStream* outBitStream, eReplicaPacke
|
||||
}
|
||||
}
|
||||
|
||||
outBitStream->Write(settingStream.GetNumberOfBytesUsed() + 1);
|
||||
outBitStream->Write<uint8_t>(0); //no compression used
|
||||
outBitStream->Write(settingStream);
|
||||
outBitStream.Write(settingStream.GetNumberOfBytesUsed() + 1);
|
||||
outBitStream.Write<uint8_t>(0); //no compression used
|
||||
outBitStream.Write(settingStream);
|
||||
} else {
|
||||
outBitStream->Write0(); //No ldf data
|
||||
outBitStream.Write0(); //No ldf data
|
||||
}
|
||||
|
||||
TriggerComponent* triggerComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::TRIGGER, triggerComponent)) {
|
||||
// has trigger component, check to see if we have events to handle
|
||||
auto* trigger = triggerComponent->GetTrigger();
|
||||
outBitStream->Write<bool>(trigger && trigger->events.size() > 0);
|
||||
outBitStream.Write<bool>(trigger && trigger->events.size() > 0);
|
||||
} else { // no trigger componenet, so definitely no triggers
|
||||
outBitStream->Write0();
|
||||
outBitStream.Write0();
|
||||
}
|
||||
|
||||
|
||||
if (m_ParentEntity != nullptr || m_SpawnerID != 0) {
|
||||
outBitStream->Write1();
|
||||
if (m_ParentEntity != nullptr) outBitStream->Write(GeneralUtils::SetBit(m_ParentEntity->GetObjectID(), static_cast<uint32_t>(eObjectBits::CLIENT)));
|
||||
else if (m_Spawner != nullptr && m_Spawner->m_Info.isNetwork) outBitStream->Write(m_SpawnerID);
|
||||
else outBitStream->Write(GeneralUtils::SetBit(m_SpawnerID, static_cast<uint32_t>(eObjectBits::CLIENT)));
|
||||
} else outBitStream->Write0();
|
||||
outBitStream.Write1();
|
||||
if (m_ParentEntity != nullptr) outBitStream.Write(GeneralUtils::SetBit(m_ParentEntity->GetObjectID(), static_cast<uint32_t>(eObjectBits::CLIENT)));
|
||||
else if (m_Spawner != nullptr && m_Spawner->m_Info.isNetwork) outBitStream.Write(m_SpawnerID);
|
||||
else outBitStream.Write(GeneralUtils::SetBit(m_SpawnerID, static_cast<uint32_t>(eObjectBits::CLIENT)));
|
||||
} else outBitStream.Write0();
|
||||
|
||||
outBitStream->Write(m_HasSpawnerNodeID);
|
||||
if (m_HasSpawnerNodeID) outBitStream->Write(m_SpawnerNodeID);
|
||||
outBitStream.Write(m_HasSpawnerNodeID);
|
||||
if (m_HasSpawnerNodeID) outBitStream.Write(m_SpawnerNodeID);
|
||||
|
||||
//outBitStream->Write0(); //Spawner node id
|
||||
//outBitStream.Write0(); //Spawner node id
|
||||
|
||||
if (m_Scale == 1.0f || m_Scale == 0.0f) outBitStream->Write0();
|
||||
if (m_Scale == 1.0f || m_Scale == 0.0f) outBitStream.Write0();
|
||||
else {
|
||||
outBitStream->Write1();
|
||||
outBitStream->Write(m_Scale);
|
||||
outBitStream.Write1();
|
||||
outBitStream.Write(m_Scale);
|
||||
}
|
||||
|
||||
outBitStream->Write0(); //ObjectWorldState
|
||||
outBitStream.Write0(); //ObjectWorldState
|
||||
|
||||
if (m_GMLevel != eGameMasterLevel::CIVILIAN) {
|
||||
outBitStream->Write1();
|
||||
outBitStream->Write(m_GMLevel);
|
||||
} else outBitStream->Write0(); //No GM Level
|
||||
outBitStream.Write1();
|
||||
outBitStream.Write(m_GMLevel);
|
||||
} else outBitStream.Write0(); //No GM Level
|
||||
}
|
||||
|
||||
// Only serialize parent / child info should the info be dirty (changed) or if this is the construction of the entity.
|
||||
outBitStream->Write(m_IsParentChildDirty || packetType == eReplicaPacketType::CONSTRUCTION);
|
||||
outBitStream.Write(m_IsParentChildDirty || packetType == eReplicaPacketType::CONSTRUCTION);
|
||||
if (m_IsParentChildDirty || packetType == eReplicaPacketType::CONSTRUCTION) {
|
||||
m_IsParentChildDirty = false;
|
||||
outBitStream->Write(m_ParentEntity != nullptr);
|
||||
outBitStream.Write(m_ParentEntity != nullptr);
|
||||
if (m_ParentEntity) {
|
||||
outBitStream->Write(m_ParentEntity->GetObjectID());
|
||||
outBitStream->Write0();
|
||||
outBitStream.Write(m_ParentEntity->GetObjectID());
|
||||
outBitStream.Write0();
|
||||
}
|
||||
outBitStream->Write(m_ChildEntities.size() > 0);
|
||||
outBitStream.Write(m_ChildEntities.size() > 0);
|
||||
if (m_ChildEntities.size() > 0) {
|
||||
outBitStream->Write<uint16_t>(m_ChildEntities.size());
|
||||
outBitStream.Write<uint16_t>(m_ChildEntities.size());
|
||||
for (Entity* child : m_ChildEntities) {
|
||||
outBitStream->Write<uint64_t>(child->GetObjectID());
|
||||
outBitStream.Write<uint64_t>(child->GetObjectID());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType packetType) {
|
||||
void Entity::WriteComponents(RakNet::BitStream& outBitStream, eReplicaPacketType packetType) {
|
||||
|
||||
/**
|
||||
* This has to be done in a specific order.
|
||||
@ -1117,7 +1117,7 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
||||
possessorComponent->Serialize(outBitStream, bIsInitialUpdate);
|
||||
} else {
|
||||
// Should never happen, but just to be safe
|
||||
outBitStream->Write0();
|
||||
outBitStream.Write0();
|
||||
}
|
||||
|
||||
LevelProgressionComponent* levelProgressionComponent;
|
||||
@ -1125,7 +1125,7 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
||||
levelProgressionComponent->Serialize(outBitStream, bIsInitialUpdate);
|
||||
} else {
|
||||
// Should never happen, but just to be safe
|
||||
outBitStream->Write0();
|
||||
outBitStream.Write0();
|
||||
}
|
||||
|
||||
PlayerForcedMovementComponent* playerForcedMovementComponent;
|
||||
@ -1133,7 +1133,7 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
||||
playerForcedMovementComponent->Serialize(outBitStream, bIsInitialUpdate);
|
||||
} else {
|
||||
// Should never happen, but just to be safe
|
||||
outBitStream->Write0();
|
||||
outBitStream.Write0();
|
||||
}
|
||||
|
||||
characterComponent->Serialize(outBitStream, bIsInitialUpdate);
|
||||
@ -1250,7 +1250,7 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
||||
// BBB Component, unused currently
|
||||
// Need to to write0 so that is serialized correctly
|
||||
// TODO: Implement BBB Component
|
||||
outBitStream->Write0();
|
||||
outBitStream.Write0();
|
||||
}
|
||||
|
||||
void Entity::UpdateXMLDoc(tinyxml2::XMLDocument* doc) {
|
||||
|
@ -171,8 +171,8 @@ public:
|
||||
|
||||
std::unordered_map<eReplicaComponentType, Component*>& GetComponents() { return m_Components; } // TODO: Remove
|
||||
|
||||
void WriteBaseReplicaData(RakNet::BitStream* outBitStream, eReplicaPacketType packetType);
|
||||
void WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType packetType);
|
||||
void WriteBaseReplicaData(RakNet::BitStream& outBitStream, eReplicaPacketType packetType);
|
||||
void WriteComponents(RakNet::BitStream& outBitStream, eReplicaPacketType packetType);
|
||||
void UpdateXMLDoc(tinyxml2::XMLDocument* doc);
|
||||
void Update(float deltaTime);
|
||||
|
||||
|
@ -178,8 +178,8 @@ void EntityManager::SerializeEntities() {
|
||||
stream.Write<char>(ID_REPLICA_MANAGER_SERIALIZE);
|
||||
stream.Write<unsigned short>(entity->GetNetworkId());
|
||||
|
||||
entity->WriteBaseReplicaData(&stream, eReplicaPacketType::SERIALIZATION);
|
||||
entity->WriteComponents(&stream, eReplicaPacketType::SERIALIZATION);
|
||||
entity->WriteBaseReplicaData(stream, eReplicaPacketType::SERIALIZATION);
|
||||
entity->WriteComponents(stream, eReplicaPacketType::SERIALIZATION);
|
||||
|
||||
if (entity->GetIsGhostingCandidate()) {
|
||||
for (auto* player : PlayerManager::GetAllPlayers()) {
|
||||
@ -359,8 +359,8 @@ void EntityManager::ConstructEntity(Entity* entity, const SystemAddress& sysAddr
|
||||
stream.Write(true);
|
||||
stream.Write<uint16_t>(entity->GetNetworkId());
|
||||
|
||||
entity->WriteBaseReplicaData(&stream, eReplicaPacketType::CONSTRUCTION);
|
||||
entity->WriteComponents(&stream, eReplicaPacketType::CONSTRUCTION);
|
||||
entity->WriteBaseReplicaData(stream, eReplicaPacketType::CONSTRUCTION);
|
||||
entity->WriteComponents(stream, eReplicaPacketType::CONSTRUCTION);
|
||||
|
||||
if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) {
|
||||
if (skipChecks) {
|
||||
|
@ -5,35 +5,35 @@
|
||||
#include "Game.h"
|
||||
#include "Logger.h"
|
||||
|
||||
void AirMovementBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void AirMovementBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
uint32_t handle{};
|
||||
|
||||
if (!bitStream->Read(handle)) {
|
||||
LOG("Unable to read handle from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||
if (!bitStream.Read(handle)) {
|
||||
LOG("Unable to read handle from bitStream, aborting Handle! %i", bitStream.GetNumberOfUnreadBits());
|
||||
return;
|
||||
}
|
||||
|
||||
context->RegisterSyncBehavior(handle, this, branch, this->m_Timeout);
|
||||
}
|
||||
|
||||
void AirMovementBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void AirMovementBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
const auto handle = context->GetUniqueSkillId();
|
||||
|
||||
bitStream->Write(handle);
|
||||
bitStream.Write(handle);
|
||||
}
|
||||
|
||||
void AirMovementBehavior::Sync(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void AirMovementBehavior::Sync(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
uint32_t behaviorId{};
|
||||
|
||||
if (!bitStream->Read(behaviorId)) {
|
||||
LOG("Unable to read behaviorId from bitStream, aborting Sync! %i", bitStream->GetNumberOfUnreadBits());
|
||||
if (!bitStream.Read(behaviorId)) {
|
||||
LOG("Unable to read behaviorId from bitStream, aborting Sync! %i", bitStream.GetNumberOfUnreadBits());
|
||||
return;
|
||||
}
|
||||
|
||||
LWOOBJID target{};
|
||||
|
||||
if (!bitStream->Read(target)) {
|
||||
LOG("Unable to read target from bitStream, aborting Sync! %i", bitStream->GetNumberOfUnreadBits());
|
||||
if (!bitStream.Read(target)) {
|
||||
LOG("Unable to read target from bitStream, aborting Sync! %i", bitStream.GetNumberOfUnreadBits());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -6,11 +6,11 @@ class AirMovementBehavior final : public Behavior
|
||||
public:
|
||||
explicit AirMovementBehavior(const uint32_t behavior_id) : Behavior(behavior_id) {}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Sync(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Sync(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
private:
|
||||
|
@ -3,13 +3,13 @@
|
||||
#include "Game.h"
|
||||
#include "Logger.h"
|
||||
|
||||
void AndBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
void AndBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
|
||||
for (auto* behavior : this->m_behaviors) {
|
||||
behavior->Handle(context, bitStream, branch);
|
||||
}
|
||||
}
|
||||
|
||||
void AndBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
void AndBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
|
||||
for (auto* behavior : this->m_behaviors) {
|
||||
behavior->Calculate(context, bitStream, branch);
|
||||
}
|
||||
|
@ -15,9 +15,9 @@ public:
|
||||
explicit AndBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void UnCast(BehaviorContext* context, BehaviorBranchContext branch) override;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "BuffComponent.h"
|
||||
|
||||
|
||||
void ApplyBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void ApplyBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
auto* entity = Game::entityManager->GetEntity(branch.target == LWOOBJID_EMPTY ? context->originator : branch.target);
|
||||
|
||||
if (entity == nullptr) return;
|
||||
@ -30,7 +30,7 @@ void ApplyBuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext b
|
||||
buffComponent->RemoveBuff(m_BuffId);
|
||||
}
|
||||
|
||||
void ApplyBuffBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void ApplyBuffBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
Handle(context, bitStream, branch);
|
||||
}
|
||||
|
||||
|
@ -24,11 +24,11 @@ public:
|
||||
explicit ApplyBuffBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void UnCast(BehaviorContext* context, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
private:
|
||||
|
@ -12,11 +12,11 @@
|
||||
#include "Game.h"
|
||||
#include "Logger.h"
|
||||
|
||||
void AreaOfEffectBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void AreaOfEffectBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
uint32_t targetCount{};
|
||||
|
||||
if (!bitStream->Read(targetCount)) {
|
||||
LOG("Unable to read targetCount from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||
if (!bitStream.Read(targetCount)) {
|
||||
LOG("Unable to read targetCount from bitStream, aborting Handle! %i", bitStream.GetNumberOfUnreadBits());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ void AreaOfEffectBehavior::Handle(BehaviorContext* context, RakNet::BitStream* b
|
||||
|
||||
for (auto i = 0u; i < targetCount; ++i) {
|
||||
LWOOBJID target{};
|
||||
if (!bitStream->Read(target)) {
|
||||
if (!bitStream.Read(target)) {
|
||||
LOG("failed to read in target %i from bitStream, aborting target Handle!", i);
|
||||
};
|
||||
targets.push_back(target);
|
||||
@ -54,7 +54,7 @@ void AreaOfEffectBehavior::Handle(BehaviorContext* context, RakNet::BitStream* b
|
||||
PlayFx(u"cast", context->originator);
|
||||
}
|
||||
|
||||
void AreaOfEffectBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void AreaOfEffectBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
auto* caster = Game::entityManager->GetEntity(context->caster);
|
||||
if (!caster) return;
|
||||
|
||||
@ -83,7 +83,7 @@ void AreaOfEffectBehavior::Calculate(BehaviorContext* context, RakNet::BitStream
|
||||
// resize if we have more than max targets allows
|
||||
if (targets.size() > this->m_maxTargets) targets.resize(this->m_maxTargets);
|
||||
|
||||
bitStream->Write<uint32_t>(targets.size());
|
||||
bitStream.Write<uint32_t>(targets.size());
|
||||
|
||||
if (targets.size() == 0) {
|
||||
PlayFx(u"miss", context->originator);
|
||||
@ -92,7 +92,7 @@ void AreaOfEffectBehavior::Calculate(BehaviorContext* context, RakNet::BitStream
|
||||
context->foundTarget = true;
|
||||
// write all the targets to the bitstream
|
||||
for (auto* target : targets) {
|
||||
bitStream->Write(target->GetObjectID());
|
||||
bitStream.Write(target->GetObjectID());
|
||||
}
|
||||
|
||||
// then cast all the actions
|
||||
|
@ -6,8 +6,8 @@ class AreaOfEffectBehavior final : public Behavior
|
||||
{
|
||||
public:
|
||||
explicit AreaOfEffectBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {}
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
void Load() override;
|
||||
private:
|
||||
Behavior* m_action;
|
||||
|
@ -4,11 +4,11 @@
|
||||
#include "Game.h"
|
||||
#include "Logger.h"
|
||||
|
||||
void AttackDelayBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
void AttackDelayBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
|
||||
uint32_t handle{};
|
||||
|
||||
if (!bitStream->Read(handle)) {
|
||||
LOG("Unable to read handle from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||
if (!bitStream.Read(handle)) {
|
||||
LOG("Unable to read handle from bitStream, aborting Handle! %i", bitStream.GetNumberOfUnreadBits());
|
||||
return;
|
||||
};
|
||||
|
||||
@ -17,10 +17,10 @@ void AttackDelayBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bi
|
||||
}
|
||||
}
|
||||
|
||||
void AttackDelayBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
void AttackDelayBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
|
||||
const auto handle = context->GetUniqueSkillId();
|
||||
|
||||
bitStream->Write(handle);
|
||||
bitStream.Write(handle);
|
||||
|
||||
context->foundTarget = true;
|
||||
|
||||
@ -31,11 +31,11 @@ void AttackDelayBehavior::Calculate(BehaviorContext* context, RakNet::BitStream*
|
||||
}
|
||||
}
|
||||
|
||||
void AttackDelayBehavior::Sync(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
void AttackDelayBehavior::Sync(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
|
||||
this->m_action->Handle(context, bitStream, branch);
|
||||
}
|
||||
|
||||
void AttackDelayBehavior::SyncCalculation(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
void AttackDelayBehavior::SyncCalculation(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
|
||||
PlayFx(u"cast", context->originator);
|
||||
|
||||
this->m_action->Calculate(context, bitStream, branch);
|
||||
|
@ -19,13 +19,13 @@ public:
|
||||
explicit AttackDelayBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Sync(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Sync(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void SyncCalculation(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void SyncCalculation(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "BehaviorContext.h"
|
||||
#include "eBasicAttackSuccessTypes.h"
|
||||
|
||||
void BasicAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void BasicAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
if (context->unmanaged) {
|
||||
auto* entity = Game::entityManager->GetEntity(branch.target);
|
||||
|
||||
@ -30,22 +30,22 @@ void BasicAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bi
|
||||
return;
|
||||
}
|
||||
|
||||
bitStream->AlignReadToByteBoundary();
|
||||
bitStream.AlignReadToByteBoundary();
|
||||
|
||||
uint16_t allocatedBits{};
|
||||
if (!bitStream->Read(allocatedBits) || allocatedBits == 0) {
|
||||
if (!bitStream.Read(allocatedBits) || allocatedBits == 0) {
|
||||
LOG_DEBUG("No allocated bits");
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG("Number of allocated bits %i", allocatedBits);
|
||||
const auto baseAddress = bitStream->GetReadOffset();
|
||||
const auto baseAddress = bitStream.GetReadOffset();
|
||||
|
||||
DoHandleBehavior(context, bitStream, branch);
|
||||
|
||||
bitStream->SetReadOffset(baseAddress + allocatedBits);
|
||||
bitStream.SetReadOffset(baseAddress + allocatedBits);
|
||||
}
|
||||
|
||||
void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
auto* targetEntity = Game::entityManager->GetEntity(branch.target);
|
||||
if (!targetEntity) {
|
||||
LOG("Target targetEntity %llu not found.", branch.target);
|
||||
@ -62,7 +62,7 @@ void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::Bit
|
||||
bool isImmune{};
|
||||
bool isSuccess{};
|
||||
|
||||
if (!bitStream->Read(isBlocked)) {
|
||||
if (!bitStream.Read(isBlocked)) {
|
||||
LOG("Unable to read isBlocked");
|
||||
return;
|
||||
}
|
||||
@ -74,7 +74,7 @@ void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::Bit
|
||||
return;
|
||||
}
|
||||
|
||||
if (!bitStream->Read(isImmune)) {
|
||||
if (!bitStream.Read(isImmune)) {
|
||||
LOG("Unable to read isImmune");
|
||||
return;
|
||||
}
|
||||
@ -85,20 +85,20 @@ void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::Bit
|
||||
return;
|
||||
}
|
||||
|
||||
if (!bitStream->Read(isSuccess)) {
|
||||
if (!bitStream.Read(isSuccess)) {
|
||||
LOG("failed to read success from bitstream");
|
||||
return;
|
||||
}
|
||||
|
||||
if (isSuccess) {
|
||||
uint32_t armorDamageDealt{};
|
||||
if (!bitStream->Read(armorDamageDealt)) {
|
||||
if (!bitStream.Read(armorDamageDealt)) {
|
||||
LOG("Unable to read armorDamageDealt");
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t healthDamageDealt{};
|
||||
if (!bitStream->Read(healthDamageDealt)) {
|
||||
if (!bitStream.Read(healthDamageDealt)) {
|
||||
LOG("Unable to read healthDamageDealt");
|
||||
return;
|
||||
}
|
||||
@ -111,7 +111,7 @@ void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::Bit
|
||||
}
|
||||
|
||||
bool died{};
|
||||
if (!bitStream->Read(died)) {
|
||||
if (!bitStream.Read(died)) {
|
||||
LOG("Unable to read died");
|
||||
return;
|
||||
}
|
||||
@ -122,7 +122,7 @@ void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::Bit
|
||||
}
|
||||
|
||||
uint8_t successState{};
|
||||
if (!bitStream->Read(successState)) {
|
||||
if (!bitStream.Read(successState)) {
|
||||
LOG("Unable to read success state");
|
||||
return;
|
||||
}
|
||||
@ -144,26 +144,26 @@ void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::Bit
|
||||
}
|
||||
}
|
||||
|
||||
void BasicAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
bitStream->AlignWriteToByteBoundary();
|
||||
void BasicAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
bitStream.AlignWriteToByteBoundary();
|
||||
|
||||
const auto allocatedAddress = bitStream->GetWriteOffset();
|
||||
const auto allocatedAddress = bitStream.GetWriteOffset();
|
||||
|
||||
bitStream->Write<uint16_t>(0);
|
||||
bitStream.Write<uint16_t>(0);
|
||||
|
||||
const auto startAddress = bitStream->GetWriteOffset();
|
||||
const auto startAddress = bitStream.GetWriteOffset();
|
||||
|
||||
DoBehaviorCalculation(context, bitStream, branch);
|
||||
|
||||
const auto endAddress = bitStream->GetWriteOffset();
|
||||
const auto endAddress = bitStream.GetWriteOffset();
|
||||
const uint16_t allocate = endAddress - startAddress;
|
||||
|
||||
bitStream->SetWriteOffset(allocatedAddress);
|
||||
bitStream->Write(allocate);
|
||||
bitStream->SetWriteOffset(startAddress + allocate);
|
||||
bitStream.SetWriteOffset(allocatedAddress);
|
||||
bitStream.Write(allocate);
|
||||
bitStream.SetWriteOffset(startAddress + allocate);
|
||||
}
|
||||
|
||||
void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
auto* targetEntity = Game::entityManager->GetEntity(branch.target);
|
||||
if (!targetEntity) {
|
||||
LOG("Target entity %llu is null!", branch.target);
|
||||
@ -178,7 +178,7 @@ void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet
|
||||
|
||||
const bool isBlocking = destroyableComponent->GetAttacksToBlock() > 0;
|
||||
|
||||
bitStream->Write(isBlocking);
|
||||
bitStream.Write(isBlocking);
|
||||
|
||||
if (isBlocking) {
|
||||
destroyableComponent->SetAttacksToBlock(destroyableComponent->GetAttacksToBlock() - 1);
|
||||
@ -188,7 +188,7 @@ void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet
|
||||
}
|
||||
|
||||
const bool isImmune = destroyableComponent->IsImmune() || destroyableComponent->IsCooldownImmune();
|
||||
bitStream->Write(isImmune);
|
||||
bitStream.Write(isImmune);
|
||||
|
||||
if (isImmune) {
|
||||
LOG_DEBUG("Target targetEntity %llu is immune!", branch.target);
|
||||
@ -210,7 +210,7 @@ void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet
|
||||
const uint32_t healthDamageDealt = previousHealth - destroyableComponent->GetHealth();
|
||||
isSuccess = armorDamageDealt > 0 || healthDamageDealt > 0 || (armorDamageDealt + healthDamageDealt) > 0;
|
||||
|
||||
bitStream->Write(isSuccess);
|
||||
bitStream.Write(isSuccess);
|
||||
|
||||
//Handle player damage cooldown
|
||||
if (isSuccess && targetEntity->IsPlayer() && !this->m_DontApplyImmune) {
|
||||
@ -225,12 +225,12 @@ void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet
|
||||
successState = this->m_OnFailArmor->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY ? eBasicAttackSuccessTypes::FAILIMMUNE : eBasicAttackSuccessTypes::FAILARMOR;
|
||||
}
|
||||
|
||||
bitStream->Write(armorDamageDealt);
|
||||
bitStream->Write(healthDamageDealt);
|
||||
bitStream->Write(targetEntity->GetIsDead());
|
||||
bitStream.Write(armorDamageDealt);
|
||||
bitStream.Write(healthDamageDealt);
|
||||
bitStream.Write(targetEntity->GetIsDead());
|
||||
}
|
||||
|
||||
bitStream->Write(successState);
|
||||
bitStream.Write(successState);
|
||||
|
||||
switch (static_cast<eBasicAttackSuccessTypes>(successState)) {
|
||||
case eBasicAttackSuccessTypes::SUCCESS:
|
||||
|
@ -12,7 +12,7 @@ public:
|
||||
* is then offset to after the allocated bits for this stream.
|
||||
*
|
||||
*/
|
||||
void DoHandleBehavior(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch);
|
||||
void DoHandleBehavior(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch);
|
||||
|
||||
/**
|
||||
* @brief Handles a client initialized Basic Attack Behavior cast to be deserialized and verified on the server.
|
||||
@ -22,14 +22,14 @@ public:
|
||||
* and will fail gracefully if an overread is detected.
|
||||
* @param branch The context of this specific branch of the Skill Behavior. Changes based on which branch you are going down.
|
||||
*/
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
/**
|
||||
* @brief Writes a 16bit short to the bitStream and when the actual behavior calculation finishes with all of its branches, the number
|
||||
* of bits used is then written to where the 16bit short initially was.
|
||||
*
|
||||
*/
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
/**
|
||||
* @brief Calculates a server initialized Basic Attack Behavior cast to be serialized to the client
|
||||
@ -38,7 +38,7 @@ public:
|
||||
* @param bitStream The bitStream to serialize to.
|
||||
* @param branch The context of this specific branch of the Skill Behavior. Changes based on which branch you are going down.
|
||||
*/
|
||||
void DoBehaviorCalculation(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch);
|
||||
void DoBehaviorCalculation(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch);
|
||||
|
||||
/**
|
||||
* @brief Loads this Behaviors parameters from the database. For this behavior specifically:
|
||||
|
@ -487,10 +487,10 @@ std::map<std::string, float> Behavior::GetParameterNames() const {
|
||||
void Behavior::Load() {
|
||||
}
|
||||
|
||||
void Behavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void Behavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
}
|
||||
|
||||
void Behavior::Sync(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void Behavior::Sync(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
}
|
||||
|
||||
void Behavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) {
|
||||
@ -502,10 +502,10 @@ void Behavior::Timer(BehaviorContext* context, BehaviorBranchContext branch, LWO
|
||||
void Behavior::End(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second) {
|
||||
}
|
||||
|
||||
void Behavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void Behavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
}
|
||||
|
||||
void Behavior::SyncCalculation(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void Behavior::SyncCalculation(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
}
|
||||
|
||||
Behavior::~Behavior() {
|
||||
|
@ -68,9 +68,9 @@ public:
|
||||
virtual void Load();
|
||||
|
||||
// Player side
|
||||
virtual void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch);
|
||||
virtual void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch);
|
||||
|
||||
virtual void Sync(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch);
|
||||
virtual void Sync(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch);
|
||||
|
||||
virtual void UnCast(BehaviorContext* context, BehaviorBranchContext branch);
|
||||
|
||||
@ -79,9 +79,9 @@ public:
|
||||
virtual void End(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second);
|
||||
|
||||
// Npc side
|
||||
virtual void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch);
|
||||
virtual void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch);
|
||||
|
||||
virtual void SyncCalculation(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch);
|
||||
virtual void SyncCalculation(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch);
|
||||
|
||||
/*
|
||||
* Creations/destruction
|
||||
|
@ -105,7 +105,7 @@ void BehaviorContext::ExecuteUpdates() {
|
||||
this->scheduledUpdates.clear();
|
||||
}
|
||||
|
||||
void BehaviorContext::SyncBehavior(const uint32_t syncId, RakNet::BitStream* bitStream) {
|
||||
void BehaviorContext::SyncBehavior(const uint32_t syncId, RakNet::BitStream& bitStream) {
|
||||
BehaviorSyncEntry entry;
|
||||
auto found = false;
|
||||
|
||||
@ -246,7 +246,7 @@ bool BehaviorContext::CalculateUpdate(const float deltaTime) {
|
||||
RakNet::BitStream bitStream{};
|
||||
|
||||
// Calculate sync
|
||||
entry.behavior->SyncCalculation(this, &bitStream, entry.branchContext);
|
||||
entry.behavior->SyncCalculation(this, bitStream, entry.branchContext);
|
||||
|
||||
if (!clientInitalized) {
|
||||
echo.sBitStream.assign(reinterpret_cast<char*>(bitStream.GetData()), bitStream.GetNumberOfBytesUsed());
|
||||
|
@ -93,7 +93,7 @@ struct BehaviorContext
|
||||
|
||||
void ExecuteUpdates();
|
||||
|
||||
void SyncBehavior(uint32_t syncId, RakNet::BitStream* bitStream);
|
||||
void SyncBehavior(uint32_t syncId, RakNet::BitStream& bitStream);
|
||||
|
||||
void Update(float deltaTime);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "Logger.h"
|
||||
#include "DestroyableComponent.h"
|
||||
|
||||
void BlockBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void BlockBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
const auto target = context->originator;
|
||||
|
||||
auto* entity = Game::entityManager->GetEntity(target);
|
||||
@ -33,7 +33,7 @@ void BlockBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
|
||||
}
|
||||
}
|
||||
|
||||
void BlockBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void BlockBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
Handle(context, bitStream, branch);
|
||||
}
|
||||
|
||||
|
@ -13,9 +13,9 @@ public:
|
||||
explicit BlockBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void UnCast(BehaviorContext* context, BehaviorBranchContext branch) override;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "Logger.h"
|
||||
#include "DestroyableComponent.h"
|
||||
|
||||
void BuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void BuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
const auto target = branch.target != LWOOBJID_EMPTY ? branch.target : context->originator;
|
||||
|
||||
auto* entity = Game::entityManager->GetEntity(target);
|
||||
|
@ -16,7 +16,7 @@ public:
|
||||
explicit BuffBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void UnCast(BehaviorContext* context, BehaviorBranchContext branch) override;
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "Logger.h"
|
||||
#include "PossessableComponent.h"
|
||||
|
||||
void CarBoostBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void CarBoostBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
GameMessages::SendVehicleAddPassiveBoostAction(branch.target, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
auto* entity = Game::entityManager->GetEntity(context->originator);
|
||||
|
@ -17,7 +17,7 @@ public:
|
||||
explicit CarBoostBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -3,11 +3,11 @@
|
||||
#include "Game.h"
|
||||
#include "Logger.h"
|
||||
|
||||
void ChainBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
void ChainBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
|
||||
uint32_t chainIndex{};
|
||||
|
||||
if (!bitStream->Read(chainIndex)) {
|
||||
LOG("Unable to read chainIndex from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||
if (!bitStream.Read(chainIndex)) {
|
||||
LOG("Unable to read chainIndex from bitStream, aborting Handle! %i", bitStream.GetNumberOfUnreadBits());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -16,12 +16,12 @@ void ChainBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
|
||||
if (chainIndex < this->m_behaviors.size()) {
|
||||
this->m_behaviors.at(chainIndex)->Handle(context, bitStream, branch);
|
||||
} else {
|
||||
LOG("chainIndex out of bounds, aborting handle of chain %i bits unread %i", chainIndex, bitStream->GetNumberOfUnreadBits());
|
||||
LOG("chainIndex out of bounds, aborting handle of chain %i bits unread %i", chainIndex, bitStream.GetNumberOfUnreadBits());
|
||||
}
|
||||
}
|
||||
|
||||
void ChainBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
bitStream->Write(1);
|
||||
void ChainBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
|
||||
bitStream.Write(1);
|
||||
|
||||
this->m_behaviors.at(0)->Calculate(context, bitStream, branch);
|
||||
}
|
||||
|
@ -16,9 +16,9 @@ public:
|
||||
explicit ChainBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "BehaviorContext.h"
|
||||
#include "BehaviorBranchContext.h"
|
||||
|
||||
void ChangeIdleFlagsBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void ChangeIdleFlagsBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
const auto target = branch.target != LWOOBJID_EMPTY ? branch.target : context->originator;
|
||||
if (!target) return;
|
||||
|
||||
@ -16,7 +16,7 @@ void ChangeIdleFlagsBehavior::Handle(BehaviorContext* context, RakNet::BitStream
|
||||
}
|
||||
}
|
||||
|
||||
void ChangeIdleFlagsBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void ChangeIdleFlagsBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
Handle(context, bitStream, branch);
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,8 @@ public:
|
||||
*/
|
||||
explicit ChangeIdleFlagsBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {}
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
void Timer(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second) override;
|
||||
void End(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second) override;
|
||||
void Load() override;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "BehaviorContext.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
void ChangeOrientationBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void ChangeOrientationBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
Entity* sourceEntity;
|
||||
if (this->m_orientCaster) sourceEntity = Game::entityManager->GetEntity(context->originator);
|
||||
else sourceEntity = Game::entityManager->GetEntity(branch.target);
|
||||
|
@ -5,7 +5,7 @@
|
||||
class ChangeOrientationBehavior final : public Behavior {
|
||||
public:
|
||||
explicit ChangeOrientationBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {}
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
void Load() override;
|
||||
private:
|
||||
bool m_orientCaster;
|
||||
|
@ -4,10 +4,10 @@
|
||||
#include "Game.h"
|
||||
#include "Logger.h"
|
||||
|
||||
void ChargeUpBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
void ChargeUpBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
|
||||
uint32_t handle{};
|
||||
|
||||
if (!bitStream->Read(handle)) {
|
||||
if (!bitStream.Read(handle)) {
|
||||
LOG("Unable to read handle from bitStream, aborting Handle! variable_type");
|
||||
return;
|
||||
};
|
||||
@ -15,10 +15,10 @@ void ChargeUpBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt
|
||||
context->RegisterSyncBehavior(handle, this, branch, this->m_MaxDuration);
|
||||
}
|
||||
|
||||
void ChargeUpBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void ChargeUpBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
}
|
||||
|
||||
void ChargeUpBehavior::Sync(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
void ChargeUpBehavior::Sync(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
|
||||
this->m_action->Handle(context, bitStream, branch);
|
||||
}
|
||||
|
||||
|
@ -6,11 +6,11 @@ class ChargeUpBehavior final : public Behavior
|
||||
public:
|
||||
explicit ChargeUpBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Sync(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Sync(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
private:
|
||||
|
@ -3,13 +3,13 @@
|
||||
#include "BehaviorContext.h"
|
||||
|
||||
|
||||
void ClearTargetBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void ClearTargetBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
branch.target = LWOOBJID_EMPTY;
|
||||
|
||||
this->m_action->Handle(context, bitStream, branch);
|
||||
}
|
||||
|
||||
void ClearTargetBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void ClearTargetBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
branch.target = LWOOBJID_EMPTY;
|
||||
|
||||
this->m_action->Calculate(context, bitStream, branch);
|
||||
|
@ -14,9 +14,9 @@ public:
|
||||
explicit ClearTargetBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "BehaviorBranchContext.h"
|
||||
#include "InventoryComponent.h"
|
||||
|
||||
void ConsumeItemBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void ConsumeItemBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
auto action_to_cast = m_ActionNotConsumed;
|
||||
if (this->m_ConsumeLOT != -1) {
|
||||
auto caster = Game::entityManager->GetEntity(context->caster);
|
||||
@ -19,7 +19,7 @@ void ConsumeItemBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bi
|
||||
if(action_to_cast) action_to_cast->Handle(context, bitStream, branch);
|
||||
}
|
||||
|
||||
void ConsumeItemBehavior::Sync(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void ConsumeItemBehavior::Sync(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
Handle(context, bitStream, branch);
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,8 @@ class ConsumeItemBehavior final : public Behavior
|
||||
{
|
||||
public:
|
||||
explicit ConsumeItemBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {}
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Sync(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
void Sync(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
void Load() override;
|
||||
|
||||
private:
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "Logger.h"
|
||||
#include "DestroyableComponent.h"
|
||||
|
||||
void DamageAbsorptionBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
void DamageAbsorptionBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
|
||||
auto* target = Game::entityManager->GetEntity(branch.target);
|
||||
|
||||
if (target == nullptr) {
|
||||
@ -29,7 +29,7 @@ void DamageAbsorptionBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
|
||||
context->RegisterTimerBehavior(this, branch, target->GetObjectID());
|
||||
}
|
||||
|
||||
void DamageAbsorptionBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void DamageAbsorptionBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
Handle(context, bitStream, branch);
|
||||
}
|
||||
|
||||
|
@ -13,9 +13,9 @@ public:
|
||||
explicit DamageAbsorptionBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Timer(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second) override;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "Logger.h"
|
||||
#include "DestroyableComponent.h"
|
||||
|
||||
void DamageReductionBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
void DamageReductionBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
|
||||
auto* target = Game::entityManager->GetEntity(branch.target);
|
||||
|
||||
if (target == nullptr) {
|
||||
@ -27,7 +27,7 @@ void DamageReductionBehavior::Handle(BehaviorContext* context, RakNet::BitStream
|
||||
context->RegisterTimerBehavior(this, branch, target->GetObjectID());
|
||||
}
|
||||
|
||||
void DamageReductionBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void DamageReductionBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
Handle(context, bitStream, branch);
|
||||
}
|
||||
|
||||
|
@ -13,9 +13,9 @@ public:
|
||||
explicit DamageReductionBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Timer(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second) override;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "EntityManager.h"
|
||||
#include "BehaviorContext.h"
|
||||
|
||||
void DarkInspirationBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
void DarkInspirationBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
|
||||
auto* target = Game::entityManager->GetEntity(branch.target);
|
||||
|
||||
if (target == nullptr) {
|
||||
@ -25,7 +25,7 @@ void DarkInspirationBehavior::Handle(BehaviorContext* context, RakNet::BitStream
|
||||
}
|
||||
}
|
||||
|
||||
void DarkInspirationBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void DarkInspirationBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
auto* target = Game::entityManager->GetEntity(branch.target);
|
||||
|
||||
if (target == nullptr) {
|
||||
|
@ -11,9 +11,9 @@ public:
|
||||
explicit DarkInspirationBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
private:
|
||||
|
@ -2,13 +2,13 @@
|
||||
#include "BehaviorBranchContext.h"
|
||||
#include "BehaviorContext.h"
|
||||
|
||||
void DurationBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void DurationBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
branch.duration = this->m_duration;
|
||||
|
||||
this->m_action->Handle(context, bitStream, branch);
|
||||
}
|
||||
|
||||
void DurationBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void DurationBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
branch.duration = this->m_duration;
|
||||
|
||||
this->m_action->Calculate(context, bitStream, branch);
|
||||
|
@ -11,9 +11,9 @@ public:
|
||||
explicit DurationBehavior(const uint32_t behavior_id) : Behavior(behavior_id) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
private:
|
||||
|
@ -3,11 +3,11 @@
|
||||
#include "BehaviorContext.h"
|
||||
#include "BehaviorBranchContext.h"
|
||||
|
||||
void EndBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void EndBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
context->InvokeEnd(this->m_startBehavior);
|
||||
}
|
||||
|
||||
void EndBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void EndBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
context->InvokeEnd(this->m_startBehavior);
|
||||
}
|
||||
|
||||
|
@ -13,9 +13,9 @@ public:
|
||||
explicit EndBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "BehaviorBranchContext.h"
|
||||
|
||||
|
||||
void FallSpeedBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void FallSpeedBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
// make sure required parameter has non-default value
|
||||
if (m_PercentSlowed == 0.0f) return;
|
||||
auto* target = Game::entityManager->GetEntity(branch.target);
|
||||
@ -23,7 +23,7 @@ void FallSpeedBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitS
|
||||
}
|
||||
}
|
||||
|
||||
void FallSpeedBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void FallSpeedBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
Handle(context, bitStream, branch);
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,8 @@ class FallSpeedBehavior final : public Behavior
|
||||
public:
|
||||
explicit FallSpeedBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
void Timer(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second) override;
|
||||
void End(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second) override;
|
||||
void UnCast(BehaviorContext* context, BehaviorBranchContext branch) override;
|
||||
|
@ -6,29 +6,29 @@
|
||||
#include "Game.h"
|
||||
#include "Logger.h"
|
||||
|
||||
void ForceMovementBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
void ForceMovementBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
|
||||
if (this->m_hitAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY && this->m_hitEnemyAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY && this->m_hitFactionAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t handle{};
|
||||
if (!bitStream->Read(handle)) {
|
||||
LOG("Unable to read handle from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||
if (!bitStream.Read(handle)) {
|
||||
LOG("Unable to read handle from bitStream, aborting Handle! %i", bitStream.GetNumberOfUnreadBits());
|
||||
return;
|
||||
}
|
||||
context->RegisterSyncBehavior(handle, this, branch, this->m_Duration);
|
||||
}
|
||||
|
||||
void ForceMovementBehavior::Sync(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void ForceMovementBehavior::Sync(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
uint32_t next{};
|
||||
if (!bitStream->Read(next)) {
|
||||
LOG("Unable to read target from bitStream, aborting Sync! %i", bitStream->GetNumberOfUnreadBits());
|
||||
if (!bitStream.Read(next)) {
|
||||
LOG("Unable to read target from bitStream, aborting Sync! %i", bitStream.GetNumberOfUnreadBits());
|
||||
return;
|
||||
}
|
||||
|
||||
LWOOBJID target{};
|
||||
if (!bitStream->Read(target)) {
|
||||
LOG("Unable to read target from bitStream, aborting Sync! %i", bitStream->GetNumberOfUnreadBits());
|
||||
if (!bitStream.Read(target)) {
|
||||
LOG("Unable to read target from bitStream, aborting Sync! %i", bitStream.GetNumberOfUnreadBits());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ void ForceMovementBehavior::Sync(BehaviorContext* context, RakNet::BitStream* bi
|
||||
behavior->Handle(context, bitStream, branch);
|
||||
}
|
||||
|
||||
void ForceMovementBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void ForceMovementBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
if (this->m_hitAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY && this->m_hitEnemyAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY && this->m_hitFactionAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY) {
|
||||
return;
|
||||
}
|
||||
@ -56,7 +56,7 @@ void ForceMovementBehavior::Calculate(BehaviorContext* context, RakNet::BitStrea
|
||||
}
|
||||
|
||||
const auto skillHandle = context->GetUniqueSkillId();
|
||||
bitStream->Write(skillHandle);
|
||||
bitStream.Write(skillHandle);
|
||||
|
||||
context->SyncCalculation(skillHandle, this->m_Duration, this, branch);
|
||||
}
|
||||
@ -71,7 +71,7 @@ void ForceMovementBehavior::Load() {
|
||||
this->m_Yaw = GetFloat("yaw");
|
||||
}
|
||||
|
||||
void ForceMovementBehavior::SyncCalculation(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void ForceMovementBehavior::SyncCalculation(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
auto* casterEntity = Game::entityManager->GetEntity(context->caster);
|
||||
if (casterEntity != nullptr) {
|
||||
auto* controllablePhysicsComponent = casterEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
|
@ -22,13 +22,13 @@ public:
|
||||
explicit ForceMovementBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void SyncCalculation(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void SyncCalculation(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Sync(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Sync(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
|
||||
void HealBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
|
||||
void HealBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bit_stream, const BehaviorBranchContext branch) {
|
||||
auto* entity = Game::entityManager->GetEntity(branch.target);
|
||||
|
||||
if (entity == nullptr) {
|
||||
@ -28,7 +28,7 @@ void HealBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_strea
|
||||
}
|
||||
|
||||
|
||||
void HealBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
|
||||
void HealBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bit_stream, const BehaviorBranchContext branch) {
|
||||
Handle(context, bit_stream, branch);
|
||||
}
|
||||
|
||||
|
@ -13,9 +13,9 @@ public:
|
||||
explicit HealBehavior(const uint32_t behavior_id) : Behavior(behavior_id) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bit_stream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bit_stream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bit_stream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "Logger.h"
|
||||
|
||||
|
||||
void ImaginationBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
|
||||
void ImaginationBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bit_stream, const BehaviorBranchContext branch) {
|
||||
auto* entity = Game::entityManager->GetEntity(branch.target);
|
||||
|
||||
if (entity == nullptr) {
|
||||
@ -23,7 +23,7 @@ void ImaginationBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bi
|
||||
|
||||
}
|
||||
|
||||
void ImaginationBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
|
||||
void ImaginationBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bit_stream, const BehaviorBranchContext branch) {
|
||||
Handle(context, bit_stream, branch);
|
||||
}
|
||||
|
||||
|
@ -13,9 +13,9 @@ public:
|
||||
explicit ImaginationBehavior(const uint32_t behavior_id) : Behavior(behavior_id) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bit_stream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bit_stream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bit_stream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "ControllablePhysicsComponent.h"
|
||||
#include "eStateChangeType.h"
|
||||
|
||||
void ImmunityBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
void ImmunityBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
|
||||
auto* target = Game::entityManager->GetEntity(branch.target);
|
||||
|
||||
if (!target) {
|
||||
@ -51,7 +51,7 @@ void ImmunityBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt
|
||||
context->RegisterTimerBehavior(this, branch, target->GetObjectID());
|
||||
}
|
||||
|
||||
void ImmunityBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void ImmunityBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
Handle(context, bitStream, branch);
|
||||
}
|
||||
|
||||
|
@ -11,9 +11,9 @@ public:
|
||||
explicit ImmunityBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Timer(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second) override;
|
||||
|
||||
|
@ -7,12 +7,12 @@
|
||||
#include "SkillComponent.h"
|
||||
|
||||
|
||||
void InterruptBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void InterruptBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
if (branch.target != context->originator) {
|
||||
bool unknown = false;
|
||||
|
||||
if (!bitStream->Read(unknown)) {
|
||||
LOG("Unable to read unknown1 from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||
if (!bitStream.Read(unknown)) {
|
||||
LOG("Unable to read unknown1 from bitStream, aborting Handle! %i", bitStream.GetNumberOfUnreadBits());
|
||||
return;
|
||||
};
|
||||
|
||||
@ -22,8 +22,8 @@ void InterruptBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitS
|
||||
if (!this->m_interruptBlock) {
|
||||
bool unknown = false;
|
||||
|
||||
if (!bitStream->Read(unknown)) {
|
||||
LOG("Unable to read unknown2 from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||
if (!bitStream.Read(unknown)) {
|
||||
LOG("Unable to read unknown2 from bitStream, aborting Handle! %i", bitStream.GetNumberOfUnreadBits());
|
||||
return;
|
||||
};
|
||||
|
||||
@ -34,8 +34,8 @@ void InterruptBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitS
|
||||
{
|
||||
bool unknown = false;
|
||||
|
||||
if (!bitStream->Read(unknown)) {
|
||||
LOG("Unable to read unknown3 from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||
if (!bitStream.Read(unknown)) {
|
||||
LOG("Unable to read unknown3 from bitStream, aborting Handle! %i", bitStream.GetNumberOfUnreadBits());
|
||||
return;
|
||||
};
|
||||
}
|
||||
@ -54,16 +54,16 @@ void InterruptBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitS
|
||||
}
|
||||
|
||||
|
||||
void InterruptBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void InterruptBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
if (branch.target != context->originator) {
|
||||
bitStream->Write(false);
|
||||
bitStream.Write(false);
|
||||
}
|
||||
|
||||
if (!this->m_interruptBlock) {
|
||||
bitStream->Write(false);
|
||||
bitStream.Write(false);
|
||||
}
|
||||
|
||||
bitStream->Write(false);
|
||||
bitStream.Write(false);
|
||||
|
||||
if (branch.target == context->originator) return;
|
||||
|
||||
|
@ -15,9 +15,9 @@ public:
|
||||
explicit InterruptBehavior(const uint32_t behavior_id) : Behavior(behavior_id) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "Character.h"
|
||||
|
||||
void JetPackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
|
||||
void JetPackBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bit_stream, const BehaviorBranchContext branch) {
|
||||
auto* entity = Game::entityManager->GetEntity(branch.target);
|
||||
|
||||
GameMessages::SendSetJetPackMode(entity, true, this->m_BypassChecks, this->m_EnableHover, this->m_effectId, this->m_Airspeed, this->m_MaxAirspeed, this->m_VerticalVelocity, this->m_WarningEffectID);
|
||||
@ -33,7 +33,7 @@ void JetPackBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext bra
|
||||
}
|
||||
}
|
||||
|
||||
void JetPackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
|
||||
void JetPackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bit_stream, const BehaviorBranchContext branch) {
|
||||
Handle(context, bit_stream, branch);
|
||||
}
|
||||
|
||||
|
@ -18,11 +18,11 @@ public:
|
||||
explicit JetPackBehavior(const uint32_t behavior_id) : Behavior(behavior_id) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bit_stream, BehaviorBranchContext branch) override;
|
||||
|
||||
void UnCast(BehaviorContext* context, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bit_stream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bit_stream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -9,16 +9,16 @@
|
||||
#include "Game.h"
|
||||
#include "Logger.h"
|
||||
|
||||
void KnockbackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void KnockbackBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
bool unknown{};
|
||||
|
||||
if (!bitStream->Read(unknown)) {
|
||||
LOG("Unable to read unknown from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||
if (!bitStream.Read(unknown)) {
|
||||
LOG("Unable to read unknown from bitStream, aborting Handle! %i", bitStream.GetNumberOfUnreadBits());
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
void KnockbackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void KnockbackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
bool blocked = false;
|
||||
|
||||
auto* target = Game::entityManager->GetEntity(branch.target);
|
||||
@ -31,7 +31,7 @@ void KnockbackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* b
|
||||
}
|
||||
}
|
||||
|
||||
bitStream->Write(blocked);
|
||||
bitStream.Write(blocked);
|
||||
}
|
||||
|
||||
void KnockbackBehavior::Load() {
|
||||
|
@ -17,9 +17,9 @@ public:
|
||||
explicit KnockbackBehavior(const uint32_t behaviorID) : Behavior(behaviorID) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "LootBuffBehavior.h"
|
||||
|
||||
void LootBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void LootBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
auto target = Game::entityManager->GetEntity(context->caster);
|
||||
if (!target) return;
|
||||
|
||||
@ -14,7 +14,7 @@ void LootBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt
|
||||
|
||||
}
|
||||
|
||||
void LootBuffBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void LootBuffBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
Handle(context, bitStream, branch);
|
||||
}
|
||||
|
||||
|
@ -20,9 +20,9 @@ public:
|
||||
|
||||
explicit LootBuffBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void UnCast(BehaviorContext* context, BehaviorBranchContext branch) override;
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
#include "Game.h"
|
||||
#include "Logger.h"
|
||||
|
||||
void MovementSwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
void MovementSwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
|
||||
uint32_t movementType{};
|
||||
if (!bitStream->Read(movementType)) {
|
||||
if (!bitStream.Read(movementType)) {
|
||||
if (this->m_groundAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY &&
|
||||
this->m_jumpAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY &&
|
||||
this->m_fallingAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY &&
|
||||
@ -15,7 +15,7 @@ void MovementSwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream*
|
||||
this->m_movingAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY) {
|
||||
return;
|
||||
}
|
||||
LOG("Unable to read movementType from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||
LOG("Unable to read movementType from bitStream, aborting Handle! %i", bitStream.GetNumberOfUnreadBits());
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
explicit MovementSwitchBehavior(const uint32_t behavior_id) : Behavior(behavior_id) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "BehaviorContext.h"
|
||||
|
||||
|
||||
void NpcCombatSkillBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bit_stream, BehaviorBranchContext branch) {
|
||||
void NpcCombatSkillBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bit_stream, BehaviorBranchContext branch) {
|
||||
context->skillTime = this->m_npcSkillTime;
|
||||
|
||||
for (auto* behavior : this->m_behaviors) {
|
||||
|
@ -15,7 +15,7 @@ public:
|
||||
explicit NpcCombatSkillBehavior(const uint32_t behavior_id) : Behavior(behavior_id) {
|
||||
}
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bit_stream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bit_stream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "CDSkillBehaviorTable.h"
|
||||
|
||||
void OverTimeBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void OverTimeBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
const auto originator = context->originator;
|
||||
|
||||
auto* entity = Game::entityManager->GetEntity(originator);
|
||||
@ -33,7 +33,7 @@ void OverTimeBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt
|
||||
}
|
||||
}
|
||||
|
||||
void OverTimeBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void OverTimeBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -16,9 +16,9 @@ public:
|
||||
explicit OverTimeBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "BehaviorContext.h"
|
||||
#include "BehaviorBranchContext.h"
|
||||
|
||||
void PlayEffectBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void PlayEffectBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
// On managed behaviors this is handled by the client
|
||||
if (!context->unmanaged)
|
||||
return;
|
||||
@ -13,7 +13,7 @@ void PlayEffectBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit
|
||||
PlayFx(u"", target);
|
||||
}
|
||||
|
||||
void PlayEffectBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void PlayEffectBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
const auto& target = branch.target == LWOOBJID_EMPTY ? context->originator : branch.target;
|
||||
|
||||
//PlayFx(u"", target);
|
||||
|
@ -10,9 +10,9 @@ public:
|
||||
explicit PlayEffectBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -8,11 +8,11 @@
|
||||
#include "ObjectIDManager.h"
|
||||
#include "eObjectBits.h"
|
||||
|
||||
void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
LWOOBJID target{};
|
||||
|
||||
if (!bitStream->Read(target)) {
|
||||
LOG("Unable to read target from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||
if (!bitStream.Read(target)) {
|
||||
LOG("Unable to read target from bitStream, aborting Handle! %i", bitStream.GetNumberOfUnreadBits());
|
||||
return;
|
||||
};
|
||||
|
||||
@ -34,8 +34,8 @@ void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
|
||||
|
||||
if (m_useMouseposit && !branch.isSync) {
|
||||
NiPoint3 targetPosition = NiPoint3Constant::ZERO;
|
||||
if (!bitStream->Read(targetPosition)) {
|
||||
LOG("Unable to read targetPosition from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||
if (!bitStream.Read(targetPosition)) {
|
||||
LOG("Unable to read targetPosition from bitStream, aborting Handle! %i", bitStream.GetNumberOfUnreadBits());
|
||||
return;
|
||||
};
|
||||
}
|
||||
@ -45,8 +45,8 @@ void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
|
||||
for (auto i = 0u; i < this->m_projectileCount; ++i) {
|
||||
LWOOBJID projectileId{};
|
||||
|
||||
if (!bitStream->Read(projectileId)) {
|
||||
LOG("Unable to read projectileId from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||
if (!bitStream.Read(projectileId)) {
|
||||
LOG("Unable to read projectileId from bitStream, aborting Handle! %i", bitStream.GetNumberOfUnreadBits());
|
||||
return;
|
||||
};
|
||||
|
||||
@ -58,8 +58,8 @@ void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectileAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
bitStream->Write(branch.target);
|
||||
void ProjectileAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
bitStream.Write(branch.target);
|
||||
|
||||
auto* entity = Game::entityManager->GetEntity(context->originator);
|
||||
|
||||
@ -110,7 +110,7 @@ void ProjectileAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitSt
|
||||
|
||||
GeneralUtils::SetBit(id, eObjectBits::SPAWNED);
|
||||
|
||||
bitStream->Write(id);
|
||||
bitStream.Write(id);
|
||||
|
||||
auto eulerAngles = rotation.GetEulerAngles();
|
||||
|
||||
|
@ -32,9 +32,9 @@ public:
|
||||
explicit ProjectileAttackBehavior(const uint32_t behavior_id) : Behavior(behavior_id) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "ZoneInstanceManager.h"
|
||||
#include "dZoneManager.h"
|
||||
|
||||
void PropertyTeleportBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void PropertyTeleportBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
auto* caster = Game::entityManager->GetEntity(context->caster);
|
||||
if (!caster) return;
|
||||
|
||||
|
@ -11,7 +11,7 @@ public:
|
||||
explicit PropertyTeleportBehavior(const uint32_t behavior_id) : Behavior(behavior_id) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "EntityManager.h"
|
||||
#include "MovementAIComponent.h"
|
||||
|
||||
void PullToPointBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void PullToPointBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
auto* entity = Game::entityManager->GetEntity(context->originator);
|
||||
|
||||
auto* target = Game::entityManager->GetEntity(branch.target);
|
||||
@ -25,7 +25,7 @@ void PullToPointBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bi
|
||||
movement->PullToPoint(position);
|
||||
}
|
||||
|
||||
void PullToPointBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void PullToPointBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
Handle(context, bitStream, branch);
|
||||
}
|
||||
|
||||
|
@ -12,9 +12,9 @@ public:
|
||||
explicit PullToPointBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "EntityManager.h"
|
||||
#include "BuffComponent.h"
|
||||
|
||||
void RemoveBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void RemoveBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
auto* entity = Game::entityManager->GetEntity(context->caster);
|
||||
if (!entity) return;
|
||||
|
||||
|
@ -12,7 +12,7 @@ public:
|
||||
explicit RemoveBuffBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "Game.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void RepairBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
|
||||
void RepairBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bit_stream, const BehaviorBranchContext branch) {
|
||||
auto* entity = Game::entityManager->GetEntity(branch.target);
|
||||
|
||||
if (entity == nullptr) {
|
||||
@ -27,7 +27,7 @@ void RepairBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_str
|
||||
destroyable->Repair(this->m_armor);
|
||||
}
|
||||
|
||||
void RepairBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
|
||||
void RepairBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bit_stream, const BehaviorBranchContext branch) {
|
||||
Handle(context, bit_stream, branch);
|
||||
}
|
||||
|
||||
|
@ -13,9 +13,9 @@ public:
|
||||
explicit RepairBehavior(const uint32_t behavior_id) : Behavior(behavior_id) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bit_stream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bit_stream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bit_stream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -3,11 +3,11 @@
|
||||
#include "BehaviorContext.h"
|
||||
#include "BehaviorBranchContext.h"
|
||||
|
||||
void SkillCastFailedBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void SkillCastFailedBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
context->failed = true;
|
||||
}
|
||||
|
||||
void SkillCastFailedBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void SkillCastFailedBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
context->failed = true;
|
||||
}
|
||||
|
||||
|
@ -11,9 +11,9 @@ public:
|
||||
explicit SkillCastFailedBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "EntityManager.h"
|
||||
#include "CppScripts.h"
|
||||
|
||||
void SkillEventBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void SkillEventBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
auto* target = Game::entityManager->GetEntity(branch.target);
|
||||
auto* caster = Game::entityManager->GetEntity(context->originator);
|
||||
|
||||
@ -16,7 +16,7 @@ void SkillEventBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit
|
||||
}
|
||||
|
||||
void
|
||||
SkillEventBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
SkillEventBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
auto* target = Game::entityManager->GetEntity(branch.target);
|
||||
auto* caster = Game::entityManager->GetEntity(context->originator);
|
||||
|
||||
|
@ -9,7 +9,7 @@ public:
|
||||
explicit SkillEventBehavior(const uint32_t behaviorID) : Behavior(behaviorID) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
};
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "EntityInfo.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
auto* origin = Game::entityManager->GetEntity(context->originator);
|
||||
|
||||
if (origin == nullptr) {
|
||||
@ -74,7 +74,7 @@ void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
|
||||
});
|
||||
}
|
||||
|
||||
void SpawnBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void SpawnBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
Handle(context, bitStream, branch);
|
||||
}
|
||||
|
||||
|
@ -13,9 +13,9 @@ public:
|
||||
explicit SpawnBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Timer(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second) override;
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "BehaviorBranchContext.h"
|
||||
#include "BehaviorContext.h"
|
||||
|
||||
void SpawnQuickbuildBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void SpawnQuickbuildBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
}
|
||||
|
||||
void SpawnQuickbuildBehavior::Load() {
|
||||
|
@ -11,7 +11,7 @@ public:
|
||||
explicit SpawnQuickbuildBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "Logger.h"
|
||||
|
||||
|
||||
void SpeedBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void SpeedBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
if (m_AffectsCaster) branch.target = context->caster;
|
||||
|
||||
auto* target = Game::entityManager->GetEntity(branch.target);
|
||||
@ -25,7 +25,7 @@ void SpeedBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
|
||||
}
|
||||
}
|
||||
|
||||
void SpeedBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void SpeedBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
Handle(context, bitStream, branch);
|
||||
}
|
||||
|
||||
|
@ -11,9 +11,9 @@ public:
|
||||
explicit SpeedBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void UnCast(BehaviorContext* context, BehaviorBranchContext branch) override;
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include "StartBehavior.h"
|
||||
#include "BehaviorBranchContext.h"
|
||||
|
||||
void StartBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, BehaviorBranchContext branch) {
|
||||
void StartBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bit_stream, BehaviorBranchContext branch) {
|
||||
branch.start = this->m_behaviorId;
|
||||
|
||||
this->m_action->Handle(context, bit_stream, branch);
|
||||
}
|
||||
|
||||
void StartBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bit_stream, BehaviorBranchContext branch) {
|
||||
void StartBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bit_stream, BehaviorBranchContext branch) {
|
||||
branch.start = this->m_behaviorId;
|
||||
|
||||
this->m_action->Calculate(context, bit_stream, branch);
|
||||
|
@ -13,9 +13,9 @@ public:
|
||||
explicit StartBehavior(const uint32_t behaviorID) : Behavior(behaviorID) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -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);
|
||||
|
@ -12,9 +12,9 @@ public:
|
||||
explicit StunBehavior(const uint32_t behavior_id) : Behavior(behavior_id) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bit_stream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bit_stream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bit_stream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -6,12 +6,12 @@
|
||||
#include "BehaviorContext.h"
|
||||
#include "BuffComponent.h"
|
||||
|
||||
void SwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
void SwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
|
||||
auto state = true;
|
||||
|
||||
if (this->m_imagination > 0 || !this->m_isEnemyFaction) {
|
||||
if (!bitStream->Read(state)) {
|
||||
LOG("Unable to read state from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||
if (!bitStream.Read(state)) {
|
||||
LOG("Unable to read state from bitStream, aborting Handle! %i", bitStream.GetNumberOfUnreadBits());
|
||||
return;
|
||||
};
|
||||
}
|
||||
@ -37,7 +37,7 @@ void SwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStre
|
||||
}
|
||||
}
|
||||
|
||||
void SwitchBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void SwitchBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
auto state = true;
|
||||
|
||||
if (this->m_imagination > 0 || !this->m_isEnemyFaction) {
|
||||
@ -53,7 +53,7 @@ void SwitchBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
|
||||
}
|
||||
}
|
||||
|
||||
bitStream->Write(state);
|
||||
bitStream.Write(state);
|
||||
}
|
||||
|
||||
if (state) {
|
||||
|
@ -21,9 +21,9 @@ public:
|
||||
explicit SwitchBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
void Load() override;
|
||||
};
|
||||
|
@ -9,11 +9,11 @@
|
||||
#include "EntityManager.h"
|
||||
|
||||
|
||||
void SwitchMultipleBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void SwitchMultipleBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
float value{};
|
||||
|
||||
if (!bitStream->Read(value)) {
|
||||
LOG("Unable to read value from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||
if (!bitStream.Read(value)) {
|
||||
LOG("Unable to read value from bitStream, aborting Handle! %i", bitStream.GetNumberOfUnreadBits());
|
||||
return;
|
||||
};
|
||||
|
||||
@ -32,7 +32,7 @@ void SwitchMultipleBehavior::Handle(BehaviorContext* context, RakNet::BitStream*
|
||||
behavior->Handle(context, bitStream, branch);
|
||||
}
|
||||
|
||||
void SwitchMultipleBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
void SwitchMultipleBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user