Hey guys, I'm having a problem with a 2 dimensional array of structs. Whenever I assign a value to one particular struct it appears that it contaminates that value for every other struct on that row.
Here are the relevant lines of code.
It's for a little game that procedurally generates a random maze. I've only got it rendering active cells so the output and watching the pointer's referenced values verifies that an entire row gets contaminated.
cells = new Cell[cellColumnSize, cellRowSize];
for (int i = 0; i < cellColumnSize; ++i)
for (int j = 0; j < cellRowSize; ++j)
cells[i,j].position = D3DXVECTOR2(i, j);
cells[i,j].isSouthOpen = false;
cells[i,j].isWestOpen = false;
cells[i,j].isNorthOpen = false;
cells[i,j].isEastOpen = false;
cells[i,j].isActive = false;
startCell = D3DXVECTOR2(0, 0);
cellPointer = startCell;
cells[(UINT) cellPointer.x, (UINT) cellPointer.y].isActive = true; // Sets the entire row to active for some reason.
I've never seen behavior like this so I imagine it might be due to some c++ behavior that I'm unaware of. Haven't been using c++ for very long.