DarkflameServer/dGame/dPropertyBehaviors/ControlBehaviorMessages/BehaviorMessageBase.h
jadebenn 29666a1ff7
chore: General cleanup roundup (#1444)
* Moved unrelated changes out of the TryParse PR branch

* const correctness and cstdint type usage

* removing a few "== nullptr"

* amf constexpr, const-correctness, and attrib tagging

* update to account for feedback

* Fixing accidentally included header and hopefully fixing the MacOS issue too

* try reordering the amf3 specializations to fix the MacOS issue again

* Amf3 template class member func instantiation fix

* try including only on macos

* Using if constexpr rather than specialization

* Trying a different solution for the instantiation problem

* Remove #include "dPlatforms.h"
2024-02-10 13:44:40 -06:00

29 lines
875 B
C++

#ifndef __BEHAVIORMESSAGEBASE__H__
#define __BEHAVIORMESSAGEBASE__H__
#include <stdexcept>
#include <string>
#include "Amf3.h"
#include "dCommonVars.h"
enum class BehaviorState : uint32_t;
/**
* @brief The behaviorID target of this ControlBehaviors message
*
*/
class BehaviorMessageBase {
public:
static constexpr int32_t DefaultBehaviorId = -1;
[[nodiscard]] int32_t GetBehaviorId() const { return behaviorId; };
[[nodiscard]] bool IsDefaultBehaviorId() { return behaviorId == DefaultBehaviorId; };
BehaviorMessageBase(AMFArrayValue* const arguments);
protected:
[[nodiscard]] int32_t GetBehaviorIdFromArgument(AMFArrayValue* const arguments);
[[nodiscard]] int32_t GetActionIndexFromArgument(AMFArrayValue* const arguments, const std::string& keyName = "actionIndex") const;
int32_t behaviorId = DefaultBehaviorId;
};
#endif //!__BEHAVIORMESSAGEBASE__H__