From 6ca5e47f69edab2a8edd42d5ba748d981180a0a9 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 8 Jul 2007 15:26:23 +0000 Subject: [PATCH] (opt_DEMANDUPDATE): Remove. Deities can use update_demandpolicy to control demand updates. --- include/econfig-spec.h | 2 -- src/lib/commands/upda.c | 50 ++++++++++++++++++++-------------------- src/lib/commands/zdon.c | 3 ++- src/lib/common/wantupd.c | 2 +- src/lib/global/options.c | 1 - src/lib/update/main.c | 3 ++- 6 files changed, 30 insertions(+), 31 deletions(-) diff --git a/include/econfig-spec.h b/include/econfig-spec.h index 87612553..b9e645ee 100644 --- a/include/econfig-spec.h +++ b/include/econfig-spec.h @@ -161,8 +161,6 @@ EMPCF_OPT("BLITZ", opt_BLITZ, "Enable blitz mode") EMPCF_OPT("BRIDGETOWERS", opt_BRIDGETOWERS, "Allow bridge towers") -EMPCF_OPT("DEMANDUPDATE", opt_DEMANDUPDATE, - "Allow demand updates") EMPCF_OPT("EASY_BRIDGES", opt_EASY_BRIDGES, "Allow bridge building without bridge heads") EMPCF_OPT("FALLOUT", opt_FALLOUT, diff --git a/src/lib/commands/upda.c b/src/lib/commands/upda.c index f003546b..433ef4e5 100644 --- a/src/lib/commands/upda.c +++ b/src/lib/commands/upda.c @@ -102,38 +102,38 @@ upda(void) next += update_window; pr("The next update window stops at %19.19s.\n", ctime(&next)); } - if (opt_DEMANDUPDATE) { - if (update_demandpolicy != UDDEM_DISABLE) { - switch (update_demandpolicy) { - case UDDEM_TMCHECK: - next_update_check_time(&now, &next, &delta); - pr("Demand updates occur at update CHECK times.\n"); - pr("The next update check is at %19.19s.\n", - ctime(&next)); - break; - case UDDEM_COMSET: - pr("Demand updates occur right after the demand is set.\n"); - break; - default: - pr("Update demand policy is inconsistent.\n"); - } - } + + switch (update_demandpolicy) { + case UDDEM_TMCHECK: + next_update_check_time(&now, &next, &delta); + pr("Demand updates occur at update CHECK times.\n"); + pr("The next update check is at %19.19s.\n", + ctime(&next)); + break; + case UDDEM_COMSET: + pr("Demand updates occur right after the demand is set.\n"); + break; + case UDDEM_DISABLE: + break; + default: + CANT_REACH(); + pr("Update demand policy is inconsistent.\n"); } if ((update_policy == UDP_TIMES) || - ((update_demandpolicy == UDDEM_TMCHECK) && opt_DEMANDUPDATE)) { + (update_demandpolicy == UDDEM_TMCHECK)) { if (*update_times != 0) pr("The update schedule is: %s\n", update_times); } - if (opt_DEMANDUPDATE) { - if (update_demandpolicy != UDDEM_DISABLE) { - if (*update_demandtimes != 0) - pr("Demand updates are allowed during: %s\n", - update_demandtimes); - pr("Demand updates require %d country(s) to want one.\n", - update_wantmin); - } + + if (update_demandpolicy != UDDEM_DISABLE) { + if (*update_demandtimes != 0) + pr("Demand updates are allowed during: %s\n", + update_demandtimes); + pr("Demand updates require %d country(s) to want one.\n", + update_wantmin); } + if (*game_days != 0) pr("Game days are: %s\n", game_days); if (*game_hours != 0) diff --git a/src/lib/commands/zdon.c b/src/lib/commands/zdon.c index 6ceca9df..3459c18f 100644 --- a/src/lib/commands/zdon.c +++ b/src/lib/commands/zdon.c @@ -54,6 +54,7 @@ #include "commands.h" #include "optlist.h" #include "server.h" +#include "wantupd.h" int zdon(void) @@ -70,7 +71,7 @@ zdon(void) int dowant; char buf[1024]; - if (!opt_DEMANDUPDATE) { + if (update_demandpolicy != UDDEM_DISABLE) { pr("Demand updates are not enabled.\n"); return RET_FAIL; } diff --git a/src/lib/common/wantupd.c b/src/lib/common/wantupd.c index 62628d0d..e1edfbb1 100644 --- a/src/lib/common/wantupd.c +++ b/src/lib/common/wantupd.c @@ -224,7 +224,7 @@ updatetime(time_t *now) return 1; } } - if (opt_DEMANDUPDATE) { + if (UDDEM_DISABLE != update_demandpolicy) { if (demand_check()) { logerror("Demand update, at check time."); return 1; diff --git a/src/lib/global/options.c b/src/lib/global/options.c index 3951db76..9f50c0b8 100644 --- a/src/lib/global/options.c +++ b/src/lib/global/options.c @@ -40,7 +40,6 @@ int opt_ALL_BLEED = 1; int opt_AUTO_POWER = 0; int opt_BLITZ = 1; int opt_BRIDGETOWERS = 1; -int opt_DEMANDUPDATE = 1; int opt_EASY_BRIDGES = 1; int opt_FALLOUT = 1; int opt_FUEL = 0; diff --git a/src/lib/update/main.c b/src/lib/update/main.c index 17042a61..5bd1bd4c 100644 --- a/src/lib/update/main.c +++ b/src/lib/update/main.c @@ -41,6 +41,7 @@ #include "player.h" #include "server.h" #include "update.h" +#include "wantupd.h" long money[MAXNOC]; long pops[MAXNOC]; @@ -158,7 +159,7 @@ update_main(void) mob_plane(etu); mob_land(etu); } - if (opt_DEMANDUPDATE) + if (update_demandpolicy != UDDEM_DISABLE) update_removewants(); /* flush all mem file objects to disk */ ef_flush(EF_NATION);