mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- fixed: Array.Insert must zero all elements before the new one if something gets inserted outside the existing range.
This commit is contained in:
parent
d6e962c91e
commit
0526e0e04e
1 changed files with 5 additions and 4 deletions
|
@ -87,11 +87,12 @@ template<class T> void ArrayDelete(T *self, int index, int count)
|
|||
|
||||
template<class T, class U, int fill = 1> void ArrayInsert(T *self, int index, U val)
|
||||
{
|
||||
//int oldSize = self->Size();
|
||||
int oldSize = self->Size();
|
||||
self->Insert(index, static_cast<typename T::value_type>(val));
|
||||
// Is this even necessary? All Insert does is inserting one defined element into the array and moving the rest.
|
||||
// It never creates empty tailing entries. fillcount in the macro will always be 0
|
||||
//if (fill) { DYNARRAY_FILL_ITEMS_SKIP(1); }
|
||||
if constexpr (fill)
|
||||
{
|
||||
for (unsigned i = oldSize; i < self->Size() - 1; i++) (*self)[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> void ArrayShrinkToFit(T *self)
|
||||
|
|
Loading…
Reference in a new issue