Hi I know there are a lot of similar questions but I've been through them and I can't seem to make my function work. I need to return a pointer to a 2D array. So far I am using this code:
(This code is a function in Level.cpp)
TileType* CLevel::getTiles()
{
TileType (*matrix_ptr)[31] = tiles;
return *matrix_ptr;
}
(TileType is an enum) This function is just returning one row and I obviously need both. Any suggestions?
Header file Level.h:
class CLevel
{
private:
list<CBox> boxes;
TileType tiles[GRID_HEIGHT][GRID_WIDTH];
CPlayer player;
public:
CLevel();
~CLevel();
CPlayer* getPlayer();
list<CBox>* getBoxes();
TileType** getTiles();
};