]> git.pond.sub.org Git - empserver/blobdiff - src/lib/update/nat.c
Update copyright notice
[empserver] / src / lib / update / nat.c
index 73a2c4a12fea16b57306ca49f6598ccf0c40d7e0..f11cb7d6af958d1c4052f46960eafa6226629bfd 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2016, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2020, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                Ken Stevens, Steve McClure, Markus Armbruster
  *
  *  Empire is free software: you can redistribute it and/or modify
@@ -60,7 +60,7 @@ static void share_incr(double[], double[]);
  * for values below the "easy level" values, production is
  * as normal.  For values above "easy", production gets harder
  * based on an equation in "limit_level()" in update/nat.c.
- * Basically, the smaller the the values for "level_log", the
+ * Basically, the smaller the values for "level_log", the
  * smaller return on investment above level_easy[] values.
  */
 /*
@@ -134,8 +134,6 @@ prod_nat(int etu)
     double newvalue;
     struct budg_item *bm;
     natid n;
-    int cn;
-    struct natstr *cnp;
 
     for (n = 0; NULL != (np = getnatp(n)); n++) {
        grant_btus(np, game_reset_tick(&np->nat_access));
@@ -182,12 +180,14 @@ prod_nat(int etu)
        wu(0, n, "total pop was %d, yielding %4.2f hap, %4.2f edu\n",
           pop - 1, hap, edu);
     }
+
     if (ally_factor > 0.0)
        share_incr(res, tech);
     else {
        memset(res, 0, sizeof(res));
        memset(tech, 0, sizeof(tech));
     }
+
     for (n = 0; NULL != (np = getnatp(n)); n++) {
        if (np->nat_stat < STAT_ACTIVE)
            continue;
@@ -221,13 +221,11 @@ prod_nat(int etu)
        np->nat_money = roundavg(nat_budget[n].money);
        wu(0, n, "money delta was $%d for this update\n",
           np->nat_money - nat_budget[n].start_money);
+    }
 
-       if (opt_LOSE_CONTACT) {
-           for (cn = 1; cn < MAXNOC; cn++) {
-               if ((cnp = getnatp(cn)) != NULL)
-                   agecontact(cnp);
-           }
-       }
+    if (opt_LOSE_CONTACT) {
+       for (n = 0; NULL != (np = getnatp(n)); n++)
+           agecontact(np);
     }
 }
 
@@ -254,7 +252,7 @@ share_incr(double res[], double tech[])
            if (other->nat_stat != STAT_ACTIVE)
                continue;
            if (opt_HIDDEN) {
-               if (!getcontact(np, j))
+               if (!in_contact(i, j))
                    continue;
            }