Thanks for the help thus far. If I could encroach a little further on your generosity...
Here is one of the loops that runs through my original vector of sprites and checks for collisions...
Code:
BOOL GameEngine::CheckSpriteCollision(Sprite* pTestSprite) {
// See if the sprite has collided with any other sprites
vector<Sprite*>::iterator siSprite;
for (siSprite = m_vSprites.begin(); siSprite != m_vSprites.end(); siSprite++)
{
// Make sure not to check for collision with itself
if (pTestSprite == (*siSprite))
continue;
// Test the collision
if (pTestSprite->TestCollision(*siSprite)) //if TestCollision is true...
// Collision detected
return SpriteCollision((*siSprite), pTestSprite);
}
// No collision
return FALSE;
}
So, is this an appropriate re-write of the function in order to make it run through a vector of sprite vectors instead and still check every individual sprite for any collisions...?
Code:
BOOL GameEngine::CheckSpriteCollision(vector<Sprite*> pTestVector) {
vector <vector <*Sprite>> :: iterator siSpriteVector;
for (siSpriteVector = m_vVectorSprites.begin(); siSpriteVector != m_vVectorSprites.end();
siVectorSprites++) {
for (i = 0; i < TestVector.size(); i++) {
for (j = 0; j < siVectorSprite.size(); j++) {
if (TestVector[i] == siVectorSprite[j]) {
continue;
}
if (TestVector[i]->TestCollision(siVectorSprite[j])) {
return SpriteCollision(siVectorSprite[j], TestVector[i]);
}
}
}
return false;
}
Sadly, I can't successfully compile it without making a lot more changes to my game code. So if anyone could cast a really scrutinizing eye over it and see if they spot any obvious problems, that would be truely fantastic.
Cheers.