Fixed a problem with direct scenery access in C-API

This commit is contained in:
Michaël Lemaire 2013-10-29 21:38:27 +01:00
parent ce56f0a985
commit 00cbc7f424
2 changed files with 13 additions and 3 deletions

View file

@ -232,9 +232,16 @@ void sceneryGetTerrain(TerrainDefinition* terrain)
}
TerrainDefinition* sceneryGetTerrainDirect()
{
if (_main_scenery)
{
return _main_scenery->getTerrain();
}
else
{
return NULL;
}
}
void scenerySetTextures(TexturesDefinition* textures)
{

View file

@ -71,9 +71,12 @@ static void _layerValidateDefinition(TexturesLayerDefinition* definition)
/* Update zone height range */
TerrainDefinition* terrain = sceneryGetTerrainDirect();
if (terrain)
{
HeightInfo height_info = terrainGetHeightInfo(terrain);
zoneSetRelativeHeight(definition->terrain_zone, height_info.min_height, height_info.base_height, height_info.max_height);
}
}
static TexturesLayerDefinition* _layerCreateDefinition()
{