mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-21 06:48:11 +00:00
Update in response to feedback
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#include "dCommonVars.h"
|
||||
|
||||
BehaviorMessageBase::BehaviorMessageBase(AMFArrayValue* arguments) {
|
||||
this->behaviorId = GetBehaviorIdFromArgument(arguments);
|
||||
m_BehaviorId = GetBehaviorIdFromArgument(arguments);
|
||||
}
|
||||
|
||||
int32_t BehaviorMessageBase::GetBehaviorIdFromArgument(AMFArrayValue* arguments) {
|
||||
@@ -13,13 +13,13 @@ int32_t BehaviorMessageBase::GetBehaviorIdFromArgument(AMFArrayValue* arguments)
|
||||
auto* behaviorIDValue = arguments->Get<std::string>(key);
|
||||
|
||||
if (behaviorIDValue && behaviorIDValue->GetValueType() == eAmf::String) {
|
||||
this->behaviorId =
|
||||
GeneralUtils::TryParse<int32_t>(behaviorIDValue->GetValue()).value_or(this->behaviorId);
|
||||
m_BehaviorId =
|
||||
GeneralUtils::TryParse<int32_t>(behaviorIDValue->GetValue()).value_or(m_BehaviorId);
|
||||
} else if (arguments->Get(key) && arguments->Get(key)->GetValueType() != eAmf::Undefined) {
|
||||
throw std::invalid_argument("Unable to find behavior ID");
|
||||
}
|
||||
|
||||
return this->behaviorId;
|
||||
return m_BehaviorId;
|
||||
}
|
||||
|
||||
int32_t BehaviorMessageBase::GetActionIndexFromArgument(AMFArrayValue* arguments, const std::string& keyName) {
|
||||
|
@@ -16,13 +16,13 @@ enum class BehaviorState : uint32_t;
|
||||
class BehaviorMessageBase {
|
||||
public:
|
||||
static inline int32_t DefaultBehaviorId = -1;
|
||||
const int32_t GetBehaviorId() const { return behaviorId; };
|
||||
bool IsDefaultBehaviorId() { return behaviorId == DefaultBehaviorId; };
|
||||
const int32_t GetBehaviorId() const { return m_BehaviorId; };
|
||||
bool IsDefaultBehaviorId() { return m_BehaviorId == DefaultBehaviorId; };
|
||||
BehaviorMessageBase(AMFArrayValue* arguments);
|
||||
protected:
|
||||
int32_t GetBehaviorIdFromArgument(AMFArrayValue* arguments);
|
||||
int32_t GetActionIndexFromArgument(AMFArrayValue* arguments, const std::string& keyName = "actionIndex");
|
||||
int32_t behaviorId = DefaultBehaviorId;
|
||||
int32_t m_BehaviorId = DefaultBehaviorId;
|
||||
};
|
||||
|
||||
#endif //!__BEHAVIORMESSAGEBASE__H__
|
||||
|
Reference in New Issue
Block a user