[Add] Display whether or not a system has nebulae.

This commit is contained in:
Allanis 2013-07-23 14:11:48 +01:00
parent 8ef0ada807
commit 7376a30527
2 changed files with 40 additions and 6 deletions

View File

@ -78,6 +78,10 @@ void map_open(void) {
* *
* Planets: * Planets:
* $Planet1, $Planet2, ... * $Planet1, $Planet2, ...
*
* ...
*
* [Close]
*/ */
/* System name. */ /* System name. */
@ -105,14 +109,25 @@ void map_open(void) {
window_addText(map_wid, -20, -150-gl_smallFont.h-5, 80, 100, 0, "txtPlanets", window_addText(map_wid, -20, -150-gl_smallFont.h-5, 80, 100, 0, "txtPlanets",
&gl_smallFont, &cBlack, NULL); &gl_smallFont, &cBlack, NULL);
/* Close button. */
window_addButton(map_wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT,
"btnClose", "Close", map_close);
/* The map itself. */
window_addCust(map_wid, 20, -40, MAP_WIDTH, MAP_HEIGHT, window_addCust(map_wid, 20, -40, MAP_WIDTH, MAP_HEIGHT,
"cstMap", 1, map_render, map_mouse); "cstMap", 1, map_render, map_mouse);
window_addButton(map_wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, /*
"btnClose", "Close", map_close); * Bottom stuff.
*
* [+] [-] Nebulae, Asteroids, Interference.
*/
/* Zoom buttons. */
window_addButton(map_wid, 40, 20, 30, 30, "btnZoomIn", "+", map_buttonZoom); window_addButton(map_wid, 40, 20, 30, 30, "btnZoomIn", "+", map_buttonZoom);
window_addButton(map_wid, 80, 20, 30, 30, "btnZoomOut", "-", map_buttonZoom); window_addButton(map_wid, 80, 20, 30, 30, "btnZoomOut", "-", map_buttonZoom);
/* Situation text. */
window_addText(map_wid, 140, 10, WINDOW_WIDTH-80-30-30, 30, 0,
"txtSystemStatus", &gl_smallFont, &cBlack, NULL);
map_update(); map_update();
} }
@ -129,7 +144,7 @@ static void map_update(void) {
int i; int i;
StarSystem* sys; StarSystem* sys;
int f, standing, nstanding; int f, standing, nstanding;
char buf[100]; char buf[128];
sys = &systems_stack[map_selected]; sys = &systems_stack[map_selected];
@ -186,6 +201,25 @@ static void map_update(void) {
} }
window_modifyText(map_wid, "txtPlanets", buf); window_modifyText(map_wid, "txtPlanets", buf);
} }
/* System status. */
buf[0] = '\0';
if(sys->nebu_density > 0.) { /* Has nebulae. */
/* Volatility. */
if(sys->nebu_volatility > 700.)
strcat(buf, " Volatile");
else if(sys->nebu_volatility > 300.)
strcat(buf, " Dangerouse");
else if(sys->nebu_volatility > 0.)
strcat(buf, " Unstable");
/* Density */
if(sys->nebu_density > 700.)
strcat(buf, " Dense");
else if(sys->nebu_density < 300.)
strcat(buf, " Light");
strcat(buf, " Nebulae");
}
window_modifyText(map_wid, "txtSystemStatus", buf);
} }
/* Return 1 if sys is part of the map_path. */ /* Return 1 if sys is part of the map_path. */

View File

@ -102,8 +102,8 @@ typedef struct StarSystem_ {
int* jumps; /* Adjacent star system index number. */ int* jumps; /* Adjacent star system index number. */
int njumps; /* Number of adjacent jumps. */ int njumps; /* Number of adjacent jumps. */
double nebu_density; /* Nebulae density. */ double nebu_density; /* Nebulae density (0. - 1000.).*/
double nebu_volatility; /* Nebulae volatility - Not used yet. */ double nebu_volatility; /* Nebulae volatility (0. - 1000.). */
unsigned int flags; /* Flags for system properties. */ unsigned int flags; /* Flags for system properties. */
} StarSystem; } StarSystem;