@@ -74,15 +74,15 @@ Uint8 Globe::BASE_LABEL_COLOR = 133;
7474
7575namespace
7676{
77-
77+
7878// /helper class for `Globe` for drawing earth globe with shadows
7979struct GlobeStaticData
8080{
8181 // /array of shading gradient
8282 Sint16 shade_gradient[240 ];
8383 // /size of x & y of noise surface
8484 const int random_surf_size;
85-
85+
8686 /* *
8787 * Function returning normal vector of sphere surface
8888 * @param ox x cord of sphere center
@@ -115,8 +115,8 @@ struct GlobeStaticData
115115 return ret;
116116 }
117117 }
118-
119- // initialization
118+
119+ // initialization
120120 GlobeStaticData () : random_surf_size(60 )
121121 {
122122 // filling terminator gradient LUT
@@ -237,7 +237,7 @@ struct CreateShadow
237237 }
238238 }
239239 }
240-
240+
241241 static inline void func (Uint8& dest, const Cord& earth, const Cord& sun, const Sint16& noise, const int &)
242242 {
243243 if (dest && earth.z )
@@ -283,7 +283,7 @@ Globe::Globe(Game* game, int cenX, int cenY, int width, int height, int x, int y
283283 _cenLat = _game->getSavedGame ()->getGlobeLatitude ();
284284 _zoom = _game->getSavedGame ()->getGlobeZoom ();
285285 _zoomOld = _zoom;
286-
286+
287287 setupRadii (width, height);
288288 setZoom (_zoom);
289289
@@ -838,10 +838,10 @@ void Globe::cache(std::list<Polygon*> *polygons, std::list<Polygon*> *cache)
838838void Globe::setPalette (SDL_Color *colors, int firstcolor, int ncolors)
839839{
840840 Surface::setPalette (colors, firstcolor, ncolors);
841-
841+
842842 _texture->setPalette (colors, firstcolor, ncolors);
843843 _markerSet->setPalette (colors, firstcolor, ncolors);
844-
844+
845845 _countries->setPalette (colors, firstcolor, ncolors);
846846 _markers->setPalette (colors, firstcolor, ncolors);
847847 _radars->setPalette (colors, firstcolor, ncolors);
@@ -945,7 +945,7 @@ void Globe::drawLand()
945945/* *
946946 * Get position of sun from point on globe
947947 * @param lon longitude of position
948- * @param lat latitude of position
948+ * @param lat latitude of position
949949 * @return position of sun
950950 */
951951Cord Globe::getSunDirection (double lon, double lat) const
@@ -1002,13 +1002,13 @@ void Globe::drawShadow()
10021002{
10031003 ShaderMove<Cord> earth = ShaderMove<Cord>(_earthData[_zoom], getWidth (), getHeight ());
10041004 ShaderRepeat<Sint16> noise = ShaderRepeat<Sint16>(_randomNoiseData, static_data.random_surf_size , static_data.random_surf_size );
1005-
1005+
10061006 earth.setMove (_cenX-getWidth ()/2 , _cenY-getHeight ()/2 );
1007-
1007+
10081008 lock ();
10091009 ShaderDraw<CreateShadow>(ShaderSurface (this ), earth, ShaderScalar (getSunDirection (_cenLon, _cenLat)), noise);
10101010 unlock ();
1011-
1011+
10121012}
10131013
10141014
@@ -1020,7 +1020,7 @@ void Globe::XuLine(Surface* surface, Surface* src, double x1, double y1, double
10201020 bool inv;
10211021 Sint16 tcol;
10221022 double len,x0,y0,SX ,SY ;
1023- if (abs ((int )y2-(int )y1) > abs ((int )x2-(int )x1))
1023+ if (abs ((int )y2-(int )y1) > abs ((int )x2-(int )x1))
10241024 {
10251025 len=abs ((int )y2-(int )y1);
10261026 inv=false ;
@@ -1031,7 +1031,7 @@ void Globe::XuLine(Surface* surface, Surface* src, double x1, double y1, double
10311031 inv=true ;
10321032 }
10331033
1034- if (y2<y1) {
1034+ if (y2<y1) {
10351035 SY =-1 ;
10361036 } else if ( AreSame (deltay, 0.0 ) ) {
10371037 SY =0 ;
@@ -1137,7 +1137,7 @@ void Globe::drawRadars()
11371137
11381138 if (range>0 ) drawGlobeCircle (lat,lon,range,48 );
11391139 }
1140-
1140+
11411141 }
11421142
11431143 for (std::vector<Craft*>::iterator j = (*i)->getCrafts ()->begin (); j != (*i)->getCrafts ()->end (); ++j)
@@ -1336,10 +1336,13 @@ void Globe::drawDetail()
13361336 marker->setY (y - 1 );
13371337 marker->blit (_countries);
13381338
1339- label->setX (x - 40 );
1340- label->setY (y + 2 );
1341- label->setText (_game->getLanguage ()->getString ((*j)->getName ()));
1342- label->blit (_countries);
1339+ if (_zoom >= (*j)->getZoomLevel ())
1340+ {
1341+ label->setX (x - 40 );
1342+ label->setY (y + 2 );
1343+ label->setText (_game->getLanguage ()->getString ((*j)->getName ()));
1344+ label->blit (_countries);
1345+ }
13431346 }
13441347 }
13451348 // Draw bases names
@@ -1357,7 +1360,7 @@ void Globe::drawDetail()
13571360
13581361 delete label;
13591362 }
1360-
1363+
13611364 static int debugType = 0 ;
13621365 static bool canSwitchDebugType = false ;
13631366 if (_game->getSavedGame ()->getDebugMode ())
@@ -1498,7 +1501,7 @@ void Globe::drawFlights()
14981501 // Hide crafts docked at base
14991502 if ((*j)->getStatus () != " STR_OUT" || (*j)->getDestination () == 0 /* || pointBack((*j)->getLongitude(), (*j)->getLatitude())*/ )
15001503 continue ;
1501-
1504+
15021505 double lon1 = (*j)->getLongitude ();
15031506 double lon2 = (*j)->getDestination ()->getLongitude ();
15041507 double lat1 = (*j)->getLatitude ();
@@ -1720,7 +1723,7 @@ void Globe::mouseRelease(Action *action, State *state)
17201723 * @param state State that the action handlers belong to.
17211724 */
17221725void Globe::mouseClick (Action *action, State *state)
1723- {
1726+ {
17241727 if (action->getDetails ()->button .button == SDL_BUTTON_WHEELUP )
17251728 {
17261729 zoomIn ();
@@ -1732,7 +1735,7 @@ void Globe::mouseClick(Action *action, State *state)
17321735
17331736 double lon, lat;
17341737 cartToPolar ((Sint16)floor (action->getAbsoluteXMouse ()), (Sint16)floor (action->getAbsoluteYMouse ()), &lon, &lat);
1735-
1738+
17361739 // The following is the workaround for a rare problem where sometimes
17371740 // the mouse-release event is missed for any reason.
17381741 // However if the SDL is also missed the release event, then it is to no avail :(
0 commit comments