Update to new THROW macro.
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:
@@ -28,7 +28,7 @@ namespace CreatureLib::Library {
|
||||
inline bool HasAttacksForLevel(level_int_t level) const noexcept { return _learnedByLevel.Has(level); }
|
||||
inline const ArbUt::List<ArbUt::BorrowedPtr<const AttackData>>& GetAttacksForLevel(level_int_t level) const {
|
||||
if (!_learnedByLevel.Has(level)) {
|
||||
THROW("No attacks found for level " << (uint32_t)level << ".");
|
||||
THROW("No attacks found for level ", (uint32_t)level, ".");
|
||||
}
|
||||
return _learnedByLevel.Get(level);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace CreatureLib::Library {
|
||||
inline EffectParameterType GetType() const noexcept { return _type; }
|
||||
bool AsBool() const {
|
||||
if (_type != EffectParameterType::Bool) {
|
||||
THROW("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);
|
||||
}
|
||||
@@ -35,7 +35,7 @@ namespace CreatureLib::Library {
|
||||
if (_type == EffectParameterType::Float) {
|
||||
return static_cast<int64_t>(std::get<float>(_value));
|
||||
}
|
||||
THROW("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);
|
||||
}
|
||||
@@ -44,13 +44,13 @@ namespace CreatureLib::Library {
|
||||
if (_type == EffectParameterType::Int) {
|
||||
return static_cast<float>(std::get<int64_t>(_value));
|
||||
}
|
||||
THROW("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("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);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
} catch (const ArbUt::Exception& e) { \
|
||||
throw e; \
|
||||
} catch (const std::exception& e) { \
|
||||
THROW(msg << ": '" << e.what() << "'."); \
|
||||
THROW(msg, ": '", e.what(), "'."); \
|
||||
}
|
||||
#endif // CREATURELIB_CREATUREEXCEPTION_HPP
|
||||
|
||||
@@ -20,5 +20,5 @@ const ArbUt::StringView& TypeLibrary::GetTypeName(uint8_t type) const {
|
||||
return kv.first;
|
||||
}
|
||||
}
|
||||
THROW("Name requested for unknown type: " << (uint32_t)type);
|
||||
THROW("Name requested for unknown type: ", (uint32_t)type);
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ namespace CreatureLib::Library {
|
||||
try {
|
||||
return _effectiveness[attacking][defensive];
|
||||
} catch (const std::exception& e) {
|
||||
THROW("Unknown type indices were requested for effectiveness: " << (uint32_t)attacking << " and "
|
||||
<< (uint32_t)defensive);
|
||||
THROW("Unknown type indices were requested for effectiveness: ", (uint32_t)attacking, " and ",
|
||||
(uint32_t)defensive);
|
||||
}
|
||||
}
|
||||
[[nodiscard]] inline float GetEffectiveness(uint8_t attacking, const std::vector<u8>& defensive) const {
|
||||
|
||||
Reference in New Issue
Block a user