diff options
Diffstat (limited to 'al/eax/call.h')
-rw-r--r-- | al/eax/call.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/al/eax/call.h b/al/eax/call.h index d491d6f9..9c2706c3 100644 --- a/al/eax/call.h +++ b/al/eax/call.h @@ -2,6 +2,7 @@ #define EAX_EAX_CALL_INCLUDED #include "AL/al.h" +#include "alnumeric.h" #include "alspan.h" #include "api.h" #include "fx_slot_index.h" @@ -48,18 +49,22 @@ public: return *static_cast<TValue*>(property_buffer_); } - template<typename TException, typename TValue> - al::span<TValue> get_values() const + template<typename TValue> + al::span<TValue> get_values(size_t max_count) const { - if (property_size_ < static_cast<ALuint>(sizeof(TValue))) - { + if (max_count == 0 || property_size_ < static_cast<ALuint>(sizeof(TValue))) fail_too_small(); - } - const auto count = property_size_ / sizeof(TValue); + const auto count = minz(property_size_ / sizeof(TValue), max_count); return al::span<TValue>{static_cast<TValue*>(property_buffer_), count}; } + template<typename TValue> + al::span<TValue> get_values() const + { + return get_values<TValue>(~size_t{}); + } + template<typename TException, typename TValue> void set_value(const TValue& value) const { |