diff options
author | Boris I. Bendovsky <[email protected]> | 2022-06-18 23:36:42 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2022-06-18 13:36:42 -0700 |
commit | d21ff67554d494ec53dcb4747b828478f8d5690a (patch) | |
tree | 5a8c39eeba176e4cfd539a9548af4bcc41557d5b /al/eax/call.h | |
parent | 0e7d5736c0b66d0639beb395b512416d252d28fb (diff) |
[EAX] Add separate source state for each version (#720)
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 { |