Allow AsInt from Float EffectParameter, and AsFloat from Int EffectParameter.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -34,6 +34,9 @@ namespace CreatureLib::Library {
|
||||
}
|
||||
int64_t AsInt() const {
|
||||
if (_type != EffectParameterType::Int) {
|
||||
if (_type == EffectParameterType::Float) {
|
||||
return static_cast<int64_t>(std::get<float>(_value));
|
||||
}
|
||||
std::stringstream ss;
|
||||
ss << "Cast effect parameter to int, but was " << EffectParameterTypeHelper::ToString(_type);
|
||||
throw CreatureException(ss.str());
|
||||
@@ -42,6 +45,9 @@ namespace CreatureLib::Library {
|
||||
}
|
||||
float AsFloat() const {
|
||||
if (_type != EffectParameterType::Float) {
|
||||
if (_type == EffectParameterType::Int) {
|
||||
return static_cast<float>(std::get<int64_t>(_value));
|
||||
}
|
||||
std::stringstream ss;
|
||||
ss << "Cast effect parameter to float, but was " << EffectParameterTypeHelper::ToString(_type);
|
||||
throw CreatureException(ss.str());
|
||||
|
||||
Reference in New Issue
Block a user