Merge branch 'main' into moreMovementAi

This commit is contained in:
David Markowitz
2023-08-12 21:57:07 -07:00
157 changed files with 559 additions and 666 deletions

View File

@@ -1019,62 +1019,60 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
*/
bool destroyableSerialized = false;
bool bIsInitialUpdate = false;
if (packetType == eReplicaPacketType::CONSTRUCTION) bIsInitialUpdate = true;
unsigned int flags = 0;
bool bIsInitialUpdate = packetType == eReplicaPacketType::CONSTRUCTION;
PossessableComponent* possessableComponent;
if (TryGetComponent(eReplicaComponentType::POSSESSABLE, possessableComponent)) {
possessableComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
possessableComponent->Serialize(outBitStream, bIsInitialUpdate);
}
ModuleAssemblyComponent* moduleAssemblyComponent;
if (TryGetComponent(eReplicaComponentType::MODULE_ASSEMBLY, moduleAssemblyComponent)) {
moduleAssemblyComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
moduleAssemblyComponent->Serialize(outBitStream, bIsInitialUpdate);
}
ControllablePhysicsComponent* controllablePhysicsComponent;
if (TryGetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS, controllablePhysicsComponent)) {
controllablePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
controllablePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate);
}
SimplePhysicsComponent* simplePhysicsComponent;
if (TryGetComponent(eReplicaComponentType::SIMPLE_PHYSICS, simplePhysicsComponent)) {
simplePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
simplePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate);
}
RigidbodyPhantomPhysicsComponent* rigidbodyPhantomPhysics;
if (TryGetComponent(eReplicaComponentType::RIGID_BODY_PHANTOM_PHYSICS, rigidbodyPhantomPhysics)) {
rigidbodyPhantomPhysics->Serialize(outBitStream, bIsInitialUpdate, flags);
rigidbodyPhantomPhysics->Serialize(outBitStream, bIsInitialUpdate);
}
VehiclePhysicsComponent* vehiclePhysicsComponent;
if (TryGetComponent(eReplicaComponentType::VEHICLE_PHYSICS, vehiclePhysicsComponent)) {
vehiclePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
vehiclePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate);
}
PhantomPhysicsComponent* phantomPhysicsComponent;
if (TryGetComponent(eReplicaComponentType::PHANTOM_PHYSICS, phantomPhysicsComponent)) {
phantomPhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
phantomPhysicsComponent->Serialize(outBitStream, bIsInitialUpdate);
}
SoundTriggerComponent* soundTriggerComponent;
if (TryGetComponent(eReplicaComponentType::SOUND_TRIGGER, soundTriggerComponent)) {
soundTriggerComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
soundTriggerComponent->Serialize(outBitStream, bIsInitialUpdate);
}
RacingSoundTriggerComponent* racingSoundTriggerComponent;
if (TryGetComponent(eReplicaComponentType::RACING_SOUND_TRIGGER, racingSoundTriggerComponent)) {
racingSoundTriggerComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
racingSoundTriggerComponent->Serialize(outBitStream, bIsInitialUpdate);
}
BuffComponent* buffComponent;
if (TryGetComponent(eReplicaComponentType::BUFF, buffComponent)) {
buffComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
buffComponent->Serialize(outBitStream, bIsInitialUpdate);
DestroyableComponent* destroyableComponent;
if (TryGetComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent)) {
destroyableComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
destroyableComponent->Serialize(outBitStream, bIsInitialUpdate);
}
destroyableSerialized = true;
}
@@ -1082,7 +1080,7 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
if (HasComponent(eReplicaComponentType::COLLECTIBLE)) {
DestroyableComponent* destroyableComponent;
if (TryGetComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent) && !destroyableSerialized) {
destroyableComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
destroyableComponent->Serialize(outBitStream, bIsInitialUpdate);
}
destroyableSerialized = true;
outBitStream->Write(m_CollectibleID); // Collectable component
@@ -1090,7 +1088,7 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
PetComponent* petComponent;
if (TryGetComponent(eReplicaComponentType::PET, petComponent)) {
petComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
petComponent->Serialize(outBitStream, bIsInitialUpdate);
}
CharacterComponent* characterComponent;
@@ -1098,7 +1096,7 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
PossessorComponent* possessorComponent;
if (TryGetComponent(eReplicaComponentType::POSSESSOR, possessorComponent)) {
possessorComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
possessorComponent->Serialize(outBitStream, bIsInitialUpdate);
} else {
// Should never happen, but just to be safe
outBitStream->Write0();
@@ -1106,7 +1104,7 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
LevelProgressionComponent* levelProgressionComponent;
if (TryGetComponent(eReplicaComponentType::LEVEL_PROGRESSION, levelProgressionComponent)) {
levelProgressionComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
levelProgressionComponent->Serialize(outBitStream, bIsInitialUpdate);
} else {
// Should never happen, but just to be safe
outBitStream->Write0();
@@ -1114,13 +1112,13 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
PlayerForcedMovementComponent* playerForcedMovementComponent;
if (TryGetComponent(eReplicaComponentType::PLAYER_FORCED_MOVEMENT, playerForcedMovementComponent)) {
playerForcedMovementComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
playerForcedMovementComponent->Serialize(outBitStream, bIsInitialUpdate);
} else {
// Should never happen, but just to be safe
outBitStream->Write0();
}
characterComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
characterComponent->Serialize(outBitStream, bIsInitialUpdate);
}
if (HasComponent(eReplicaComponentType::ITEM)) {
@@ -1129,93 +1127,93 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
InventoryComponent* inventoryComponent;
if (TryGetComponent(eReplicaComponentType::INVENTORY, inventoryComponent)) {
inventoryComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
inventoryComponent->Serialize(outBitStream, bIsInitialUpdate);
}
ScriptComponent* scriptComponent;
if (TryGetComponent(eReplicaComponentType::SCRIPT, scriptComponent)) {
scriptComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
scriptComponent->Serialize(outBitStream, bIsInitialUpdate);
}
SkillComponent* skillComponent;
if (TryGetComponent(eReplicaComponentType::SKILL, skillComponent)) {
skillComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
skillComponent->Serialize(outBitStream, bIsInitialUpdate);
}
BaseCombatAIComponent* baseCombatAiComponent;
if (TryGetComponent(eReplicaComponentType::BASE_COMBAT_AI, baseCombatAiComponent)) {
baseCombatAiComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
baseCombatAiComponent->Serialize(outBitStream, bIsInitialUpdate);
}
RebuildComponent* rebuildComponent;
if (TryGetComponent(eReplicaComponentType::QUICK_BUILD, rebuildComponent)) {
DestroyableComponent* destroyableComponent;
if (TryGetComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent) && !destroyableSerialized) {
destroyableComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
destroyableComponent->Serialize(outBitStream, bIsInitialUpdate);
}
destroyableSerialized = true;
rebuildComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
rebuildComponent->Serialize(outBitStream, bIsInitialUpdate);
}
MovingPlatformComponent* movingPlatformComponent;
if (TryGetComponent(eReplicaComponentType::MOVING_PLATFORM, movingPlatformComponent)) {
movingPlatformComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
movingPlatformComponent->Serialize(outBitStream, bIsInitialUpdate);
}
SwitchComponent* switchComponent;
if (TryGetComponent(eReplicaComponentType::SWITCH, switchComponent)) {
switchComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
switchComponent->Serialize(outBitStream, bIsInitialUpdate);
}
VendorComponent* vendorComponent;
if (TryGetComponent(eReplicaComponentType::VENDOR, vendorComponent)) {
vendorComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
vendorComponent->Serialize(outBitStream, bIsInitialUpdate);
}
DonationVendorComponent* donationVendorComponent;
if (TryGetComponent(eReplicaComponentType::DONATION_VENDOR, donationVendorComponent)) {
donationVendorComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
donationVendorComponent->Serialize(outBitStream, bIsInitialUpdate);
}
BouncerComponent* bouncerComponent;
if (TryGetComponent(eReplicaComponentType::BOUNCER, bouncerComponent)) {
bouncerComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
bouncerComponent->Serialize(outBitStream, bIsInitialUpdate);
}
ScriptedActivityComponent* scriptedActivityComponent;
if (TryGetComponent(eReplicaComponentType::SCRIPTED_ACTIVITY, scriptedActivityComponent)) {
scriptedActivityComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
scriptedActivityComponent->Serialize(outBitStream, bIsInitialUpdate);
}
ShootingGalleryComponent* shootingGalleryComponent;
if (TryGetComponent(eReplicaComponentType::SHOOTING_GALLERY, shootingGalleryComponent)) {
shootingGalleryComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
shootingGalleryComponent->Serialize(outBitStream, bIsInitialUpdate);
}
RacingControlComponent* racingControlComponent;
if (TryGetComponent(eReplicaComponentType::RACING_CONTROL, racingControlComponent)) {
racingControlComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
racingControlComponent->Serialize(outBitStream, bIsInitialUpdate);
}
LUPExhibitComponent* lupExhibitComponent;
if (TryGetComponent(eReplicaComponentType::LUP_EXHIBIT, lupExhibitComponent)) {
lupExhibitComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
lupExhibitComponent->Serialize(outBitStream, bIsInitialUpdate);
}
ModelComponent* modelComponent;
if (TryGetComponent(eReplicaComponentType::MODEL, modelComponent)) {
modelComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
modelComponent->Serialize(outBitStream, bIsInitialUpdate);
}
RenderComponent* renderComponent;
if (TryGetComponent(eReplicaComponentType::RENDER, renderComponent)) {
renderComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
renderComponent->Serialize(outBitStream, bIsInitialUpdate);
}
if (modelComponent) {
DestroyableComponent* destroyableComponent;
if (TryGetComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent) && !destroyableSerialized) {
destroyableComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
destroyableComponent->Serialize(outBitStream, bIsInitialUpdate);
destroyableSerialized = true;
}
}
@@ -1230,10 +1228,6 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
outBitStream->Write0();
}
void Entity::ResetFlags() {
// Unused
}
void Entity::UpdateXMLDoc(tinyxml2::XMLDocument* doc) {
//This function should only ever be called from within Character, meaning doc should always exist when this is called.
//Naturally, we don't include any non-player components in this update function.

View File

@@ -174,7 +174,6 @@ public:
void WriteBaseReplicaData(RakNet::BitStream* outBitStream, eReplicaPacketType packetType);
void WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType packetType);
void ResetFlags();
void UpdateXMLDoc(tinyxml2::XMLDocument* doc);
void Update(float deltaTime);

View File

@@ -583,12 +583,6 @@ bool EntityManager::GetGhostingEnabled() const {
return m_GhostingEnabled;
}
void EntityManager::ResetFlags() {
for (const auto& e : m_Entities) {
e.second->ResetFlags();
}
}
void EntityManager::ScheduleForKill(Entity* entity) {
// Deactivate switches if they die
if (!entity)

View File

@@ -59,8 +59,6 @@ public:
Entity* GetGhostCandidate(int32_t id);
bool GetGhostingEnabled() const;
void ResetFlags();
void ScheduleForKill(Entity* entity);
void ScheduleForDeletion(LWOOBJID entity);

View File

@@ -520,7 +520,7 @@ bool BaseCombatAIComponent::IsMech() {
}
void BaseCombatAIComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void BaseCombatAIComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
outBitStream->Write(m_DirtyStateOrTarget || bIsInitialUpdate);
if (m_DirtyStateOrTarget || bIsInitialUpdate) {
outBitStream->Write(uint32_t(m_State));

View File

@@ -53,7 +53,7 @@ public:
~BaseCombatAIComponent() override;
void Update(float deltaTime) override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
/**
* Get the current behavioral state of the enemy

View File

@@ -22,7 +22,7 @@ BouncerComponent::BouncerComponent(Entity* parent) : Component(parent) {
BouncerComponent::~BouncerComponent() {
}
void BouncerComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void BouncerComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
outBitStream->Write(m_PetEnabled);
if (m_PetEnabled) {
outBitStream->Write(m_PetBouncerEnabled);

View File

@@ -17,7 +17,7 @@ public:
BouncerComponent(Entity* parentEntity);
~BouncerComponent() override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
Entity* GetParentEntity() const;

View File

@@ -20,7 +20,7 @@ BuffComponent::BuffComponent(Entity* parent) : Component(parent) {
BuffComponent::~BuffComponent() {
}
void BuffComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void BuffComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
if (!bIsInitialUpdate) return;
if (m_Buffs.empty()) {
outBitStream->Write0();

View File

@@ -54,7 +54,7 @@ public:
void UpdateXml(tinyxml2::XMLDocument* doc) override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
void Update(float deltaTime) override;

View File

@@ -70,7 +70,7 @@ bool CharacterComponent::LandingAnimDisabled(int zoneID) {
CharacterComponent::~CharacterComponent() {
}
void CharacterComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void CharacterComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
if (bIsInitialUpdate) {
outBitStream->Write0();

View File

@@ -70,7 +70,7 @@ public:
void LoadFromXml(tinyxml2::XMLDocument* doc) override;
void UpdateXml(tinyxml2::XMLDocument* doc) override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
/**
* Updates the rocket configuration using a LOT string separated by commas

View File

@@ -28,3 +28,7 @@ void Component::UpdateXml(tinyxml2::XMLDocument* doc) {
void Component::LoadFromXml(tinyxml2::XMLDocument* doc) {
}
void Component::Serialize(RakNet::BitStream* outBitStream, bool isConstruction) {
}

View File

@@ -43,6 +43,8 @@ public:
*/
virtual void LoadFromXml(tinyxml2::XMLDocument* doc);
virtual void Serialize(RakNet::BitStream* outBitStream, bool isConstruction);
protected:
/**

View File

@@ -76,7 +76,7 @@ void ControllablePhysicsComponent::Update(float deltaTime) {
Game::entityManager->SerializeEntity(m_Parent);
}
void ControllablePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void ControllablePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
if (bIsInitialUpdate) {
outBitStream->Write(m_InJetpackMode);
if (m_InJetpackMode) {
@@ -179,12 +179,6 @@ void ControllablePhysicsComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
m_DirtyPosition = true;
}
void ControllablePhysicsComponent::ResetFlags() {
m_DirtyAngularVelocity = false;
m_DirtyPosition = false;
m_DirtyVelocity = false;
}
void ControllablePhysicsComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
if (!character) {

View File

@@ -27,9 +27,8 @@ public:
~ControllablePhysicsComponent() override;
void Update(float deltaTime) override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
void LoadFromXml(tinyxml2::XMLDocument* doc) override;
void ResetFlags();
void UpdateXml(tinyxml2::XMLDocument* doc) override;
/**

View File

@@ -119,7 +119,7 @@ void DestroyableComponent::Reinitialize(LOT templateID) {
}
}
void DestroyableComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, uint32_t& flags) {
void DestroyableComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
if (bIsInitialUpdate) {
outBitStream->Write1(); // always write these on construction
outBitStream->Write(m_ImmuneToBasicAttackCount);

View File

@@ -24,7 +24,7 @@ public:
DestroyableComponent(Entity* parentEntity);
~DestroyableComponent() override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, uint32_t& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
void LoadFromXml(tinyxml2::XMLDocument* doc) override;
void UpdateXml(tinyxml2::XMLDocument* doc) override;

View File

@@ -38,8 +38,8 @@ void DonationVendorComponent::SubmitDonation(uint32_t count) {
m_DirtyDonationVendor = true;
}
void DonationVendorComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
VendorComponent::Serialize(outBitStream, bIsInitialUpdate, flags);
void DonationVendorComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
VendorComponent::Serialize(outBitStream, bIsInitialUpdate);
outBitStream->Write(bIsInitialUpdate || m_DirtyDonationVendor);
if (bIsInitialUpdate || m_DirtyDonationVendor) {
outBitStream->Write(m_PercentComplete);

View File

@@ -10,7 +10,7 @@ class DonationVendorComponent final : public VendorComponent {
public:
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::DONATION_VENDOR;
DonationVendorComponent(Entity* parent);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
uint32_t GetActivityID() {return m_ActivityId;};
void SubmitDonation(uint32_t count);

View File

@@ -712,7 +712,7 @@ void InventoryComponent::UpdateXml(tinyxml2::XMLDocument* document) {
}
}
void InventoryComponent::Serialize(RakNet::BitStream* outBitStream, const bool bIsInitialUpdate, unsigned& flags) {
void InventoryComponent::Serialize(RakNet::BitStream* outBitStream, const bool bIsInitialUpdate) {
if (bIsInitialUpdate || m_Dirty) {
outBitStream->Write(true);
@@ -770,10 +770,6 @@ void InventoryComponent::Serialize(RakNet::BitStream* outBitStream, const bool b
outBitStream->Write(false);
}
void InventoryComponent::ResetFlags() {
m_Dirty = false;
}
void InventoryComponent::Update(float deltaTime) {
for (auto* set : m_Itemsets) {
set->Update(deltaTime);

View File

@@ -42,10 +42,9 @@ public:
explicit InventoryComponent(Entity* parent, tinyxml2::XMLDocument* document = nullptr);
void Update(float deltaTime) override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
void LoadXml(tinyxml2::XMLDocument* document);
void UpdateXml(tinyxml2::XMLDocument* document) override;
void ResetFlags();
/**
* Returns an inventory of the specified type, if it exists

View File

@@ -38,7 +38,7 @@ void LUPExhibitComponent::NextExhibit() {
Game::entityManager->SerializeEntity(m_Parent);
}
void LUPExhibitComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, uint32_t& flags) {
void LUPExhibitComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
outBitStream->Write1(); // Dirty flag?
outBitStream->Write(m_Exhibit);
}

View File

@@ -16,7 +16,7 @@ public:
LUPExhibitComponent(Entity* parent);
~LUPExhibitComponent();
void Update(float deltaTime) override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, uint32_t& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
/**
* After the timer runs out, this changes the currently exhibited LOT to the next one

View File

@@ -37,7 +37,7 @@ void LevelProgressionComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
m_CharacterVersion = static_cast<eCharacterVersion>(characterVersion);
}
void LevelProgressionComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void LevelProgressionComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
outBitStream->Write(bIsInitialUpdate || m_DirtyLevelInfo);
if (bIsInitialUpdate || m_DirtyLevelInfo) outBitStream->Write(m_Level);
m_DirtyLevelInfo = false;
@@ -56,19 +56,19 @@ void LevelProgressionComponent::HandleLevelUp() {
// Tell the client we beginning to send level rewards.
if (rewardingItem) GameMessages::NotifyLevelRewards(m_Parent->GetObjectID(), m_Parent->GetSystemAddress(), m_Level, rewardingItem);
for (auto* reward : rewards) {
switch (reward->rewardType) {
for (const auto& reward : rewards) {
switch (reward.rewardType) {
case 0:
inventoryComponent->AddItem(reward->value, reward->count, eLootSourceType::LEVEL_REWARD);
inventoryComponent->AddItem(reward.value, reward.count, eLootSourceType::LEVEL_REWARD);
break;
case 4:
{
auto* items = inventoryComponent->GetInventory(eInventoryType::ITEMS);
items->SetSize(items->GetSize() + reward->value);
items->SetSize(items->GetSize() + reward.value);
}
break;
case 9:
SetSpeedBase(static_cast<float>(reward->value) );
SetSpeedBase(static_cast<float>(reward.value) );
controllablePhysicsComponent->SetSpeedMultiplier(GetSpeedBase() / 500.0f);
break;
case 11:

View File

@@ -21,7 +21,7 @@ public:
*/
LevelProgressionComponent(Entity* parent);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
/**
* Save data from this componennt to character XML

View File

@@ -8,7 +8,7 @@ ModelComponent::ModelComponent(Entity* parent) : Component(parent) {
m_userModelID = m_Parent->GetVarAs<LWOOBJID>(u"userModelID");
}
void ModelComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void ModelComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
// ItemComponent Serialization. Pets do not get this serialization.
if (!m_Parent->HasComponent(eReplicaComponentType::PET)) {
outBitStream->Write1();

View File

@@ -17,7 +17,7 @@ public:
ModelComponent(Entity* parent);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
/**
* Returns the original position of the model

View File

@@ -46,7 +46,7 @@ const std::u16string& ModuleAssemblyComponent::GetAssemblyPartsLOTs() const {
return m_AssemblyPartsLOTs;
}
void ModuleAssemblyComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void ModuleAssemblyComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
if (bIsInitialUpdate) {
outBitStream->Write1();

View File

@@ -17,7 +17,7 @@ public:
ModuleAssemblyComponent(Entity* parent);
~ModuleAssemblyComponent() override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
void Update(float deltaTime) override;
/**

View File

@@ -32,7 +32,7 @@ MoverSubComponent::MoverSubComponent(const NiPoint3& startPos) {
MoverSubComponent::~MoverSubComponent() = default;
void MoverSubComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) const {
void MoverSubComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
outBitStream->Write<bool>(true);
outBitStream->Write<uint32_t>(static_cast<uint32_t>(mState));
@@ -71,7 +71,7 @@ MovingPlatformComponent::~MovingPlatformComponent() {
delete static_cast<MoverSubComponent*>(m_MoverSubComponent);
}
void MovingPlatformComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void MovingPlatformComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
// Here we don't serialize the moving platform to let the client simulate the movement
if (!m_Serialize) {
@@ -112,7 +112,7 @@ void MovingPlatformComponent::Serialize(RakNet::BitStream* outBitStream, bool bI
if (m_MoverSubComponentType == eMoverSubComponentType::simpleMover) {
// TODO
} else {
mover->Serialize(outBitStream, bIsInitialUpdate, flags);
mover->Serialize(outBitStream, bIsInitialUpdate);
}
}
}

View File

@@ -38,7 +38,7 @@ public:
MoverSubComponent(const NiPoint3& startPos);
~MoverSubComponent();
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) const;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate);
/**
* The state the platform is currently in
@@ -111,7 +111,7 @@ public:
MovingPlatformComponent(Entity* parent, const std::string& pathName);
~MovingPlatformComponent() override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
/**
* Stops all pathing, called when an entity starts a quick build associated with this platform

View File

@@ -107,7 +107,7 @@ PetComponent::PetComponent(Entity* parent, uint32_t componentId): Component(pare
result.finalize();
}
void PetComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void PetComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
const bool tamed = m_Owner != LWOOBJID_EMPTY;
outBitStream->Write1(); // Always serialize as dirty for now

View File

@@ -26,7 +26,7 @@ public:
explicit PetComponent(Entity* parentEntity, uint32_t componentId);
~PetComponent() override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
void Update(float deltaTime) override;
/**

View File

@@ -306,7 +306,7 @@ void PhantomPhysicsComponent::CreatePhysics() {
m_HasCreatedPhysics = true;
}
void PhantomPhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void PhantomPhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
outBitStream->Write(m_PositionInfoDirty || bIsInitialUpdate);
if (m_PositionInfoDirty || bIsInitialUpdate) {
outBitStream->Write(m_Position.x);
@@ -348,11 +348,6 @@ void PhantomPhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bI
}
}
void PhantomPhysicsComponent::ResetFlags() {
m_EffectInfoDirty = false;
m_PositionInfoDirty = false;
}
void PhantomPhysicsComponent::Update(float deltaTime) {
if (!m_dpEntity) return;

View File

@@ -32,8 +32,7 @@ public:
PhantomPhysicsComponent(Entity* parent);
~PhantomPhysicsComponent() override;
void Update(float deltaTime) override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void ResetFlags();
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
/**
* Creates the physics shape for this entity based on LDF data

View File

@@ -6,7 +6,7 @@ PlayerForcedMovementComponent::PlayerForcedMovementComponent(Entity* parent) : C
PlayerForcedMovementComponent::~PlayerForcedMovementComponent() {}
void PlayerForcedMovementComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void PlayerForcedMovementComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
outBitStream->Write(m_DirtyInfo || bIsInitialUpdate);
if (m_DirtyInfo || bIsInitialUpdate) {
outBitStream->Write(m_PlayerOnRail);

View File

@@ -19,7 +19,7 @@ public:
PlayerForcedMovementComponent(Entity* parent);
~PlayerForcedMovementComponent() override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
/**
* @brief Set the Player On Rail object

View File

@@ -27,7 +27,7 @@ PossessableComponent::PossessableComponent(Entity* parent, uint32_t componentId)
result.finalize();
}
void PossessableComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void PossessableComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
outBitStream->Write(m_DirtyPossessable || bIsInitialUpdate);
if (m_DirtyPossessable || bIsInitialUpdate) {
m_DirtyPossessable = false; // reset flag

View File

@@ -18,7 +18,7 @@ public:
PossessableComponent(Entity* parentEntity, uint32_t componentId);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
/**
* @brief mounts the Entity

View File

@@ -26,7 +26,7 @@ PossessorComponent::~PossessorComponent() {
}
}
void PossessorComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void PossessorComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
outBitStream->Write(m_DirtyPossesor || bIsInitialUpdate);
if (m_DirtyPossesor || bIsInitialUpdate) {
m_DirtyPossesor = false;

View File

@@ -23,7 +23,7 @@ public:
PossessorComponent(Entity* parent);
~PossessorComponent() override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
/**
* @brief Mounts the entity

View File

@@ -424,9 +424,7 @@ void RacingControlComponent::HandleMessageBoxResponse(Entity* player, int32_t bu
}
}
void RacingControlComponent::Serialize(RakNet::BitStream* outBitStream,
bool bIsInitialUpdate,
unsigned int& flags) {
void RacingControlComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
// BEGIN Scripted Activity
outBitStream->Write1();

View File

@@ -110,8 +110,8 @@ public:
RacingControlComponent(Entity* parentEntity);
~RacingControlComponent();
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Update(float deltaTime);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
void Update(float deltaTime) override;
/**
* Invoked when a player loads into the zone.

View File

@@ -57,7 +57,7 @@ RebuildComponent::~RebuildComponent() {
DespawnActivator();
}
void RebuildComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void RebuildComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
if (m_Parent->GetComponent(eReplicaComponentType::DESTROYABLE) == nullptr) {
if (bIsInitialUpdate) {
outBitStream->Write(false);

View File

@@ -27,7 +27,7 @@ public:
RebuildComponent(Entity* entity);
~RebuildComponent() override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
void Update(float deltaTime) override;
/**

View File

@@ -54,7 +54,7 @@ RenderComponent::~RenderComponent() {
m_Effects.clear();
}
void RenderComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void RenderComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
if (!bIsInitialUpdate) return;
outBitStream->Write<uint32_t>(m_Effects.size());

View File

@@ -61,7 +61,7 @@ public:
RenderComponent(Entity* entity, int32_t componentId = -1);
~RenderComponent() override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
void Update(float deltaTime) override;
/**

View File

@@ -15,7 +15,7 @@ RigidbodyPhantomPhysicsComponent::RigidbodyPhantomPhysicsComponent(Entity* paren
RigidbodyPhantomPhysicsComponent::~RigidbodyPhantomPhysicsComponent() {
}
void RigidbodyPhantomPhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void RigidbodyPhantomPhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
outBitStream->Write(m_IsDirty || bIsInitialUpdate);
if (m_IsDirty || bIsInitialUpdate) {
outBitStream->Write(m_Position.x);

View File

@@ -24,7 +24,7 @@ public:
RigidbodyPhantomPhysicsComponent(Entity* parent);
~RigidbodyPhantomPhysicsComponent() override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
/**
* Returns the position of this entity

View File

@@ -82,7 +82,7 @@ ScriptedActivityComponent::ScriptedActivityComponent(Entity* parent, int activit
ScriptedActivityComponent::~ScriptedActivityComponent()
= default;
void ScriptedActivityComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) const {
void ScriptedActivityComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
outBitStream->Write(true);
outBitStream->Write<uint32_t>(m_ActivityPlayers.size());

View File

@@ -162,7 +162,7 @@ public:
~ScriptedActivityComponent() override;
void Update(float deltaTime) override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) const;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
/**
* Makes some entity join the minigame, if it's a lobbied one, the entity will be placed in the lobby

View File

@@ -17,7 +17,7 @@ void ShootingGalleryComponent::SetDynamicParams(const DynamicShootingGalleryPara
Game::entityManager->SerializeEntity(m_Parent);
}
void ShootingGalleryComponent::Serialize(RakNet::BitStream* outBitStream, bool isInitialUpdate, uint32_t& flags) const {
void ShootingGalleryComponent::Serialize(RakNet::BitStream* outBitStream, bool isInitialUpdate) {
// Start ScriptedActivityComponent
outBitStream->Write<bool>(true);
if (m_CurrentPlayerID == LWOOBJID_EMPTY) {

View File

@@ -77,7 +77,7 @@ public:
explicit ShootingGalleryComponent(Entity* parent);
~ShootingGalleryComponent();
void Serialize(RakNet::BitStream* outBitStream, bool isInitialUpdate, uint32_t& flags) const;
void Serialize(RakNet::BitStream* outBitStream, bool isInitialUpdate) override;
/**
* Returns the static params for the shooting gallery

View File

@@ -33,7 +33,7 @@ SimplePhysicsComponent::SimplePhysicsComponent(uint32_t componentID, Entity* par
SimplePhysicsComponent::~SimplePhysicsComponent() {
}
void SimplePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void SimplePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
if (bIsInitialUpdate) {
outBitStream->Write(m_ClimbableType != eClimbableType::CLIMBABLE_TYPE_NOT);
outBitStream->Write(m_ClimbableType);

View File

@@ -33,7 +33,7 @@ public:
SimplePhysicsComponent(uint32_t componentID, Entity* parent);
~SimplePhysicsComponent() override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
/**
* Returns the position of this entity

View File

@@ -485,7 +485,7 @@ SkillComponent::~SkillComponent() {
Reset();
}
void SkillComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void SkillComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
if (bIsInitialUpdate) outBitStream->Write0();
}

View File

@@ -64,7 +64,7 @@ public:
explicit SkillComponent(Entity* parent);
~SkillComponent() override;
static void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
/**
* Computes skill updates. Invokes CalculateUpdate.

View File

@@ -55,7 +55,7 @@ SoundTriggerComponent::SoundTriggerComponent(Entity* parent) : Component(parent)
if (!mixerName.empty()) this->m_MixerPrograms.push_back(MixerProgram(mixerName));
}
void SoundTriggerComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void SoundTriggerComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
outBitStream->Write(this->m_Dirty || bIsInitialUpdate);
if (this->m_Dirty || bIsInitialUpdate) {
outBitStream->Write<uint8_t>(this->m_MusicCues.size());

View File

@@ -59,9 +59,8 @@ struct MixerProgram{
class SoundTriggerComponent : public Component {
public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::SOUND_TRIGGER;
explicit SoundTriggerComponent(Entity* parent);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
void ActivateMusicCue(const std::string& name, float bordemTime = -1.0);
void DeactivateMusicCue(const std::string& name);

View File

@@ -21,7 +21,7 @@ SwitchComponent::~SwitchComponent() {
}
}
void SwitchComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void SwitchComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
outBitStream->Write(m_Active);
}

View File

@@ -25,7 +25,7 @@ public:
Entity* GetParentEntity() const;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
/**
* Sets whether the switch is on or off.

View File

@@ -72,7 +72,7 @@ void VehiclePhysicsComponent::SetDirtyAngularVelocity(bool val) {
m_DirtyAngularVelocity = val;
}
void VehiclePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void VehiclePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
outBitStream->Write(bIsInitialUpdate || m_DirtyPosition);
if (bIsInitialUpdate || m_DirtyPosition) {

View File

@@ -33,7 +33,7 @@ public:
VehiclePhysicsComponent(Entity* parentEntity);
~VehiclePhysicsComponent() override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
void Update(float deltaTime) override;

View File

@@ -16,7 +16,7 @@ VendorComponent::VendorComponent(Entity* parent) : Component(parent) {
RefreshInventory(true);
}
void VendorComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
void VendorComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
outBitStream->Write(bIsInitialUpdate || m_DirtyVendor);
if (bIsInitialUpdate || m_DirtyVendor) {
outBitStream->Write(m_HasStandardCostItems);

View File

@@ -22,7 +22,9 @@ class VendorComponent : public Component {
public:
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::VENDOR;
VendorComponent(Entity* parent);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
void OnUse(Entity* originator) override;
void RefreshInventory(bool isCreation = false);
void SetupConstants();

View File

@@ -42,9 +42,10 @@ Mission::Mission(MissionComponent* missionComponent, const uint32_t missionId) {
auto* missionsTable = CDClientManager::Instance().GetTable<CDMissionsTable>();
info = missionsTable->GetPtrByMissionID(missionId);
auto* mis = missionsTable->GetPtrByMissionID(missionId);
info = *mis;
if (info == &CDMissionsTable::Default) {
if (mis == &CDMissionsTable::Default) {
Game::logger->Log("Missions", "Failed to find mission (%i)!", missionId);
return;
@@ -137,7 +138,7 @@ void Mission::UpdateXml(tinyxml2::XMLElement* element) {
element->DeleteChildren();
element->SetAttribute("id", static_cast<unsigned int>(info->id));
element->SetAttribute("id", static_cast<unsigned int>(info.id));
if (m_Completions > 0) {
element->SetAttribute("cct", static_cast<unsigned int>(m_Completions));
@@ -212,11 +213,11 @@ User* Mission::GetUser() const {
}
uint32_t Mission::GetMissionId() const {
return info->id;
return info.id;
}
const CDMissions& Mission::GetClientInfo() const {
return *info;
return info;
}
uint32_t Mission::GetCompletions() const {
@@ -240,15 +241,15 @@ eMissionState Mission::GetMissionState() const {
}
bool Mission::IsAchievement() const {
return !info->isMission;
return !info.isMission;
}
bool Mission::IsMission() const {
return info->isMission;
return info.isMission;
}
bool Mission::IsRepeatable() const {
return info->repeatable;
return info.repeatable;
}
bool Mission::IsComplete() const {
@@ -284,7 +285,7 @@ void Mission::MakeAvalible() {
}
void Mission::Accept() {
SetMissionTypeState(eMissionLockState::NEW, info->defined_type, info->defined_subtype);
SetMissionTypeState(eMissionLockState::NEW, info.defined_type, info.defined_subtype);
SetMissionState(m_Completions > 0 ? eMissionState::COMPLETE_ACTIVE : eMissionState::ACTIVE);
@@ -321,16 +322,16 @@ void Mission::Complete(const bool yieldRewards) {
auto* characterComponent = entity->GetComponent<CharacterComponent>();
if (characterComponent != nullptr) {
characterComponent->TrackMissionCompletion(!info->isMission);
characterComponent->TrackMissionCompletion(!info.isMission);
}
auto* missionComponent = entity->GetComponent<MissionComponent>();
missionComponent->Progress(eMissionTaskType::META, info->id);
missionComponent->Progress(eMissionTaskType::META, info.id);
missionComponent->Progress(eMissionTaskType::RACING, info->id, (LWOOBJID)eRacingTaskParam::COMPLETE_ANY_RACING_TASK);
missionComponent->Progress(eMissionTaskType::RACING, info.id, (LWOOBJID)eRacingTaskParam::COMPLETE_ANY_RACING_TASK);
missionComponent->Progress(eMissionTaskType::RACING, info->id, (LWOOBJID)eRacingTaskParam::COMPLETE_TRACK_TASKS);
missionComponent->Progress(eMissionTaskType::RACING, info.id, (LWOOBJID)eRacingTaskParam::COMPLETE_TRACK_TASKS);
auto* missionEmailTable = CDClientManager::Instance().GetTable<CDMissionEmailTable>();
@@ -441,24 +442,24 @@ void Mission::YieldRewards() {
}
int32_t coinsToSend = 0;
if (info->LegoScore > 0) {
eLootSourceType lootSource = info->isMission ? eLootSourceType::MISSION : eLootSourceType::ACHIEVEMENT;
if (info.LegoScore > 0) {
eLootSourceType lootSource = info.isMission ? eLootSourceType::MISSION : eLootSourceType::ACHIEVEMENT;
if (levelComponent->GetLevel() >= Game::zoneManager->GetWorldConfig()->levelCap) {
// Since the character is at the level cap we reward them with coins instead of UScore.
coinsToSend += info->LegoScore * Game::zoneManager->GetWorldConfig()->levelCapCurrencyConversion;
coinsToSend += info.LegoScore * Game::zoneManager->GetWorldConfig()->levelCapCurrencyConversion;
} else {
characterComponent->SetUScore(characterComponent->GetUScore() + info->LegoScore);
GameMessages::SendModifyLEGOScore(entity, entity->GetSystemAddress(), info->LegoScore, lootSource);
characterComponent->SetUScore(characterComponent->GetUScore() + info.LegoScore);
GameMessages::SendModifyLEGOScore(entity, entity->GetSystemAddress(), info.LegoScore, lootSource);
}
}
if (m_Completions > 0) {
std::vector<std::pair<LOT, uint32_t>> items;
items.emplace_back(info->reward_item1_repeatable, info->reward_item1_repeat_count);
items.emplace_back(info->reward_item2_repeatable, info->reward_item2_repeat_count);
items.emplace_back(info->reward_item3_repeatable, info->reward_item3_repeat_count);
items.emplace_back(info->reward_item4_repeatable, info->reward_item4_repeat_count);
items.emplace_back(info.reward_item1_repeatable, info.reward_item1_repeat_count);
items.emplace_back(info.reward_item2_repeatable, info.reward_item2_repeat_count);
items.emplace_back(info.reward_item3_repeatable, info.reward_item3_repeat_count);
items.emplace_back(info.reward_item4_repeatable, info.reward_item4_repeat_count);
for (const auto& pair : items) {
// Some missions reward zero of an item and so they must be allowed through this clause,
@@ -478,9 +479,9 @@ void Mission::YieldRewards() {
inventoryComponent->AddItem(pair.first, count, IsMission() ? eLootSourceType::MISSION : eLootSourceType::ACHIEVEMENT);
}
if (info->reward_currency_repeatable > 0 || coinsToSend > 0) {
eLootSourceType lootSource = info->isMission ? eLootSourceType::MISSION : eLootSourceType::ACHIEVEMENT;
character->SetCoins(character->GetCoins() + info->reward_currency_repeatable + coinsToSend, lootSource);
if (info.reward_currency_repeatable > 0 || coinsToSend > 0) {
eLootSourceType lootSource = info.isMission ? eLootSourceType::MISSION : eLootSourceType::ACHIEVEMENT;
character->SetCoins(character->GetCoins() + info.reward_currency_repeatable + coinsToSend, lootSource);
}
return;
@@ -488,10 +489,10 @@ void Mission::YieldRewards() {
std::vector<std::pair<LOT, int32_t>> items;
items.emplace_back(info->reward_item1, info->reward_item1_count);
items.emplace_back(info->reward_item2, info->reward_item2_count);
items.emplace_back(info->reward_item3, info->reward_item3_count);
items.emplace_back(info->reward_item4, info->reward_item4_count);
items.emplace_back(info.reward_item1, info.reward_item1_count);
items.emplace_back(info.reward_item2, info.reward_item2_count);
items.emplace_back(info.reward_item3, info.reward_item3_count);
items.emplace_back(info.reward_item4, info.reward_item4_count);
for (const auto& pair : items) {
// Some missions reward zero of an item and so they must be allowed through this clause,
@@ -511,58 +512,58 @@ void Mission::YieldRewards() {
inventoryComponent->AddItem(pair.first, count, IsMission() ? eLootSourceType::MISSION : eLootSourceType::ACHIEVEMENT);
}
if (info->reward_currency > 0 || coinsToSend > 0) {
eLootSourceType lootSource = info->isMission ? eLootSourceType::MISSION : eLootSourceType::ACHIEVEMENT;
character->SetCoins(character->GetCoins() + info->reward_currency + coinsToSend, lootSource);
if (info.reward_currency > 0 || coinsToSend > 0) {
eLootSourceType lootSource = info.isMission ? eLootSourceType::MISSION : eLootSourceType::ACHIEVEMENT;
character->SetCoins(character->GetCoins() + info.reward_currency + coinsToSend, lootSource);
}
if (info->reward_maxinventory > 0) {
if (info.reward_maxinventory > 0) {
auto* inventory = inventoryComponent->GetInventory(ITEMS);
inventory->SetSize(inventory->GetSize() + info->reward_maxinventory);
inventory->SetSize(inventory->GetSize() + info.reward_maxinventory);
}
if (info->reward_bankinventory > 0) {
if (info.reward_bankinventory > 0) {
auto* inventory = inventoryComponent->GetInventory(eInventoryType::VAULT_ITEMS);
auto modelInventory = inventoryComponent->GetInventory(eInventoryType::VAULT_MODELS);
inventory->SetSize(inventory->GetSize() + info->reward_bankinventory);
modelInventory->SetSize(modelInventory->GetSize() + info->reward_bankinventory);
inventory->SetSize(inventory->GetSize() + info.reward_bankinventory);
modelInventory->SetSize(modelInventory->GetSize() + info.reward_bankinventory);
}
if (info->reward_reputation > 0) {
missionComponent->Progress(eMissionTaskType::EARN_REPUTATION, 0, 0L, "", info->reward_reputation);
if (info.reward_reputation > 0) {
missionComponent->Progress(eMissionTaskType::EARN_REPUTATION, 0, 0L, "", info.reward_reputation);
auto character = entity->GetComponent<CharacterComponent>();
if (character) {
character->SetReputation(character->GetReputation() + info->reward_reputation);
character->SetReputation(character->GetReputation() + info.reward_reputation);
GameMessages::SendUpdateReputation(entity->GetObjectID(), character->GetReputation(), entity->GetSystemAddress());
}
}
if (info->reward_maxhealth > 0) {
destroyableComponent->SetMaxHealth(destroyableComponent->GetMaxHealth() + static_cast<float>(info->reward_maxhealth), true);
if (info.reward_maxhealth > 0) {
destroyableComponent->SetMaxHealth(destroyableComponent->GetMaxHealth() + static_cast<float>(info.reward_maxhealth), true);
}
if (info->reward_maximagination > 0) {
destroyableComponent->SetMaxImagination(destroyableComponent->GetMaxImagination() + static_cast<float>(info->reward_maximagination), true);
if (info.reward_maximagination > 0) {
destroyableComponent->SetMaxImagination(destroyableComponent->GetMaxImagination() + static_cast<float>(info.reward_maximagination), true);
}
Game::entityManager->SerializeEntity(entity);
if (info->reward_emote > 0) {
character->UnlockEmote(info->reward_emote);
if (info.reward_emote > 0) {
character->UnlockEmote(info.reward_emote);
}
if (info->reward_emote2 > 0) {
character->UnlockEmote(info->reward_emote2);
if (info.reward_emote2 > 0) {
character->UnlockEmote(info.reward_emote2);
}
if (info->reward_emote3 > 0) {
character->UnlockEmote(info->reward_emote3);
if (info.reward_emote3 > 0) {
character->UnlockEmote(info.reward_emote3);
}
if (info->reward_emote4 > 0) {
character->UnlockEmote(info->reward_emote4);
if (info.reward_emote4 > 0) {
character->UnlockEmote(info.reward_emote4);
}
}
@@ -599,7 +600,7 @@ void Mission::SetMissionState(const eMissionState state, const bool sendingRewar
return;
}
GameMessages::SendNotifyMission(entity, entity->GetParentUser()->GetSystemAddress(), info->id, static_cast<int>(state), sendingRewards);
GameMessages::SendNotifyMission(entity, entity->GetParentUser()->GetSystemAddress(), info.id, static_cast<int>(state), sendingRewards);
}
void Mission::SetMissionTypeState(eMissionLockState state, const std::string& type, const std::string& subType) {

View File

@@ -245,7 +245,7 @@ private:
/**
* The database information that corresponds to this mission
*/
const CDMissions* info;
CDMissions info;
/**
* The current state this mission is in