- Fixed: The Boss Brain could crash when it tried to shoot a cube but having no spawn spots placed.

SVN r1331 (trunk)
This commit is contained in:
Christoph Oelckers 2008-12-26 08:53:12 +00:00
parent 120233eebd
commit a66eb7f8c3
2 changed files with 19 additions and 1 deletions

View file

@ -129,7 +129,7 @@ struct FSpotList
ASpecialSpot *GetNextInList(int skipcounter) ASpecialSpot *GetNextInList(int skipcounter)
{ {
if (++SkipCount > skipcounter) if (Spots.Size() > 0 && ++SkipCount > skipcounter)
{ {
SkipCount = 0; SkipCount = 0;

View file

@ -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 // Inserts an item into the array, shifting elements as needed
void Insert (unsigned int index, const T &item) void Insert (unsigned int index, const T &item)
{ {