rendered paste bodyFrom c5174e01d710243872b469089ba5ab9520f3c4fd Mon Sep 17 00:00:00 2001
From: Tim Mazid <timmazid@hotmail.com>
Date: Wed, 2 Dec 2009 02:22:43 +1100
Subject: [PATCH 2/2] * Fleet ratings are read in from XML
---
src/fleet.c | 3 +++
src/fleet.h | 1 +
src/space.c | 2 +-
3 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/src/fleet.c b/src/fleet.c
index 45a3f78..5676f43 100644
--- a/src/fleet.c
+++ b/src/fleet.c
@@ -151,6 +151,9 @@ static int fleet_parse( Fleet *temp, const xmlNodePtr parent )
continue;
}
+ /* Set strength level */
+ xmlr_strd(node,"strength",temp->strength);
+
/* Set AI. */
xmlr_strd(node,"ai",temp->ai);
diff --git a/src/fleet.h b/src/fleet.h
index 72ddeb4..3ecd7e8 100644
--- a/src/fleet.h
+++ b/src/fleet.h
@@ -50,6 +50,7 @@ typedef struct Fleet_ {
unsigned int flags; /**< Fleet flags. */
double pilot_avg; /**< Average amount of pilots. */
double mass_avg; /**< Average mass for security concerns. */
+ double strength; /**< The rated strength of the fleet. */
} Fleet;
diff --git a/src/space.c b/src/space.c
index 1327e15..975df87 100644
--- a/src/space.c
+++ b/src/space.c
@@ -1525,7 +1525,7 @@ static int system_calcSecurity( StarSystem *sys )
for (i=0; i<sys->nfleets; i++) {
f = sys->fleets[i].fleet;
c = (double)sys->fleets[i].chance / 100.;
- mod = c * f->pilot_avg * pow(f->mass_avg, 1./3.);
+ mod = c * f->strength;
if (fleet_isFlag(f, FLEET_FLAG_GUARD))
guard += mod;
else if (faction_getPlayerDef(f->faction) < 0)
--
1.6.5.3