Call a function, with another class as a parameters

I am working on an assignment (the Assignment is to make a game that uses different classes, collision and shows we understand concepts of OOP, not just make this code work =p) currently for a beginner C++ class and I have stumped myself on my own code. Ultimately what I am making is simple collision detection that works like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void clsFirstSqr::Collide(LPDIRECT3DDEVICE9 dev, clsCellParent *pEnemyCells[])
{

for(int i = 0; i < 5; i++)
{
pEnemyCells[i];
			
				
if((fltXpos >= pEnemyCells[i]->getfltXpos()) && 
(fltXpos <= pEnemyCells[i]->getfltXpos() + pEnemyCells[i]->getintWidth()) && 
(fltYpos >= pEnemyCells[i]->getfltYpos()) && 
(fltYpos <= pEnemyCells[i]->getfltYpos() + pEnemyCells[i]->getintHeight()))		
//Top left
	{
	D3DXCreateTextureFromFile(dev, L"firstsquarecolour2.jpg", &sprite);


The gist of this code is that when the FirstSqr class collides with the CellParent class it will change the image. There is further code for the other sides, but that's just different numbers.

The issue I am having is when I create an array of my CellParent class I can't seem to get the collision code work on all 5 that I am drawing. Currently I run this in my main:

1
2
3
4
for(int i = 0; i < 5; i++)
{
pFirstSquare->Collide(d3ddev, pEnemyCells);
}


I feel like I should have the position in the array using "i" but when I do that I get

Error: argument type of "clsCellParent*" is incompatible with parameter type of "clsCellParent**"


So if I don't do that, the last drawn CellParent object collides fine, but the other four I am drawing don't. It seems to me that I am just not running the code for the other four, but even with a break I don't quite get why that's not happening.

If I need to format this better or give more information please let me know. Thanks in advance for any help.



Topic archived. No new replies allowed.