From 54b620694dc69e7febd7fec190a79a396884eb0f Mon Sep 17 00:00:00 2001 From: Job Bolle Date: Sun, 15 Oct 2017 18:36:20 +0200 Subject: [PATCH 1/2] Fixes analyzer issue: initial value never used targetName is declared and assigned a vale. Its first use is another assignment. Moved declaration to first assignment that gets used. --- src/Core/GuiDisplayGen.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Core/GuiDisplayGen.m b/src/Core/GuiDisplayGen.m index 306e307cc..32331f572 100644 --- a/src/Core/GuiDisplayGen.m +++ b/src/Core/GuiDisplayGen.m @@ -1782,7 +1782,6 @@ - (void) drawStarChart:(GLfloat)x :(GLfloat)y :(GLfloat)z :(GLfloat) alpha :(BOO (textRow-1) * MAIN_GUI_ROW_HEIGHT * pixelRatio); OOSystemID target = [PLAYER targetSystemID]; - NSString *targetName = [UNIVERSE getSystemName:target]; double dx, dy; // get a list of systems marked as contract destinations @@ -2234,7 +2233,7 @@ - (void) drawStarChart:(GLfloat)x :(GLfloat)y :(GLfloat)z :(GLfloat) alpha :(BOO tab_stops[2] = 288; [self overrideTabs:tab_stops from:kGuiChartTraveltimeTabs length:3]; [self setTabStops:tab_stops]; - targetName = [[UNIVERSE getSystemName:target] retain]; + NSString *targetName = [[UNIVERSE getSystemName:target] retain]; // distance-f & est-travel-time-f are identical between short & long range charts in standard Oolite, however can be alterered separately via OXPs NSString *travelDistLine = @""; From 2855cc9bc4dd334a4ba278b560720cb12d393127 Mon Sep 17 00:00:00 2001 From: Job Bolle Date: Sun, 15 Oct 2017 18:36:38 +0200 Subject: [PATCH 2/2] Fixes analyzer issue: Initial value never used targetCoordinates is assined a value in its declaration. Its first use is another assignment. Moved declaration to first assignment that gets used. --- src/Core/GuiDisplayGen.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Core/GuiDisplayGen.m b/src/Core/GuiDisplayGen.m index 32331f572..bd7287424 100644 --- a/src/Core/GuiDisplayGen.m +++ b/src/Core/GuiDisplayGen.m @@ -1892,10 +1892,9 @@ - (void) drawStarChart:(GLfloat)x :(GLfloat)y :(GLfloat)z :(GLfloat) alpha :(BOO { [self drawAdvancedNavArrayAtX:x+hoffset y:y+voffset z:z alpha:alpha usingRoute:nil optimizedBy:OPTIMIZED_BY_NONE zoom: zoom]; } - NSPoint targetCoordinates = (NSPoint){0,0}; if (!routeExists) { - targetCoordinates = [systemManager getCoordinatesForSystem:target inGalaxy:galaxy_id]; + NSPoint targetCoordinates = [systemManager getCoordinatesForSystem:target inGalaxy:galaxy_id]; distance = distanceBetweenPlanetPositions(targetCoordinates.x,targetCoordinates.y,galaxy_coordinates.x,galaxy_coordinates.y); if (distance == 0.0)