]> git.pond.sub.org Git - empserver/blobdiff - src/lib/update/main.c
Update copyright notice.
[empserver] / src / lib / update / main.c
index ea1354d71204125ebed131e1a9e1f73f2a4b63a3..5d79042d19f7b1910ad21663fd52be791524e413 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-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
 
 #include <config.h>
 
-#include "misc.h"
-#include "nat.h"
-#include "file.h"
-#include "sect.h"
-#include "player.h"
-#include "empthread.h"
 #include "budg.h"
-#include "player.h"
-#include "update.h"
-#include "common.h"
-#include "optlist.h"
+#include "empthread.h"
 #include "journal.h"
+#include "player.h"
 #include "server.h"
-#include <stdlib.h>
-#if !defined(_WIN32)
-#include <sys/time.h>
-#endif
+#include "update.h"
 
 long money[MAXNOC];
 long pops[MAXNOC];
@@ -77,6 +66,9 @@ update_main(void *unused)
     if (CANT_HAPPEN(!update_pending))
         update_pending = 1;
 
+    logerror("production update (%d etus)", etu);
+    journal_update(etu);
+
     /* First, make sure all mobility is updated correctly. */
     if (opt_MOB_ACCESS) {
        mob_ship(etu);
@@ -87,13 +79,15 @@ update_main(void *unused)
     player->proc = empth_self();
     player->cnum = 0;
     player->god = 1;
+
+    if (opt_AUTO_POWER)
+       update_power();
+
     /*
      * set up all the variables which get used in the
      * sector production routine (for producing education,
      * happiness, and printing out the state of the nation)
      */
-    logerror("production update (%d etus)", etu);
-    journal_update(etu);
     memset(pops, 0, sizeof(pops));
     memset(air_money, 0, sizeof(air_money));
     memset(sea_money, 0, sizeof(sea_money));
@@ -112,11 +106,9 @@ update_main(void *unused)
     logerror("done preparing sectors.");
     logerror("producing for countries...");
     for (x = 0; x < MAXNOC; x++) {
-       int y, z;
-       long p_sect[SCT_MAXDEF+1][2];
+       long p_sect[SCT_TYPE_MAX+2][2];
 
        memset(p_sect, 0, sizeof(p_sect));
-       mil_dbl_pay = 0;
        if (!(np = getnatp(x)))
            continue;
        if (np->nat_stat == STAT_SANCT) {
@@ -134,7 +126,6 @@ update_main(void *unused)
 
        /* produce all sects */
        produce_sect(x, etu, bp, p_sect);
-       np->nat_money -= p_sect[SCT_CAPIT][1];
 
        /* build units */
        prod_ship(etu, x, bp, 1);