Fixed a problem with direct scenery access in C-API
This commit is contained in:
parent
ce56f0a985
commit
00cbc7f424
2 changed files with 13 additions and 3 deletions
|
@ -232,9 +232,16 @@ void sceneryGetTerrain(TerrainDefinition* terrain)
|
||||||
}
|
}
|
||||||
|
|
||||||
TerrainDefinition* sceneryGetTerrainDirect()
|
TerrainDefinition* sceneryGetTerrainDirect()
|
||||||
|
{
|
||||||
|
if (_main_scenery)
|
||||||
{
|
{
|
||||||
return _main_scenery->getTerrain();
|
return _main_scenery->getTerrain();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void scenerySetTextures(TexturesDefinition* textures)
|
void scenerySetTextures(TexturesDefinition* textures)
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,9 +71,12 @@ static void _layerValidateDefinition(TexturesLayerDefinition* definition)
|
||||||
|
|
||||||
/* Update zone height range */
|
/* Update zone height range */
|
||||||
TerrainDefinition* terrain = sceneryGetTerrainDirect();
|
TerrainDefinition* terrain = sceneryGetTerrainDirect();
|
||||||
|
if (terrain)
|
||||||
|
{
|
||||||
HeightInfo height_info = terrainGetHeightInfo(terrain);
|
HeightInfo height_info = terrainGetHeightInfo(terrain);
|
||||||
zoneSetRelativeHeight(definition->terrain_zone, height_info.min_height, height_info.base_height, height_info.max_height);
|
zoneSetRelativeHeight(definition->terrain_zone, height_info.min_height, height_info.base_height, height_info.max_height);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static TexturesLayerDefinition* _layerCreateDefinition()
|
static TexturesLayerDefinition* _layerCreateDefinition()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue