All pastes #1696534 Raw Edit

Stuff

public text v1 · immutable
#1696534 ·published 2009-12-01 15:27 UTC
rendered paste body
From 7c996bcf5a8f12afcd45e7277143e98e66a0f6a2 Mon Sep 17 00:00:00 2001
From: Tim Mazid <timmazid@hotmail.com>
Date: Wed, 2 Dec 2009 02:17:22 +1100
Subject: [PATCH 1/2] * Changed security to presence

It now shows guard/hostile presence for systems.
---
 src/map.c   |    2 +-
 src/space.c |    4 ++++
 src/space.h |    2 ++
 3 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/map.c b/src/map.c
index 46d51ff..2c9d81d 100644
--- a/src/map.c
+++ b/src/map.c
@@ -339,7 +339,7 @@ static void map_update( unsigned int wid )
    if (sys->nfleets == 0)
       snprintf(buf, PATH_MAX, "NA" );
    else
-      snprintf(buf, PATH_MAX, "%.0f %%", sys->security * 100.);
+      snprintf(buf, PATH_MAX, "%.0fGP/%.0fHP", sys->presenceGuard, sys->presenceHostile);
    window_moveWidget( wid, "txtSSecurity", -20, y );
    window_moveWidget( wid, "txtSecurity", -20, y-gl_smallFont.h-5 );
    window_modifyText( wid, "txtSecurity", buf );
diff --git a/src/space.c b/src/space.c
index 233739f..1327e15 100644
--- a/src/space.c
+++ b/src/space.c
@@ -1532,6 +1532,10 @@ static int system_calcSecurity( StarSystem *sys )
          hostile  += mod;
    }
 
+   /* Set presence */
+   sys->presenceGuard = guard;
+   sys->presenceHostile = hostile;
+
    /* Set security. */
    if (guard == 0.)
       sys->security = 0.;
diff --git a/src/space.h b/src/space.h
index 6a45555..57bab48 100644
--- a/src/space.h
+++ b/src/space.h
@@ -160,6 +160,8 @@ typedef struct StarSystem_ {
    /* Calculated. */
    double *prices; /**< Handles the prices in the system. */
    double security; /**< % of security in this system. */
+   double presenceGuard; /**< Guard presence in this system. */
+   double presenceHostile; /**< Hostile presence in this system.  */
 
    /* Markers. */
    int markers_misc; /**< Number of misc mission markers on system. */
-- 
1.6.5.3