]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/newe.c
Update copyright notice
[empserver] / src / lib / commands / newe.c
index 0b82d3ff84d1dedd2594dfc3508467b1950a9e88..5d7983304e11931c8ec3b9650c899c0f1ce20e21 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2004, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -19,9 +19,9 @@
  *
  *  ---
  *
- *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- *  related information and legal notices. It is expected that any future
- *  projects/authors will amend these files as needed.
+ *  See files README, COPYING and CREDITS in the root of the source
+ *  tree for related information and legal notices.  It is expected
+ *  that future projects/authors will amend these files as needed.
  *
  *  ---
  *
  *     Thomas Ruschak, 1993
  */
 
-#include "misc.h"
-#include "player.h"
-#include "xy.h"
-#include "nsc.h"
-#include "sect.h"
-#include "nat.h"
-#include "item.h"
-#include "file.h"
+#include <config.h>
+
 #include "commands.h"
+#include "item.h"
 #include "optlist.h"
 
 int
@@ -48,7 +43,7 @@ newe(void)
     struct natstr *natp;
     struct sctstr sect;
     struct nstr_sect nstr;
-    double work, wforce, lcms, hcms;
+    double work, lcms, hcms;
     int nsect;
     int civs = 0;
     int uws = 0;
@@ -71,14 +66,10 @@ newe(void)
            uws = (1.0 + uwbrate * etu_per_update) * sect.sct_item[I_UW];
            natp = getnatp(sect.sct_own);
            maxpop = max_pop(natp->nat_level[NAT_RLEV], &sect);
-           civs = min(civs, maxpop);
-           uws = min(uws, maxpop);
-           /* This isn't quite right, since research might rise/fall */
-           /* during the update, but it's the best we can really do  */
-           wforce = (int)((civs * sect.sct_work) / 100.0
-                          + uws + sect.sct_item[I_MILIT] * 2 / 5.0);
-
-           work = new_work(&sect, wforce * etu_per_update / 100);
+           work = new_work(&sect,
+                           total_work(sect.sct_work, etu_per_update,
+                                      civs, sect.sct_item[I_MILIT], uws,
+                                      maxpop));
            bwork = work / 2;
 
            type = sect.sct_type;