]> git.pond.sub.org Git - empserver/blobdiff - src/lib/update/populace.c
Update copyright notice
[empserver] / src / lib / update / populace.c
index eadb81bf7b4194e7ea2dda4e9b3411337b7c9ad4..5a1d35937da410ef72b15d145b5e8c5edd545cc4 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
  *  ---
  *
  *  populace.c: Return workforce available
- * 
+ *
  *  Known contributors to this file:
  *     Dave Pare, 1986
  */
 
 #include <config.h>
 
-#include "misc.h"
-#include "sect.h"
-#include "nat.h"
-#include "file.h"
-#include "path.h"
-#include "xy.h"
 #include "land.h"
-#include "update.h"
-#include "subs.h"
-#include "gen.h"
-#include "common.h"
 #include "lost.h"
+#include "path.h"
+#include "update.h"
 
 void
 populace(struct natstr *np, struct sctstr *sp, int etu)
 {
-    float hap;
-    float tech;
-    float edu;
-    float pct;
+    double hap, pct;
     int n;
     int civ = sp->sct_item[I_CIVIL];
     int mil = sp->sct_item[I_MILIT];
@@ -74,11 +63,9 @@ populace(struct natstr *np, struct sctstr *sp, int etu)
     }
 
     hap = np->nat_level[NAT_HLEV];
-    edu = np->nat_level[NAT_ELEV];
-    tech = np->nat_level[NAT_TLEV];
-    pct = (double)((tech - 40) / 40.0 + edu / 3.0);
+    pct = hap_req(np);
     if (sp->sct_own == sp->sct_oldown && hap < pct &&
-       chance(((double)pct - (double)hap) / (double)5.0)) {
+       chance((pct - hap) / 5.0)) {
        /*
         * zap the loyalty of unhappy civilians.
         * there is a 20% chance per hap point below the
@@ -100,7 +87,7 @@ populace(struct natstr *np, struct sctstr *sp, int etu)
        if (n < 0)
            n = 0;
        sp->sct_work = n;
-       if (chance((double)work_red / 1000.0)) {
+       if (chance(work_red / 1000.0)) {
            /*
             * small chance of rebellion...
             * if work_red is (max) 67,