Im getting an error when compiling my little "roguelike" attempt game
Code:
gcc -o rogue -lncurses *.c
maps.c: In function 'worldgen':
maps.c:131: error: incompatible type for argument 1 of 'regiongen'
*** Error code 1
Here is how its setup. First there are the structs
Code:
typedef struct s_region {
long width;
long height;
char *mapname;
char **data;
} region;
typedef struct s_worldmap {
long width;
long height;
char *mapname;
char **data; //The characters of the map.
//Region structs.
region **wregions; //a w*h array of regions
} worldmap;
Then a function named "worldgen"
Code:
int worldgen(worldmap *wm, int height, int width, int mtype) {
....
wm = (worldmap *)malloc( sizeof(worldmap) );
wm->wregions = (region **) malloc(wm->height * sizeof(region *)); //REGIONS
for(i = 0; i < height; i++)
{
wm->wregions[i] = (region *) malloc(wm->width * sizeof(region));
}
....somewhere within my "for loop"
regiongen(wm->wregions[y][x], wm->height, wm->width, wm->data[y][x]);
regiongen's prototype
int regiongen(region *rm, int height, int width, char maptype);
my question is, is the argument, wm->wregions[y][x] not a pointer to struct?