DarkflameServer/dGame/dPropertyBehaviors/ControlBehaviorMessages/ActionContext.h
jadebenn b6af92ef81
refactor: Rewrite BehaviorMessage classes to use member initialization, preferred member naming conventions, and const-ref getters (#1456)
* Split out BehaviorMessage class changes from PR #1452

* remove <string_view> inclusion in ActionContext.h

* add the arguments nullptr check back in

* remove redundant std::string constructor calls

* Update AddStripMessage.cpp - change push_back to emplace_back
2024-02-18 00:38:26 -06:00

28 lines
963 B
C++

#ifndef __ACTIONCONTEXT__H__
#define __ACTIONCONTEXT__H__
#include "BehaviorStates.h"
#include "dCommonVars.h"
class AMFArrayValue;
/**
* @brief Sent if contextual State and Strip informationis needed for a ControlBehaviors message
*
*/
class ActionContext {
public:
ActionContext() noexcept = default;
ActionContext(const AMFArrayValue* arguments, const std::string& customStateKey = "stateID", const std::string& customStripKey = "stripID");
[[nodiscard]] StripId GetStripId() const noexcept { return m_StripId; };
[[nodiscard]] BehaviorState GetStateId() const noexcept { return m_StateId; };
private:
[[nodiscard]] BehaviorState GetBehaviorStateFromArgument(const AMFArrayValue* arguments, const std::string& key) const;
[[nodiscard]] StripId GetStripIdFromArgument(const AMFArrayValue* arguments, const std::string& key) const;
StripId m_StripId{ 0 };
BehaviorState m_StateId{ BehaviorState::HOME_STATE };
};
#endif //!__ACTIONCONTEXT__H__