Use Arbutils exception Macros, instead of own ones.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
@@ -25,7 +25,7 @@ namespace CreatureLib::Library {
|
||||
inline EffectParameterType GetType() const noexcept { return _type; }
|
||||
bool AsBool() const {
|
||||
if (_type != EffectParameterType::Bool) {
|
||||
THROW_CREATURE("Cast effect parameter to bool, but was " << EffectParameterTypeHelper::ToString(_type));
|
||||
THROW("Cast effect parameter to bool, but was " << EffectParameterTypeHelper::ToString(_type));
|
||||
}
|
||||
return std::get<bool>(_value);
|
||||
}
|
||||
@@ -34,7 +34,7 @@ namespace CreatureLib::Library {
|
||||
if (_type == EffectParameterType::Float) {
|
||||
return static_cast<int64_t>(std::get<float>(_value));
|
||||
}
|
||||
THROW_CREATURE("Cast effect parameter to int, but was " << EffectParameterTypeHelper::ToString(_type));
|
||||
THROW("Cast effect parameter to int, but was " << EffectParameterTypeHelper::ToString(_type));
|
||||
}
|
||||
return std::get<int64_t>(_value);
|
||||
}
|
||||
@@ -43,15 +43,13 @@ namespace CreatureLib::Library {
|
||||
if (_type == EffectParameterType::Int) {
|
||||
return static_cast<float>(std::get<int64_t>(_value));
|
||||
}
|
||||
THROW_CREATURE("Cast effect parameter to float, but was "
|
||||
<< EffectParameterTypeHelper::ToString(_type));
|
||||
THROW("Cast effect parameter to float, but was " << EffectParameterTypeHelper::ToString(_type));
|
||||
}
|
||||
return std::get<float>(_value);
|
||||
}
|
||||
const ArbUt::StringView& AsString() const {
|
||||
if (_type != EffectParameterType::String) {
|
||||
THROW_CREATURE("Cast effect parameter to string, but was "
|
||||
<< EffectParameterTypeHelper::ToString(_type));
|
||||
THROW("Cast effect parameter to string, but was " << EffectParameterTypeHelper::ToString(_type));
|
||||
}
|
||||
return std::get<ArbUt::StringView>(_value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user