Remove shared pointer, ODR of componentType variable

This commit is contained in:
David Markowitz 2023-06-09 01:22:45 -07:00
parent ec00f5fd9d
commit 62aa863997
49 changed files with 60 additions and 75 deletions

View File

@ -102,7 +102,6 @@ Entity::Entity(const LWOOBJID& objectID, EntityInfo info, Entity* parentEntity)
m_ChildEntities = {}; m_ChildEntities = {};
m_ScheduleKiller = nullptr; m_ScheduleKiller = nullptr;
m_TargetsInPhantom = {}; m_TargetsInPhantom = {};
m_Components = {};
m_DieCallbacks = {}; m_DieCallbacks = {};
m_PhantomCollisionCallbacks = {}; m_PhantomCollisionCallbacks = {};
m_IsParentChildDirty = true; m_IsParentChildDirty = true;

View File

@ -48,7 +48,7 @@ namespace CppScripts {
* Entities are composed of components which define their behavior. * Entities are composed of components which define their behavior.
*/ */
using ComponentPtr = std::shared_ptr<Component>; using ComponentPtr = std::unique_ptr<Component>;
class Entity { class Entity {
public: public:
@ -278,15 +278,6 @@ public:
template<typename Cmpt> template<typename Cmpt>
Cmpt* GetComponent() const; Cmpt* GetComponent() const;
/**
* @brief Get an owning reference to a component.
*
* @tparam Cmpt The component to get a shared reference of
* @return std::shared_ptr<Cmpt> The owning shared pointer
*/
template<typename Cmpt>
std::shared_ptr<Cmpt> GetSharedComponent() const;
/** /**
* @brief Adds a component to this Entity. * @brief Adds a component to this Entity.
* *

View File

@ -9,10 +9,15 @@ Cmpt* Entity::GetComponent() const {
const auto& componentItr = this->m_Components.find(Cmpt::ComponentType); const auto& componentItr = this->m_Components.find(Cmpt::ComponentType);
return componentItr == this->m_Components.end() ? nullptr : dynamic_cast<Cmpt*>(componentItr->second.get()); return componentItr == this->m_Components.end() ? nullptr : dynamic_cast<Cmpt*>(componentItr->second.get());
} }
template<typename Cmpt>
std::shared_ptr<Cmpt> Entity::GetSharedComponent() const { template<typename Cmpt, typename...ConstructorValues>
const auto& componentItr = this->m_Components.find(Cmpt::ComponentType); Cmpt* Entity::AddComponent(ConstructorValues...arguments) {
return componentItr == this->m_Components.end() ? nullptr : std::dynamic_pointer_cast<Cmpt>(componentItr->second); auto component = GetComponent<Cmpt>();
if (component) return dynamic_cast<Cmpt*>(component);
auto& insertedComponent = m_Components.insert_or_assign(Cmpt::ComponentType,
std::make_unique<Cmpt>(this, std::forward<ConstructorValues>(arguments)...)).first->second;
return dynamic_cast<Cmpt*>(insertedComponent.get());
} }
template<typename T> template<typename T>
@ -146,13 +151,3 @@ T Entity::GetNetworkVar(const std::u16string& name) {
return LDFData<T>::Default; return LDFData<T>::Default;
} }
template<typename Cmpt, typename...ConstructorValues>
Cmpt* Entity::AddComponent(ConstructorValues...arguments) {
auto component = GetComponent<Cmpt>();
if (component) return dynamic_cast<Cmpt*>(component);
auto& insertedComponent = m_Components.insert_or_assign(Cmpt::ComponentType,
std::make_shared<Cmpt>(this, std::forward<ConstructorValues>(arguments)...)).first->second;
return dynamic_cast<Cmpt*>(insertedComponent.get());
}

View File

@ -190,7 +190,7 @@ void BaseCombatAIComponent::Update(const float deltaTime) {
} }
if (m_MovementAI == nullptr) { if (m_MovementAI == nullptr) {
m_MovementAI = m_OwningEntity->GetSharedComponent<MovementAIComponent>(); m_MovementAI = m_OwningEntity->GetComponent<MovementAIComponent>();
if (m_MovementAI == nullptr) { if (m_MovementAI == nullptr) {
return; return;
} }

View File

@ -48,7 +48,7 @@ struct AiSkillEntry
*/ */
class BaseCombatAIComponent : public Component { class BaseCombatAIComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::BASE_COMBAT_AI; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::BASE_COMBAT_AI;
BaseCombatAIComponent(Entity* parentEntity, uint32_t id); BaseCombatAIComponent(Entity* parentEntity, uint32_t id);
~BaseCombatAIComponent() override; ~BaseCombatAIComponent() override;
@ -320,7 +320,7 @@ private:
/** /**
* The component that handles movement AI, also owned by this entity * The component that handles movement AI, also owned by this entity
*/ */
std::shared_ptr<MovementAIComponent> m_MovementAI; MovementAIComponent* m_MovementAI;
/** /**
* The position at which this entity spawned * The position at which this entity spawned

View File

@ -12,7 +12,7 @@
*/ */
class BouncerComponent : public Component { class BouncerComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::BOUNCER; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::BOUNCER;
BouncerComponent(Entity* parentEntity); BouncerComponent(Entity* parentEntity);
~BouncerComponent() override; ~BouncerComponent() override;

View File

@ -42,7 +42,7 @@ struct Buff
*/ */
class BuffComponent : public Component { class BuffComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::BUFF; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::BUFF;
explicit BuffComponent(Entity* parent); explicit BuffComponent(Entity* parent);

View File

@ -16,7 +16,7 @@
*/ */
class BuildBorderComponent : public Component { class BuildBorderComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::BUILD_BORDER; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::BUILD_BORDER;
BuildBorderComponent(Entity* parent); BuildBorderComponent(Entity* parent);
~BuildBorderComponent() override; ~BuildBorderComponent() override;

View File

@ -62,7 +62,7 @@ enum StatisticID {
*/ */
class CharacterComponent : public Component { class CharacterComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::CHARACTER; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::CHARACTER;
CharacterComponent(Entity* parent, Character* character); CharacterComponent(Entity* parent, Character* character);
~CharacterComponent() override; ~CharacterComponent() override;

View File

@ -21,7 +21,7 @@ enum class eStateChangeType : uint32_t;
*/ */
class ControllablePhysicsComponent : public Component { class ControllablePhysicsComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::CONTROLLABLE_PHYSICS; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::CONTROLLABLE_PHYSICS;
ControllablePhysicsComponent(Entity* entity); ControllablePhysicsComponent(Entity* entity);
~ControllablePhysicsComponent() override; ~ControllablePhysicsComponent() override;

View File

@ -10,7 +10,7 @@
*/ */
class HavokVehiclePhysicsComponent : public Component { class HavokVehiclePhysicsComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::HAVOK_VEHICLE_PHYSICS; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::HAVOK_VEHICLE_PHYSICS;
HavokVehiclePhysicsComponent(Entity* parentEntity); HavokVehiclePhysicsComponent(Entity* parentEntity);
~HavokVehiclePhysicsComponent() override; ~HavokVehiclePhysicsComponent() override;

View File

@ -38,7 +38,7 @@ enum class eItemType : int32_t;
class InventoryComponent : public Component class InventoryComponent : public Component
{ {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::INVENTORY; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::INVENTORY;
explicit InventoryComponent(Entity* parent, tinyxml2::XMLDocument* document = nullptr); explicit InventoryComponent(Entity* parent, tinyxml2::XMLDocument* document = nullptr);
void Update(float deltaTime) override; void Update(float deltaTime) override;

View File

@ -11,7 +11,7 @@
class LUPExhibitComponent : public Component class LUPExhibitComponent : public Component
{ {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::EXHIBIT; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::EXHIBIT;
LUPExhibitComponent(Entity* parent); LUPExhibitComponent(Entity* parent);
~LUPExhibitComponent(); ~LUPExhibitComponent();

View File

@ -13,7 +13,7 @@
class LevelProgressionComponent : public Component { class LevelProgressionComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::LEVEL_PROGRESSION; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::LEVEL_PROGRESSION;
/** /**
* Constructor for this component * Constructor for this component

View File

@ -27,7 +27,7 @@ class AchievementCacheKey;
class MissionComponent : public Component class MissionComponent : public Component
{ {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::MISSION; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::MISSION;
explicit MissionComponent(Entity* parent); explicit MissionComponent(Entity* parent);
~MissionComponent() override; ~MissionComponent() override;

View File

@ -61,7 +61,7 @@ private:
*/ */
class MissionOfferComponent : public Component { class MissionOfferComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::MISSION_OFFER; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::MISSION_OFFER;
MissionOfferComponent(Entity* parent, LOT parentLot); MissionOfferComponent(Entity* parent, LOT parentLot);
~MissionOfferComponent() override; ~MissionOfferComponent() override;

View File

@ -13,7 +13,7 @@ class Entity;
*/ */
class ModelBehaviorComponent : public Component { class ModelBehaviorComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::MODEL_BEHAVIOR; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::MODEL_BEHAVIOR;
ModelBehaviorComponent(Entity* parent); ModelBehaviorComponent(Entity* parent);

View File

@ -12,7 +12,7 @@
*/ */
class ModuleAssemblyComponent : public Component { class ModuleAssemblyComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::MODULE_ASSEMBLY; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::MODULE_ASSEMBLY;
ModuleAssemblyComponent(Entity* parent); ModuleAssemblyComponent(Entity* parent);
~ModuleAssemblyComponent() override; ~ModuleAssemblyComponent() override;

View File

@ -22,7 +22,7 @@ MovementAIComponent::MovementAIComponent(Entity* parent, MovementAIInfo info) :
m_BaseCombatAI = nullptr; m_BaseCombatAI = nullptr;
m_BaseCombatAI = m_OwningEntity->GetSharedComponent<BaseCombatAIComponent>(); m_BaseCombatAI = m_OwningEntity->GetComponent<BaseCombatAIComponent>();
//Try and fix the insane values: //Try and fix the insane values:
if (m_Info.wanderRadius > 5.0f) m_Info.wanderRadius = m_Info.wanderRadius * 0.5f; if (m_Info.wanderRadius > 5.0f) m_Info.wanderRadius = m_Info.wanderRadius * 0.5f;

View File

@ -310,7 +310,7 @@ private:
/** /**
* Optional direct link to the combat AI component of the parent entity * Optional direct link to the combat AI component of the parent entity
*/ */
std::shared_ptr<BaseCombatAIComponent> m_BaseCombatAI = nullptr; BaseCombatAIComponent* m_BaseCombatAI = nullptr;
/** /**
* The path the entity is currently following * The path the entity is currently following

View File

@ -106,7 +106,7 @@ public:
*/ */
class MovingPlatformComponent : public Component { class MovingPlatformComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::MOVING_PLATFORM; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::MOVING_PLATFORM;
MovingPlatformComponent(Entity* parent, const std::string& pathName); MovingPlatformComponent(Entity* parent, const std::string& pathName);
~MovingPlatformComponent() override; ~MovingPlatformComponent() override;

View File

@ -11,7 +11,7 @@
*/ */
class MultiZoneEntranceComponent : public Component { class MultiZoneEntranceComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::MULTI_ZONE_ENTRANCE; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::MULTI_ZONE_ENTRANCE;
/** /**
* Constructor for this component, builds the m_LUPWorlds vector * Constructor for this component, builds the m_LUPWorlds vector

View File

@ -363,7 +363,7 @@ void PetComponent::Update(float deltaTime) {
} }
if (m_MovementAI == nullptr) { if (m_MovementAI == nullptr) {
m_MovementAI = m_OwningEntity->GetSharedComponent<MovementAIComponent>(); m_MovementAI = m_OwningEntity->GetComponent<MovementAIComponent>();
if (!m_MovementAI) return; if (!m_MovementAI) return;
} }
@ -792,7 +792,7 @@ void PetComponent::ClientFailTamingMinigame() {
} }
void PetComponent::Wander() { void PetComponent::Wander() {
if (!m_MovementAI) m_MovementAI = m_OwningEntity->GetSharedComponent<MovementAIComponent>(); if (!m_MovementAI) m_MovementAI = m_OwningEntity->GetComponent<MovementAIComponent>();
if (m_MovementAI == nullptr || !m_MovementAI->AtFinalWaypoint()) { if (m_MovementAI == nullptr || !m_MovementAI->AtFinalWaypoint()) {
return; return;

View File

@ -21,7 +21,7 @@ enum class PetAbilityType
class PetComponent : public Component class PetComponent : public Component
{ {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::PET; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::PET;
explicit PetComponent(Entity* parentEntity, uint32_t componentId); explicit PetComponent(Entity* parentEntity, uint32_t componentId);
~PetComponent() override; ~PetComponent() override;
@ -349,7 +349,7 @@ private:
/** /**
* The movement AI component that is related to this pet, required to move it around * The movement AI component that is related to this pet, required to move it around
*/ */
std::shared_ptr<MovementAIComponent> m_MovementAI; MovementAIComponent* m_MovementAI;
/** /**
* Preconditions that need to be met before an entity can tame this pet * Preconditions that need to be met before an entity can tame this pet

View File

@ -27,7 +27,7 @@ enum class ePhysicsEffectType : uint32_t ;
*/ */
class PhantomPhysicsComponent : public Component { class PhantomPhysicsComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::PHANTOM_PHYSICS; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::PHANTOM_PHYSICS;
PhantomPhysicsComponent(Entity* parent); PhantomPhysicsComponent(Entity* parent);
~PhantomPhysicsComponent() override; ~PhantomPhysicsComponent() override;

View File

@ -10,7 +10,7 @@
*/ */
class PlayerForcedMovementComponent : public Component { class PlayerForcedMovementComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::PLAYER_FORCED_MOVEMENT; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::PLAYER_FORCED_MOVEMENT;
/** /**
* Constructor for this component * Constructor for this component

View File

@ -14,7 +14,7 @@
*/ */
class PossessableComponent : public Component { class PossessableComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::POSSESSABLE; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::POSSESSABLE;
PossessableComponent(Entity* parentEntity, uint32_t componentId); PossessableComponent(Entity* parentEntity, uint32_t componentId);

View File

@ -18,7 +18,7 @@ enum class ePossessionType : uint8_t {
*/ */
class PossessorComponent : public Component { class PossessorComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::POSSESSOR; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::POSSESSOR;
PossessorComponent(Entity* parent); PossessorComponent(Entity* parent);
~PossessorComponent() override; ~PossessorComponent() override;

View File

@ -22,7 +22,7 @@ struct PropertyState {
*/ */
class PropertyComponent : public Component { class PropertyComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY;
explicit PropertyComponent(Entity* parentEntity); explicit PropertyComponent(Entity* parentEntity);
~PropertyComponent() override; ~PropertyComponent() override;
[[nodiscard]] PropertyState* GetPropertyState() const { return m_PropertyState; }; [[nodiscard]] PropertyState* GetPropertyState() const { return m_PropertyState; };

View File

@ -13,7 +13,7 @@
*/ */
class PropertyEntranceComponent : public Component { class PropertyEntranceComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY_ENTRANCE; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY_ENTRANCE;
explicit PropertyEntranceComponent(uint32_t componentID, Entity* parent); explicit PropertyEntranceComponent(uint32_t componentID, Entity* parent);
/** /**

View File

@ -32,7 +32,7 @@ enum class PropertyPrivacyOption
class PropertyManagementComponent : public Component class PropertyManagementComponent : public Component
{ {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY_MANAGEMENT; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY_MANAGEMENT;
PropertyManagementComponent(Entity* parent); PropertyManagementComponent(Entity* parent);
static PropertyManagementComponent* Instance(); static PropertyManagementComponent* Instance();

View File

@ -10,7 +10,7 @@
class PropertyVendorComponent : public Component class PropertyVendorComponent : public Component
{ {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY_VENDOR; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY_VENDOR;
explicit PropertyVendorComponent(Entity* parent); explicit PropertyVendorComponent(Entity* parent);
/** /**

View File

@ -19,7 +19,7 @@
*/ */
class ProximityMonitorComponent : public Component { class ProximityMonitorComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::PROXIMITY_MONITOR; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::PROXIMITY_MONITOR;
ProximityMonitorComponent(Entity* parentEntity, int smallRadius = -1, int largeRadius = -1); ProximityMonitorComponent(Entity* parentEntity, int smallRadius = -1, int largeRadius = -1);
~ProximityMonitorComponent() override; ~ProximityMonitorComponent() override;

View File

@ -105,7 +105,7 @@ struct RacingPlayerInfo {
*/ */
class RacingControlComponent : public Component { class RacingControlComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::RACING_CONTROL; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::RACING_CONTROL;
RacingControlComponent(Entity* parentEntity); RacingControlComponent(Entity* parentEntity);
~RacingControlComponent(); ~RacingControlComponent();

View File

@ -15,7 +15,7 @@ public:
explicit RailActivatorComponent(Entity* parent, int32_t componentID); explicit RailActivatorComponent(Entity* parent, int32_t componentID);
~RailActivatorComponent() override; ~RailActivatorComponent() override;
static const eReplicaComponentType ComponentType = eReplicaComponentType::RAIL_ACTIVATOR; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::RAIL_ACTIVATOR;
/** /**
* Handles the OnUse event from some entity, initiates the rail movement * Handles the OnUse event from some entity, initiates the rail movement

View File

@ -22,7 +22,7 @@ enum class eQuickBuildFailReason : uint32_t;
*/ */
class RebuildComponent : public Component { class RebuildComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::QUICK_BUILD; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::QUICK_BUILD;
RebuildComponent(Entity* entity); RebuildComponent(Entity* entity);
~RebuildComponent() override; ~RebuildComponent() override;

View File

@ -56,7 +56,7 @@ struct Effect {
*/ */
class RenderComponent : public Component { class RenderComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::RENDER; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::RENDER;
RenderComponent(Entity* entity, int32_t componentId = -1); RenderComponent(Entity* entity, int32_t componentId = -1);
~RenderComponent() override; ~RenderComponent() override;

View File

@ -19,7 +19,7 @@
*/ */
class RigidbodyPhantomPhysicsComponent : public Component { class RigidbodyPhantomPhysicsComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::PHANTOM_PHYSICS; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::PHANTOM_PHYSICS;
RigidbodyPhantomPhysicsComponent(Entity* parent); RigidbodyPhantomPhysicsComponent(Entity* parent);
~RigidbodyPhantomPhysicsComponent() override; ~RigidbodyPhantomPhysicsComponent() override;

View File

@ -18,7 +18,7 @@ class PreconditionExpression;
*/ */
class RocketLaunchpadControlComponent : public Component { class RocketLaunchpadControlComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::ROCKET_LAUNCHPAD_CONTROL; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::ROCKET_LAUNCHPAD_CONTROL;
RocketLaunchpadControlComponent(Entity* parent, int rocketId); RocketLaunchpadControlComponent(Entity* parent, int rocketId);
~RocketLaunchpadControlComponent() override; ~RocketLaunchpadControlComponent() override;

View File

@ -156,7 +156,7 @@ struct ActivityPlayer {
*/ */
class ScriptedActivityComponent : public Component { class ScriptedActivityComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::SCRIPTED_ACTIVITY; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::SCRIPTED_ACTIVITY;
ScriptedActivityComponent(Entity* parent, int activityID); ScriptedActivityComponent(Entity* parent, int activityID);
~ScriptedActivityComponent() override; ~ScriptedActivityComponent() override;

View File

@ -73,7 +73,7 @@ struct StaticShootingGalleryParams {
*/ */
class ShootingGalleryComponent : public Component { class ShootingGalleryComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::SHOOTING_GALLERY; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::SHOOTING_GALLERY;
explicit ShootingGalleryComponent(Entity* parent); explicit ShootingGalleryComponent(Entity* parent);
~ShootingGalleryComponent(); ~ShootingGalleryComponent();

View File

@ -28,7 +28,7 @@ enum class eClimbableType : int32_t {
*/ */
class SimplePhysicsComponent : public Component { class SimplePhysicsComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::SIMPLE_PHYSICS; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::SIMPLE_PHYSICS;
SimplePhysicsComponent(uint32_t componentID, Entity* parent); SimplePhysicsComponent(uint32_t componentID, Entity* parent);
~SimplePhysicsComponent() override; ~SimplePhysicsComponent() override;

View File

@ -59,7 +59,7 @@ struct SkillExecutionResult {
*/ */
class SkillComponent : public Component { class SkillComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::SKILL; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::SKILL;
explicit SkillComponent(Entity* parent); explicit SkillComponent(Entity* parent);
~SkillComponent() override; ~SkillComponent() override;

View File

@ -20,7 +20,7 @@ struct MusicCue {
*/ */
class SoundTriggerComponent : public Component { class SoundTriggerComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::SOUND_TRIGGER; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::SOUND_TRIGGER;
explicit SoundTriggerComponent(Entity* parent); explicit SoundTriggerComponent(Entity* parent);
~SoundTriggerComponent() override; ~SoundTriggerComponent() override;

View File

@ -10,7 +10,7 @@ SwitchComponent::SwitchComponent(Entity* parent) : Component(parent) {
m_ResetTime = m_OwningEntity->GetVarAs<int32_t>(u"switch_reset_time"); m_ResetTime = m_OwningEntity->GetVarAs<int32_t>(u"switch_reset_time");
m_Rebuild = m_OwningEntity->GetSharedComponent<RebuildComponent>(); m_Rebuild = m_OwningEntity->GetComponent<RebuildComponent>();
} }
SwitchComponent::~SwitchComponent() { SwitchComponent::~SwitchComponent() {

View File

@ -16,7 +16,7 @@
*/ */
class SwitchComponent : public Component { class SwitchComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::SWITCH; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::SWITCH;
SwitchComponent(Entity* parent); SwitchComponent(Entity* parent);
~SwitchComponent() override; ~SwitchComponent() override;
@ -75,7 +75,7 @@ private:
/** /**
* Attached rebuild component. * Attached rebuild component.
*/ */
std::shared_ptr<RebuildComponent> m_Rebuild; RebuildComponent* m_Rebuild;
/** /**
* If the switch is on or off. * If the switch is on or off.

View File

@ -7,7 +7,7 @@
class TriggerComponent : public Component { class TriggerComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::TRIGGER; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::TRIGGER;
explicit TriggerComponent(Entity* parent, const std::string triggerInfo); explicit TriggerComponent(Entity* parent, const std::string triggerInfo);

View File

@ -14,7 +14,7 @@
*/ */
class VendorComponent : public Component { class VendorComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::VENDOR; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::VENDOR;
VendorComponent(Entity* parent); VendorComponent(Entity* parent);
~VendorComponent() override; ~VendorComponent() override;

View File

@ -19,7 +19,7 @@ class Entity;
*/ */
class ScriptComponent : public Component { class ScriptComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::SCRIPT; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::SCRIPT;
ScriptComponent(Entity* parent, std::string scriptName, bool serialized, bool client = false); ScriptComponent(Entity* parent, std::string scriptName, bool serialized, bool client = false);
~ScriptComponent() override; ~ScriptComponent() override;