so I had a look: mapfile.h
SMF format shows that grass is defined as an 'MEH_Vegetation' extra header. so i take it to mean that its optional.
Code: Select all
// Defined types for extra headers
/// Not sure why this one should be used
#define MEH_None 0
/**
@brief Extension containing a ground vegetation map
This extension contains an offset to an unsigned char[mapx/4 * mapy/4] array
that defines ground vegetation, if it's missing there is no ground vegetation.
- 0=none
- 1=grass
- rest undefined so far
*/
#define MEH_Vegetation 1
CSMFMapFile::ReadGrassMap wont assign any data because because numExtraHeaders is 0.
CSMFMapFile::ReadInfoMap is the only function that calls ReadGrassMap
CSMFReadMap::GetInfoMap calls CSMFMapFile::ReadInfoMap and is the likely suspect
Code: Select all
unsigned char* CSMFReadMap::GetInfoMap(const std::string& name, MapBitmapInfo* bmInfo)
{
// get size
file.GetInfoMapSize(name, bmInfo);
if (bmInfo->width <= 0) return NULL;
// get data
unsigned char* data = new unsigned char[bmInfo->width * bmInfo->height];
file.ReadInfoMap(name, data);
return data;
}
GrassDrawer.cpp
CGrassDrawer::CGrassDrawer does this:
Code: Select all
// load grass density from map
{
MapBitmapInfo grassbm;
unsigned char* grassdata = readMap->GetInfoMap("grass", &grassbm);
if (!grassdata) {
grassOff = true;
return;
}