+
+/*
+ * Show update policy and up to N scheduled updates.
+ */
+void
+show_updates(int n)
+{
+ struct gamestr *game = game_tick_tick();
+ int demand = 0;
+ int i;
+
+ pr("%s, Turn %d, ETU %d\n", fmttime2822(time(NULL)),
+ game->game_turn, game->game_tick);
+
+ if (update_time[0]) {
+ if (update_demand == UPD_DEMAND_SCHED) {
+ pr("Demand updates occur according to schedule:\n");
+ demand = 1;
+ } else
+ pr("Updates occur according to schedule:\n");
+ for (i = 0; i < n && update_time[i]; i++)
+ pr("%3d. %s\n", game->game_turn + i,
+ fmttime2822(update_time[i]));
+ if (update_window) {
+ pr("Updates occur within %d seconds after the scheduled time\n",
+ update_window);
+ }
+ } else
+ pr("There are no updates scheduled.\n");
+
+ if (update_demand == UPD_DEMAND_ASYNC) {
+ pr("Demand updates occur right after the demand is set.\n");
+ if (*update_demandtimes != 0) {
+ pr("Demand updates are allowed during: %s\n",
+ update_demandtimes);
+ }
+ demand = 1;
+ }
+
+ if (demand) {
+ pr("Demand updates require %d country(s) to want one.\n",
+ update_wantmin);
+ }
+
+ if (updates_disabled())
+ pr("\nUPDATES ARE DISABLED!\n");
+}
+
+/*
+ * Return @t formatted according to RFC 2822.
+ * The return value is statically allocated and overwritten on
+ * subsequent calls.
+ */
+static char *
+fmttime2822(time_t t)
+{
+ static char buf[32];
+#if defined(_WIN32)
+ size_t n;
+ int nn;
+ TIME_ZONE_INFORMATION tzi;
+ long time_offset;
+ struct tm *time;
+
+ time = localtime(&t);
+
+ n = strftime(buf, sizeof(buf), "%a, %d %b %Y %H:%M:%S", time);
+ if (CANT_HAPPEN(n == 0)) {
+ buf[0] = 0;
+ return buf;
+ }
+ GetTimeZoneInformation(&tzi);
+ time_offset = -(tzi.Bias +
+ (time->tm_isdst ? tzi.DaylightBias : tzi.StandardBias));
+
+ nn = _snprintf(buf + n, sizeof(buf) - n, " %+03d%02d",
+ time_offset / 60, abs(time_offset) % 60);
+ if (CANT_HAPPEN(nn <= 0 || nn + n >= sizeof(buf)))
+ buf[0] = 0;
+#else
+ size_t n = strftime(buf, sizeof(buf), "%a, %d %b %Y %T %z",
+ localtime(&t));
+ if (CANT_HAPPEN(n == 0))
+ buf[0] = 0;
+#endif
+ return buf;
+}
+
+static void
+show_load(short item[])
+{
+ i_type i;
+
+ for (i = I_NONE + 1; i <= I_MAX; ++i) {
+ if (item[i])
+ pr(" %d%c", item[i], ichr[i].i_mnem);
+ }
+}
+
+static void
+show_capab(int flags, struct symbol *table)
+{
+ char buf[1024];
+
+ symbol_set_fmt(buf, sizeof(buf), flags, table, " ", 0);
+ if (*buf)
+ pr(" %s", buf);
+}