Skip to content

Commit

Permalink
Fix localized terrain and resource calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
DMagic1 committed Aug 31, 2020
1 parent a04c8ea commit 33e6d94
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions SCANsat/SCAN_Unity/SCAN_UI_ZoomMap.cs
Expand Up @@ -380,8 +380,7 @@ public void resetMapToVessel()

protected void calcTerrainLimits()
{
if (spotmap.MType == mapType.Slope || spotmap.MType == mapType.Visual)
return;
bool terrainCalc = spotmap.MType == mapType.Altimetry || spotmap.MType == mapType.Biome;

int w = spotmap.MapWidth / 4;
int h = spotmap.MapHeight / 4;
Expand All @@ -405,7 +404,15 @@ protected void calcTerrainLimits()
if (double.IsNaN(lon) || double.IsNaN(lat) || lon < -180 || lon >= 180 || lat < -90 && lat >= 90)
continue;

float terrain = (float)SCANUtil.getElevation(body, lon, lat);
if (terrainCalc)
{
float terrain = (float)SCANUtil.getElevation(body, lon, lat);

if (terrain < terrainMin)
terrainMin = terrain;
if (terrain > terrainMax)
terrainMax = terrain;
}

if (currentResource != null)
{
Expand All @@ -421,11 +428,6 @@ protected void calcTerrainLimits()
resourceMax = 100;
resourceMin = 0;
}

if (terrain < terrainMin)
terrainMin = terrain;
if (terrain > terrainMax)
terrainMax = terrain;
}
}

Expand Down

0 comments on commit 33e6d94

Please sign in to comment.