From 0e611bc76c070cd355fed57d94a43109d3fc6f40 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Thu, 1 Oct 2026 14:23:38 -0500 Subject: [PATCH] refactor(component): racing control and gate rush share the client's racing control base LWOBaseRacingControlComponent (an activity component) is the base of the client's racing control (71) and gate rush control (103); DLU gets the same BaseRacingControlComponent. Nothing sent changes. Co-Authored-By: Claude Opus 5.5 --- dGame/dComponents/BaseRacingControlComponent.h | 15 +++++++++++++++ dGame/dComponents/GateRushComponent.h | 9 +++++---- dGame/dComponents/RacingControlComponent.cpp | 4 ++-- dGame/dComponents/RacingControlComponent.h | 4 ++-- 4 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 dGame/dComponents/BaseRacingControlComponent.h diff --git a/dGame/dComponents/BaseRacingControlComponent.h b/dGame/dComponents/BaseRacingControlComponent.h new file mode 100644 index 000000000..9ffa69521 --- /dev/null +++ b/dGame/dComponents/BaseRacingControlComponent.h @@ -0,0 +1,15 @@ +#ifndef BASERACINGCONTROLCOMPONENT_H +#define BASERACINGCONTROLCOMPONENT_H + +#include "ActivityComponent.h" + +/** + * The base of the racing controls, as the client's LWOBaseRacingControlComponent: an activity component that racing + * control (71) and gate rush control (103) are built on (its function table extends the activity component's). + */ +class BaseRacingControlComponent : public ActivityComponent { +protected: + BaseRacingControlComponent(Entity* parent, const int32_t componentID) : ActivityComponent(parent, componentID) {} +}; + +#endif // BASERACINGCONTROLCOMPONENT_H diff --git a/dGame/dComponents/GateRushComponent.h b/dGame/dComponents/GateRushComponent.h index ea4ba8050..21f5c980a 100644 --- a/dGame/dComponents/GateRushComponent.h +++ b/dGame/dComponents/GateRushComponent.h @@ -1,17 +1,18 @@ #ifndef GATERUSHCOMPONENT_H #define GATERUSHCOMPONENT_H -#include "Component.h" +#include "BaseRacingControlComponent.h" #include "eReplicaComponentType.h" /** - * Gate rush, as the client's LWOGateRushComponent makes it from the registry. Nothing of it is sent or done on the server yet. + * Gate rush control, as the client's LWOGateRushControlComponent makes it from the registry: a racing control + * (BaseRacingControlComponent). Nothing of it is sent or done on the server yet. */ -class GateRushComponent final : public Component { +class GateRushComponent final : public BaseRacingControlComponent { public: static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::GATE_RUSH_CONTROL; - GateRushComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {} + GateRushComponent(Entity* parent, const int32_t componentID) : BaseRacingControlComponent(parent, componentID) {} }; #endif // GATERUSHCOMPONENT_H diff --git a/dGame/dComponents/RacingControlComponent.cpp b/dGame/dComponents/RacingControlComponent.cpp index 700347b20..63fbdb8d2 100644 --- a/dGame/dComponents/RacingControlComponent.cpp +++ b/dGame/dComponents/RacingControlComponent.cpp @@ -38,7 +38,7 @@ #endif RacingControlComponent::RacingControlComponent(Entity* parent, const int32_t componentID) - : ActivityComponent(parent, componentID) { + : BaseRacingControlComponent(parent, componentID) { m_PathName = u"MainPath"; m_NumberOfLaps = 3; m_RemainingLaps = m_NumberOfLaps; @@ -63,7 +63,7 @@ RacingControlComponent::RacingControlComponent(Entity* parent, const int32_t com // After the activity's own loading: the race's activity is the one of this world (42 when none) void RacingControlComponent::LoadConfigData() { - ActivityComponent::LoadConfigData(); + BaseRacingControlComponent::LoadConfigData(); const auto worldID = Game::server->GetZoneID(); m_ActivityID = 42; diff --git a/dGame/dComponents/RacingControlComponent.h b/dGame/dComponents/RacingControlComponent.h index c7a5a34c4..e99aed481 100644 --- a/dGame/dComponents/RacingControlComponent.h +++ b/dGame/dComponents/RacingControlComponent.h @@ -6,7 +6,7 @@ #include "BitStream.h" #include "Entity.h" -#include "ActivityComponent.h" +#include "BaseRacingControlComponent.h" #include "eReplicaComponentType.h" #include @@ -121,7 +121,7 @@ struct RacingPlayerInfo { struct Path; struct PathWaypoint; -class RacingControlComponent final : public ActivityComponent { +class RacingControlComponent final : public BaseRacingControlComponent { public: static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::RACING_CONTROL;