add subscript operator for CollisionList

This commit is contained in:
Andrew Meadows 2014-04-21 18:22:34 -07:00
parent 1782e803c9
commit 63c02f2b04
2 changed files with 5 additions and 0 deletions

View file

@ -48,3 +48,6 @@ void CollisionList::clear() {
_size = 0;
}
const CollisionInfo* CollisionList::operator[](int index) const {
return (index > -1 && index < _size) ? &(_collisions[index]) : NULL;
}

View file

@ -95,6 +95,8 @@ public:
/// Clear valid collisions.
void clear();
const CollisionInfo* operator[](int index) const;
private:
int _maxSize; // the container cannot get larger than this
int _size; // the current number of valid collisions in the list