]> git.pond.sub.org Git - empserver/blob - src/lib/commands/upda.c
updates_disabled() moved to game.h, include it.
[empserver] / src / lib / commands / upda.c
1 /*
2  *  Empire - A multi-player, client/server Internet based war game.
3  *  Copyright (C) 1986-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
4  *                           Ken Stevens, Steve McClure
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  *  ---
21  *
22  *  See files README, COPYING and CREDITS in the root of the source
23  *  tree for related information and legal notices.  It is expected
24  *  that future projects/authors will amend these files as needed.
25  *
26  *  ---
27  *
28  *  upda.c: Give the time of the next update
29  * 
30  *  Known contributors to this file:
31  *     Markus Armbruster, 2007
32  */
33
34 #include <config.h>
35
36 #include "commands.h"
37 #include "game.h"
38 #include "optlist.h"
39 #include "server.h"
40
41 /*
42  * Tell what the update policy is, and when the next update
43  * is likely to be.
44  */
45 int
46 upda(void)
47 {
48     FILE *fp;
49     time_t now, next, stop;
50
51     if (updates_disabled())
52         pr("UPDATES ARE DISABLED!\n");
53
54     (void)time(&now);
55     next = update_time[0];
56     if (next) {
57         pr("\nUpdates occur at times specified by the ETU rates.\n\n");
58         pr("The next update is at %19.19s.\n", ctime(&next));
59     } else {
60         pr("There are no regularly scheduled updates.\n");
61     }
62     pr("The current time is   %19.19s.\n\n", ctime(&now));
63
64     if (next && update_window) {
65         pr("The next update window starts at %19.19s.\n",
66            ctime(&next));
67         stop = next + update_window;
68         pr("The next update window stops at %19.19s.\n", ctime(&stop));
69     }
70
71     switch (update_demand) {
72     case UPD_DEMAND_NONE:
73     default:
74         break;
75     case UPD_DEMAND_SCHED:
76         pr("Demand updates occur at update CHECK times.\n");
77         if (next) {
78             pr("The next update check is at %19.19s.\n",
79                ctime(&next));
80         }
81         pr("Demand updates require %d country(s) to want one.\n",
82            update_wantmin);
83         break;
84     case UPD_DEMAND_ASYNC:
85         pr("Demand updates occur right after the demand is set.\n");
86         if (*update_demandtimes != 0) {
87             pr("Demand updates are allowed during: %s\n",
88                update_demandtimes);
89         }
90         pr("Demand updates require %d country(s) to want one.\n",
91            update_wantmin);
92     }
93
94     if (*game_days != 0)
95         pr("Game days are: %s\n", game_days);
96     if (*game_hours != 0)
97         pr("Game hours are: %s\n", game_hours);
98
99     pr("\nThis command is obsolete and will go away in a future version.\n"
100        "Please use \"show updates\".");
101     return 0;
102 }