From 7376a3052773f8a6b6f8b9a90c3fda890c70866f Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Tue, 23 Jul 2013 14:11:48 +0100
Subject: [PATCH] [Add] Display whether or not a system has nebulae.

---
 src/map.c   | 42 ++++++++++++++++++++++++++++++++++++++----
 src/space.h |  4 ++--
 2 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/src/map.c b/src/map.c
index 7277040..8ddbf3c 100644
--- a/src/map.c
+++ b/src/map.c
@@ -78,6 +78,10 @@ void map_open(void) {
    *
    * Planets:
    *   $Planet1, $Planet2, ...
+   *
+   * ...
+   *
+   * [Close]
    */
 
   /* System name. */
@@ -105,14 +109,25 @@ void map_open(void) {
   window_addText(map_wid, -20, -150-gl_smallFont.h-5, 80, 100, 0, "txtPlanets",
                  &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,
                  "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, 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();
 }
@@ -129,7 +144,7 @@ static void map_update(void) {
   int i;
   StarSystem* sys;
   int f, standing, nstanding;
-  char buf[100];
+  char buf[128];
 
   sys = &systems_stack[map_selected];
 
@@ -186,6 +201,25 @@ static void map_update(void) {
     }
     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. */
diff --git a/src/space.h b/src/space.h
index 6a66499..5b24852 100644
--- a/src/space.h
+++ b/src/space.h
@@ -102,8 +102,8 @@ typedef struct StarSystem_ {
   int* jumps;             /* Adjacent star system index number. */
   int njumps;             /* Number of adjacent jumps. */
 
-  double nebu_density;    /* Nebulae density. */
-  double nebu_volatility; /* Nebulae volatility - Not used yet. */
+  double nebu_density;    /* Nebulae density (0. - 1000.).*/
+  double nebu_volatility; /* Nebulae volatility (0. - 1000.). */
 
   unsigned int flags;     /* Flags for system properties. */
 } StarSystem;