From 22e115414fe7b81b1d77fe1dad37541c3f066833 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Fri, 27 Nov 2026 19:09:53 -0600 Subject: [PATCH] feat(activity): GetActivityUser, the first player with activity data Co-Authored-By: Claude Opus 5.5 --- dGame/dComponents/Activity/ActivityComponent.cpp | 4 ++++ dGame/dComponents/Activity/ActivityComponent.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/dGame/dComponents/Activity/ActivityComponent.cpp b/dGame/dComponents/Activity/ActivityComponent.cpp index d727cf1d2..aedf42625 100644 --- a/dGame/dComponents/Activity/ActivityComponent.cpp +++ b/dGame/dComponents/Activity/ActivityComponent.cpp @@ -275,6 +275,10 @@ float_t ActivityComponent::GetActivityValue(LWOOBJID playerID, uint32_t index) c return value; } +LWOOBJID ActivityComponent::GetActivityUser() const { + return m_ActivityPlayers.empty() ? LWOOBJID_EMPTY : m_ActivityPlayers.begin()->first; +} + void ActivityComponent::SetActivityValue(LWOOBJID playerID, uint32_t index, float_t value) { auto& data = m_ActivityPlayers[playerID]; data[std::min(index, static_cast(9))] = value; diff --git a/dGame/dComponents/Activity/ActivityComponent.h b/dGame/dComponents/Activity/ActivityComponent.h index 324ff2382..32916d2a0 100644 --- a/dGame/dComponents/Activity/ActivityComponent.h +++ b/dGame/dComponents/Activity/ActivityComponent.h @@ -268,6 +268,11 @@ public: */ float_t GetActivityValue(LWOOBJID playerID, uint32_t index) const; + /** + * The activity's user (GetActivityUser): the first player with activity data, or LWOOBJID_EMPTY when none has any + */ + LWOOBJID GetActivityUser() const; + /** * Removes activity score tracking for some entity * @param playerID the entity to remove score for