Code: Select all
/**
* @brief Retrieves dimensions of infomap for a map.
* @param filename The name of the map, including extension.
* @param name Of which infomap to retrieve the dimensions.
* @param width This is set to the width of the infomap, or 0 on error.
* @param height This is set to the height of the infomap, or 0 on error.
* @return 1 when the infomap was found with a nonzero size, 0 on error.
* @see GetInfoMap
*/
DLL_EXPORT int __stdcall GetInfoMapSize(const char* filename, const char* name, int* width, int* height);
Code: Select all
/**
* @brief Retrieves infomap data of a map.
* @param filename The name of the map, including extension.
* @param name Which infomap to extract from the file.
* @param data Pointer to memory location with enough room to hold the infomap data.
* @param typeHint One of bm_grayscale_8 (or 1) and bm_grayscale_16 (or 2).
* @return 1 if the infomap was succesfully extracted (and optionally converted),
* or 0 on error (map wasn't found, infomap wasn't found, or typeHint could not
* be honoured.)
*
* This function extracts an infomap from a map. This can currently be one of:
* "height", "metal", "grass", "type". The heightmap is natively in 16 bits per
* pixel, the others are in 8 bits pixel. Using typeHint one can give a hint to
* this function to convert from one format to another. Currently only the
* conversion from 16 bpp to 8 bpp is implemented.
*/
DLL_EXPORT int __stdcall GetInfoMap(const char* filename, const char* name, void* data, int typeHint);
The usage should be clear from the documentation, if not then you still have this thread

Happy coding

EDIT:
oh, and here is some crappy example code (from tools/unitsync/test/test.cpp) which dumps the infomaps to raw data files:
Code: Select all
char* infomaps[] = { "height", "grass", "metal", "type", NULL };
int width, height;
for (int i = 0; infomaps[i]; ++i) {
if (GetInfoMapSize(mapName.c_str(), infomaps[i], &width, &height)) {
printf(" %smap: %i x %i\n", infomaps[i], width, height);
void* data = malloc(width*height);
GetInfoMap(mapName.c_str(), infomaps[i], data, 1);
FILE* f = fopen(infomaps[i], "w");
if (f == NULL) {
perror(infomaps[i]);
} else {
fwrite(data, 1, width*height, f);
fclose(f);
}
free(data);
}
}