I am trying to take 2D array of objects of my custom class hexTile
, and pass them through a function, and using a member function on a specific part of the 2D array. Here is my main.cpp
file:
int main(int argc, const char * argv[]) {
static int tile_count=32;
//To make the initial map
hexTile tilemap [32][32];
for(int i=0; i<tile_count; i++ ){
for(int j=0; j<tile_count; j++ ){
tilemap[i][j].makeEmpty();
tilemap[i][j].makeColumnCoordinate(i);
tilemap[i][j].makeRowCoordinate(j);
tilemap[i][j].update_onTile(false, false, false, false);
}
}
return 0;
}
void makeCityTile(hexTile (*map)[32][32], int tile_count){
int center=tile_count/2;
*map[center][center].makeExists();
}
When I try to compile this code, on the line *map[center][center].makeExists();
, I get an error Member reference base type 'hexTile [32]' is not a structure or union
. This doesn't make much sense because I have defined .makeExists
in tile_class.hpp
and tile_class.cpp
.