update: Fix excessively fast contact aging

When option LOSE_CONTACT is enabled, contact is lost after a few
updates.  The remaining number of updates is to be decremented by one
each update.  However, it's actually decremented every time an active
nation is updated.  This makes countries lose contact much too fast,
typically every update.  Broken in commit ac25058, v4.3.0.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2016-10-22 17:24:14 +02:00
parent d055dbecb8
commit ae011d089b

View file

@ -134,8 +134,6 @@ prod_nat(int etu)
double newvalue; double newvalue;
struct budg_item *bm; struct budg_item *bm;
natid n; natid n;
int cn;
struct natstr *cnp;
for (n = 0; NULL != (np = getnatp(n)); n++) { for (n = 0; NULL != (np = getnatp(n)); n++) {
grant_btus(np, game_reset_tick(&np->nat_access)); 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", wu(0, n, "total pop was %d, yielding %4.2f hap, %4.2f edu\n",
pop - 1, hap, edu); pop - 1, hap, edu);
} }
if (ally_factor > 0.0) if (ally_factor > 0.0)
share_incr(res, tech); share_incr(res, tech);
else { else {
memset(res, 0, sizeof(res)); memset(res, 0, sizeof(res));
memset(tech, 0, sizeof(tech)); memset(tech, 0, sizeof(tech));
} }
for (n = 0; NULL != (np = getnatp(n)); n++) { for (n = 0; NULL != (np = getnatp(n)); n++) {
if (np->nat_stat < STAT_ACTIVE) if (np->nat_stat < STAT_ACTIVE)
continue; continue;
@ -221,13 +221,11 @@ prod_nat(int etu)
np->nat_money = roundavg(nat_budget[n].money); np->nat_money = roundavg(nat_budget[n].money);
wu(0, n, "money delta was $%d for this update\n", wu(0, n, "money delta was $%d for this update\n",
np->nat_money - nat_budget[n].start_money); np->nat_money - nat_budget[n].start_money);
}
if (opt_LOSE_CONTACT) { if (opt_LOSE_CONTACT) {
for (cn = 1; cn < MAXNOC; cn++) { for (n = 0; NULL != (np = getnatp(n)); n++)
if ((cnp = getnatp(cn)) != NULL) agecontact(np);
agecontact(cnp);
}
}
} }
} }