height_map=(char *)calloc(tile_map_size_x*tile_map_size_y*6*6, 1);
height_map=(char *)malloc(tile_map_size_x*tile_map_size_y*6*6);
void load_map(char * name){        map_header cur_map_header;     char * mem_map_header=(char *)&cur_map_header;          int i, x, y;          FILE *f = NULL;	 f=fopen(name, "rb");	 if(!f)return;    //Should NEVER happen	 	 // Unload the pathfinder	 pf_destroy_path();     if(pf_tile_map)		{			free(pf_tile_map);			pf_tile_map=NULL;		}	 	 fread(mem_map_header, 1, sizeof(cur_map_header), f);    	  	 tile_map_size_x=cur_map_header.tile_map_x_len;	 tile_map_size_y=cur_map_header.tile_map_y_len;	 	 //allocate memory for the tile map	 tile_map=(char *)calloc(tile_map_size_x*tile_map_size_y, 1);	  	 //read the tiles map	 fread(tile_map, 1, tile_map_size_x*tile_map_size_y, f);	 free(tile_map);	 tile_map = NULL;   // Don't need it...     //allocates the memory for the heights	 height_map=(char *)calloc(tile_map_size_x*tile_map_size_y*6*6, 1);	 //read the heights map	 fread(height_map, 1, tile_map_size_x*tile_map_size_y*6*6, f);     fclose(f);	 //create the tile map that will be used for pathfinding	 pf_tile_map = (PF_TILE *)calloc(tile_map_size_x*tile_map_size_y*6*6, sizeof(PF_TILE));    			for (x = 0; x < tile_map_size_x*6; x++) {	    for (y = 0; y < tile_map_size_y*6; y++) {	        i = y*tile_map_size_x*6+x;	        pf_tile_map[i].x = x;	        pf_tile_map[i].y = y;			pf_tile_map[i].z = height_map[i];	    }	}		examine_map(name+7);    return;}