Skip to content

Commit

Permalink
Merge pull request #239 from DMagic1/dev
Browse files Browse the repository at this point in the history
Version 16.8
  • Loading branch information
DMagic1 authored Sep 23, 2016
2 parents 842bcb5 + 101a0d8 commit f947d69
Show file tree
Hide file tree
Showing 12 changed files with 268 additions and 123 deletions.
2 changes: 1 addition & 1 deletion SCANassets/SCANsat.version
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"MAJOR":1,
"MINOR":1,
"PATCH":6,
"BUILD":7
"BUILD":8
},
"KSP_VERSION":{
"MAJOR":1,
Expand Down
6 changes: 3 additions & 3 deletions SCANmechjeb/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.0.7")]
[assembly: AssemblyFileVersion("1.6.0.7")]
[assembly: AssemblyInformationalVersion ("v16.7")]
[assembly: AssemblyVersion("1.6.0.8")]
[assembly: AssemblyFileVersion("1.6.0.8")]
[assembly: AssemblyInformationalVersion ("v16.8")]

[assembly: KSPAssembly ("SCANmechjeb", 0, 4)]
[assembly: KSPAssemblyDependency ("SCANsat", 1, 6)]
Expand Down
10 changes: 10 additions & 0 deletions SCANsat/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
Version 16.8 - 2016-9-23
-----------------------

- Fix not loading background scanning vessels
- Add support for displaying new vessel types
- Detect new anomaly types
- Garbage reduction and performance improvements
- Primarily in the background scanning mechanism


Version 16.7 - 2016-9-13
-----------------------

Expand Down
6 changes: 3 additions & 3 deletions SCANsat/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.6.0.7")]
[assembly: AssemblyFileVersion ("1.6.0.7")]
[assembly: AssemblyInformationalVersion ("v16.7")]
[assembly: AssemblyVersion ("1.6.0.8")]
[assembly: AssemblyFileVersion ("1.6.0.8")]
[assembly: AssemblyInformationalVersion ("v16.8")]

[assembly: KSPAssembly ("SCANsat", 1, 6)]

Expand Down
5 changes: 3 additions & 2 deletions SCANsat/SCAN_Data/SCANdata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,12 @@ public SCANanomaly[] Anomalies
{
if (anomalies == null)
{
PQSCity[] sites = body.GetComponentsInChildren<PQSCity>(true);
PQSSurfaceObject[] sites = body.pqsSurfaceObjects;
//PQSCity[] sites = body.GetComponentsInChildren<PQSCity>(true);
anomalies = new SCANanomaly[sites.Length];
for (int i = 0; i < sites.Length; ++i)
{
anomalies[i] = new SCANanomaly(sites[i].name, body.GetLongitude(sites[i].transform.position), body.GetLatitude(sites[i].transform.position), sites[i]);
anomalies[i] = new SCANanomaly(sites[i].SurfaceObjectName, body.GetLongitude(sites[i].transform.position), body.GetLatitude(sites[i].transform.position), sites[i]);
}
}
for (int i = 0; i < anomalies.Length; ++i)
Expand Down
36 changes: 25 additions & 11 deletions SCANsat/SCAN_Data/SCANresourceGlobal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class SCANresourceGlobal : SCAN_ConfigNodeStorage
[Persistent]
private List<SCANresourceBody> Resource_Planetary_Config = new List<SCANresourceBody>();

private Dictionary<string, SCANresourceBody> masterBodyConfigs = new Dictionary<string,SCANresourceBody>();
private DictionaryValueList<string, SCANresourceBody> masterBodyConfigs = new DictionaryValueList<string, SCANresourceBody>();

private SCANtype sType;
private SCANresourceType resourceType;
Expand Down Expand Up @@ -88,13 +88,16 @@ internal SCANresourceGlobal(SCANresourceGlobal copy)
defaultMaxValue = copy.defaultMaxValue;
}

private Dictionary<string, SCANresourceBody> copyBodyConfigs(SCANresourceGlobal c)
private DictionaryValueList<string, SCANresourceBody> copyBodyConfigs(SCANresourceGlobal c)
{
Dictionary<string, SCANresourceBody> newCopy = new Dictionary<string, SCANresourceBody>();
foreach (SCANresourceBody r in c.masterBodyConfigs.Values)
DictionaryValueList<string, SCANresourceBody> newCopy = new DictionaryValueList<string, SCANresourceBody>();
int l = c.masterBodyConfigs.Count;

for (int i = 0; i < l; i++)
{
SCANresourceBody r = c.masterBodyConfigs.At(i);
SCANresourceBody newR = new SCANresourceBody(r);
if (!newCopy.ContainsKey(newR.BodyName))
if (!newCopy.Contains(newR.BodyName))
newCopy.Add(newR.BodyName, newR);
}

Expand All @@ -115,7 +118,18 @@ public override void OnDecodeFromConfigNode()
setDefaultValues();
try
{
masterBodyConfigs = Resource_Planetary_Config.ToDictionary(a => a.BodyName, a => a);
int l = Resource_Planetary_Config.Count;

for (int i = 0; i < l; i++)
{
SCANresourceBody r = Resource_Planetary_Config[i];

if (r == null)
continue;

if (!masterBodyConfigs.Contains(r.BodyName))
masterBodyConfigs.Add(r.BodyName, r);
}
}
catch (Exception e)
{
Expand Down Expand Up @@ -144,7 +158,7 @@ public override void OnEncodeToConfigNode()

public void addToBodyConfigs(string s, SCANresourceBody r, bool warn)
{
if (!masterBodyConfigs.ContainsKey(s))
if (!masterBodyConfigs.Contains(s))
masterBodyConfigs.Add(s, r);
else if (warn)
Debug.LogError(string.Format("[SCANsat] Warning: SCANresource Dictionary Already Contains Key Of This Type: [{0}] For Body: [{1}]", r.ResourceName, s));
Expand Down Expand Up @@ -246,7 +260,7 @@ public int getBodyCount

public SCANresourceBody getBodyConfig (string body, bool warn = true)
{
if (masterBodyConfigs.ContainsKey(body))
if (masterBodyConfigs.Contains(body))
return masterBodyConfigs[body];
else if (warn)
SCANUtil.SCANlog("SCANsat resource celestial body config: [{0}] is empty; something probably went wrong here", body);
Expand All @@ -257,7 +271,7 @@ public SCANresourceBody getBodyConfig (string body, bool warn = true)
public SCANresourceBody getBodyConfig (int i)
{
if (masterBodyConfigs.Count > i)
return masterBodyConfigs.ElementAt(i).Value;
return masterBodyConfigs.At(i);
else
SCANUtil.SCANlog("SCANsat resource celestial body config is empty; something probably went wrong here");

Expand All @@ -266,10 +280,10 @@ public SCANresourceBody getBodyConfig (int i)

public void CurrentBodyConfig(string body)
{
if (masterBodyConfigs.ContainsKey(body))
if (masterBodyConfigs.Contains(body))
currentBody = masterBodyConfigs[body];
else
currentBody = masterBodyConfigs.ElementAt(0).Value;
currentBody = masterBodyConfigs.At(0);
}

public SCANresourceBody CurrentBody
Expand Down
6 changes: 4 additions & 2 deletions SCANsat/SCAN_UI/SCANbigMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -644,12 +644,14 @@ private void mapDraw(int id)
if (gridLines.Count > 0 && inRepaint())
{
GL.PushMatrix();
foreach (List<Vector2d> points in gridLines[0])
for (int i = gridLines[0].Count - 1; i >= 0; i--)
{
List<Vector2d> points = gridLines[0][i];
SCANuiUtil.drawGridLines(points, bigmap.MapWidth, TextureRect.x, TextureRect.y, SCANuiUtil.blackLineColor);
}
foreach (List<Vector2d> points in gridLines[1])
for (int i = gridLines[1].Count - 1; i >= 0; i--)
{
List<Vector2d> points = gridLines[1][i];
SCANuiUtil.drawGridLines(points, bigmap.MapWidth, TextureRect.x, TextureRect.y, SCANuiUtil.lineColor);
}
GL.PopMatrix();
Expand Down
10 changes: 8 additions & 2 deletions SCANsat/SCAN_UI/UI_Framework/SCANicon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ internal static void drawOrbitIcon(int x, int y, OrbitIcon icon, Color c, int si
grid_pos.x = 0.2f * ((int)icon % 5);
grid_pos.y = 0.2f * (4 - (int)icon / 5);

SCANuiUtil.drawMapIcon(pos_icon, MapView.OrbitIconsMap, outline, c, true, grid_pos, true);
SCANuiUtil.drawMapIcon(pos_icon, SCANmainMenuLoader.OrbitIconsMap, outline, c, true, grid_pos, true);
}

internal static void drawOrbitIconGL(int x, int y, OrbitIcon icon, Color c, Color shadow, Material iconMat, int size = 32 /*px*/, bool outline = false)
Expand All @@ -125,7 +125,7 @@ internal static void drawOrbitIconGL(int x, int y, OrbitIcon icon, Color c, Colo
grid_pos.x = 0.2f * ((int)icon % 5);
grid_pos.y = 0.2f * (4 - (int)icon / 5);

SCANuiUtil.drawMapIconGL(pos_icon, MapView.OrbitIconsMap, c, iconMat, shadow, outline, grid_pos, true);
SCANuiUtil.drawMapIconGL(pos_icon, SCANmainMenuLoader.OrbitIconsMap, c, iconMat, shadow, outline, grid_pos, true);
}

public static void drawIcon(Color c, int size = 32 /*px*/, bool outline = false)
Expand Down Expand Up @@ -181,10 +181,12 @@ public enum OrbitIcon : int
Ap = 1,
AN = 2,
DN = 3,
Plane = 4,
Ship = 5,
Debris = 6,
Planet = 7,
Mystery = 8,
Relay = 9,
Encounter = 10,
Exit = 11,
EVA = 12,
Expand Down Expand Up @@ -214,8 +216,12 @@ internal static OrbitIcon orbitIconForVesselType(VesselType type)
return OrbitIcon.Flag;
case VesselType.Lander:
return OrbitIcon.Lander;
case VesselType.Plane:
return OrbitIcon.Plane;
case VesselType.Probe:
return OrbitIcon.Probe;
case VesselType.Relay:
return OrbitIcon.Relay;
case VesselType.Rover:
return OrbitIcon.Rover;
case VesselType.Ship:
Expand Down
19 changes: 9 additions & 10 deletions SCANsat/SCAN_UI/UI_Framework/SCANuiUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -694,20 +694,19 @@ internal static void drawVesselLabel(Rect maprect, SCANmap map, int num, Vessel
internal static void drawMapLabels(Rect maprect, Vessel vessel, SCANmap map, SCANdata data, CelestialBody body, bool showAnom, bool showWaypoints)
{
//This section handles flag and asteroid labels
foreach (Vessel v in FlightGlobals.Vessels)
for (int i = FlightGlobals.Vessels.Count - 1; i >= 0; i--)
{
Vessel v = FlightGlobals.Vessels[i];

if (v.mainBody == body)
{
if (MapView.OrbitIconsMap != null)
if (v.vesselType == VesselType.Flag && SCANcontroller.controller.map_flags)
{
if (v.vesselType == VesselType.Flag && SCANcontroller.controller.map_flags)
{
drawVesselLabel(maprect, map, 0, v);
}
if (v.vesselType == VesselType.SpaceObject && SCANcontroller.controller.map_asteroids)
{
drawVesselLabel(maprect, map, 0, v);
}
drawVesselLabel(maprect, map, 0, v);
}
if (v.vesselType == VesselType.SpaceObject && SCANcontroller.controller.map_asteroids)
{
drawVesselLabel(maprect, map, 0, v);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions SCANsat/SCANconfigLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ internal static void configLoader()
{
loadSCANtypes();

localNode = new SCAN_Localization(localizationFile, localizationNode);

SCANnode = new SCAN_Color_Config(configFile, configNodeName);

SCANcontroller.checkLoadedTerrainNodes();

loadResources();

localNode = new SCAN_Localization(localizationFile, localizationNode);
}

private static void loadSCANtypes()
Expand Down
Loading

0 comments on commit f947d69

Please sign in to comment.