diff --git a/src/g_shared/a_specialspot.cpp b/src/g_shared/a_specialspot.cpp index 5064b04864..dbf2cffca8 100644 --- a/src/g_shared/a_specialspot.cpp +++ b/src/g_shared/a_specialspot.cpp @@ -129,7 +129,7 @@ struct FSpotList ASpecialSpot *GetNextInList(int skipcounter) { - if (++SkipCount > skipcounter) + if (Spots.Size() > 0 && ++SkipCount > skipcounter) { SkipCount = 0; diff --git a/src/tarray.h b/src/tarray.h index 1ce5ba5242..5006beb636 100644 --- a/src/tarray.h +++ b/src/tarray.h @@ -149,6 +149,24 @@ public: } } } + + void Delete (unsigned int index, int deletecount) + { + if (index + deletecount > Count) deletecount = Count - index; + if (deletecount > 0) + { + for(int i = 0; i < deletecount; i++) + { + Array[index + i].~T(); + } + Count -= deletecount; + if (index < Count) + { + memmove (&Array[index], &Array[index+deletecount], sizeof(T)*(Count - index)); + } + } + } + // Inserts an item into the array, shifting elements as needed void Insert (unsigned int index, const T &item) {