diff --git a/changes.txt b/changes.txt index 04ee9dd8..00870ac7 100644 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,6 @@ -------------------------- Changes in 1.9 (not yet released) +- Add equals and set_data functions to core::array for easier working with blocks of data. - SIrrlichtCreationParameters::IgnoreInput set to false works again on X11. Thanks @ Victor Gaydov for report + patch + very good test cases! (bug #401) This had been broken since Irrlicht 1.6 diff --git a/include/irrArray.h b/include/irrArray.h index b8ffd705..b133b62d 100644 --- a/include/irrArray.h +++ b/include/irrArray.h @@ -231,6 +231,40 @@ public: free_when_destroyed=_free_when_destroyed; } + //! Set (copy) data from given memory block + /** \param newData data to set, must have newSize elements + \param newSize Amount of elements in newData + \param canShrink When true we reallocate the array even it can shrink. + May reduce memory usage, but call is more whenever size changes. + \param newDataIsSorted Info if you pass sorted/unsorted data + */ + void set_data(const T* newData, u32 newSize, bool newDataIsSorted=false, bool canShrink=false) + { + reallocate(newSize, canShrink); + set_used(newSize); + for ( u32 i=0; i& operator=(const array& other) { @@ -290,13 +323,7 @@ public: //! Equality operator bool operator == (const array& other) const { - if (used != other.used) - return false; - - for (u32 i=0; i