From: Markus Armbruster Date: Thu, 19 Feb 2004 19:02:30 +0000 (+0000) Subject: New server.h for server startup, control and shutdown, i.e. stuff in X-Git-Tag: v4.2.14~163 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=22a356b1e140e291558dce3ed52fae00b0b5e5a0 New server.h for server startup, control and shutdown, i.e. stuff in src/server. Use it. --- diff --git a/include/server.h b/include/server.h new file mode 100644 index 000000000..b233984b6 --- /dev/null +++ b/include/server.h @@ -0,0 +1,55 @@ +/* + * Empire - A multi-player, client/server Internet based war game. + * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak, + * Ken Stevens, Steve McClure + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * --- + * + * See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the + * related information and legal notices. It is expected that any future + * projects/authors will amend these files as needed. + * + * --- + * + * server.h: Server startup, control and shutdown + * + * Known contributors to this file: + * Markus Armbruster, 2004 + */ + +#ifndef SERVER_H +#define SERVER_H + +extern int shutdown_pending; +extern int update_pending; +extern empth_sem_t *update_sem; +extern time_t update_time; +extern int updating_mob; + +void mobility_init(void); + +/* thread entry points */ +void player_accept(void *); +void delete_lostitems(void *); +void market_update(void *); +void mobility_check(void *); +void player_kill_idle(void *); +void update_main(void *); +void update_sched(void *); +void shutdown_sequence(void *); + +#endif SERVER_H diff --git a/src/lib/commands/forc.c b/src/lib/commands/forc.c index d3a1dd15b..ccca06287 100644 --- a/src/lib/commands/forc.c +++ b/src/lib/commands/forc.c @@ -36,13 +36,11 @@ #include "player.h" #include "empthread.h" #include "commands.h" +#include "server.h" int force(void) { - extern empth_sem_t *update_sem; - extern int update_pending; - extern int shutdown_pending; int seconds; time_t now; diff --git a/src/lib/commands/mobu.c b/src/lib/commands/mobu.c index f67dd0b19..6de51ece2 100644 --- a/src/lib/commands/mobu.c +++ b/src/lib/commands/mobu.c @@ -43,6 +43,7 @@ #include "file.h" #include "commands.h" #include "optlist.h" +#include "server.h" #include "prototypes.h" #include @@ -52,7 +53,6 @@ mobupdate(void) { FILE *fp; long minites; - extern int updating_mob; struct mob_acc_globals timestamps; long now; diff --git a/src/lib/commands/shut.c b/src/lib/commands/shut.c index 1a0c299eb..7af864641 100644 --- a/src/lib/commands/shut.c +++ b/src/lib/commands/shut.c @@ -38,13 +38,12 @@ #include "nat.h" #include "file.h" #include "commands.h" +#include "server.h" #include "prototypes.h" int shut(void) { - extern int update_pending; - extern int shutdown_pending; int shutdown_minutes; int shutdown_was_pending; s_char buf[100]; diff --git a/src/lib/commands/upda.c b/src/lib/commands/upda.c index 0bd8c59b7..ec80aaabd 100644 --- a/src/lib/commands/upda.c +++ b/src/lib/commands/upda.c @@ -39,6 +39,7 @@ #include "optlist.h" #include "keyword.h" #include "wantupd.h" +#include "server.h" /* * Tell what the update policy is, and when the next update @@ -49,7 +50,6 @@ upda(void) { FILE *fp; struct mob_acc_globals timestamps; - extern int updating_mob; if (opt_MOB_ACCESS) { #if !defined(_WIN32) @@ -73,7 +73,6 @@ upda(void) } if (opt_UPDATESCHED) { time_t now, next, delta; - extern int update_time; if (updates_disabled()) pr("UPDATES ARE DISABLED!\n"); diff --git a/src/lib/commands/zdon.c b/src/lib/commands/zdon.c index 2d44fa55c..f2257647d 100644 --- a/src/lib/commands/zdon.c +++ b/src/lib/commands/zdon.c @@ -58,11 +58,11 @@ #include "empthread.h" #include "commands.h" #include "optlist.h" +#include "server.h" int zdon(void) { - extern empth_sem_t *update_sem; natid whichcnum; struct natstr *natp; register s_char *p; diff --git a/src/lib/player/dispatch.c b/src/lib/player/dispatch.c index 3ee407c0b..283dc0969 100644 --- a/src/lib/player/dispatch.c +++ b/src/lib/player/dispatch.c @@ -44,12 +44,12 @@ #include "optlist.h" #include "subs.h" #include "common.h" +#include "server.h" int dispatch(s_char *buf, s_char *redir) { extern struct cmndstr player_coms[]; - extern int update_pending; struct natstr *np; struct cmndstr *command; int cmd; diff --git a/src/lib/subs/aircombat.c b/src/lib/subs/aircombat.c index ad128e76c..7aa245fa7 100644 --- a/src/lib/subs/aircombat.c +++ b/src/lib/subs/aircombat.c @@ -51,8 +51,8 @@ #include "path.h" #include "prototypes.h" #include "optlist.h" +#include "server.h" -extern int update_pending; #ifndef MIN #define MIN(x,y) ((x) < (y) ? (x) : (y)) diff --git a/src/lib/subs/pr.c b/src/lib/subs/pr.c index 449553be3..06cf504a6 100644 --- a/src/lib/subs/pr.c +++ b/src/lib/subs/pr.c @@ -53,7 +53,7 @@ #include "com.h" #include "news.h" #include "tel.h" -extern int update_pending; +#include "server.h" #include "prototypes.h" static void outid(struct player *pl, int n); diff --git a/src/lib/subs/rej.c b/src/lib/subs/rej.c index 462eff937..8c9e58746 100644 --- a/src/lib/subs/rej.c +++ b/src/lib/subs/rej.c @@ -38,9 +38,9 @@ #include "player.h" #include "prototypes.h" #include "optlist.h" +#include "server.h" extern s_char *relates[]; -extern int update_pending; int setrel(natid us, natid them, int rel) diff --git a/src/lib/subs/shpsub.c b/src/lib/subs/shpsub.c index 6509700d3..9c61262c5 100644 --- a/src/lib/subs/shpsub.c +++ b/src/lib/subs/shpsub.c @@ -50,6 +50,7 @@ #include "mission.h" #include "optlist.h" #include "damage.h" +#include "server.h" #include "prototypes.h" extern double tfactfire(natid, double); @@ -119,7 +120,6 @@ void shp_nav(struct emp_qelem *list, double *minmobp, double *maxmobp, int *togetherp, natid actor) { - extern int update_pending; struct emp_qelem *qp; struct emp_qelem *next; struct mlist *mlp; diff --git a/src/lib/subs/wu.c b/src/lib/subs/wu.c index 18b5d3255..0803be303 100644 --- a/src/lib/subs/wu.c +++ b/src/lib/subs/wu.c @@ -42,6 +42,7 @@ #include "tel.h" #include "file.h" #include "player.h" +#include "server.h" #include "prototypes.h" static struct telstr last_tel[MAXNOC]; @@ -62,7 +63,6 @@ clear_telegram_is_new(natid to) static int telegram_is_new(natid to, struct telstr *tel) { - extern int update_pending; int is_new = 0; is_new |= tel->tel_type != last_tel[to].tel_type; @@ -84,7 +84,6 @@ wu(natid from, natid to, s_char *format, ...) struct natstr *np; va_list ap; s_char buf[4096]; - extern int update_pending; va_start(ap, format); (void)vsprintf(buf, format, ap); diff --git a/src/lib/update/mobility.c b/src/lib/update/mobility.c index 54080b058..3157cbd87 100644 --- a/src/lib/update/mobility.c +++ b/src/lib/update/mobility.c @@ -46,8 +46,8 @@ #include "gen.h" #include "subs.h" #include "optlist.h" +#include "server.h" -extern int update_pending; int updating_mob = 1; @@ -65,7 +65,6 @@ increase_mob(time_t * counter, float mult) time_t secs; time_t now; time_t left; - extern int updating_mob; int newetus; float newmob; int inewmob; diff --git a/src/server/idle.c b/src/server/idle.c index e197dc851..1295edce1 100644 --- a/src/server/idle.c +++ b/src/server/idle.c @@ -38,6 +38,7 @@ #include "proto.h" #include "prototypes.h" #include "optlist.h" +#include "server.h" /*ARGSUSED*/ void diff --git a/src/server/lostitem.c b/src/server/lostitem.c index 5defc990e..1910a56ea 100644 --- a/src/server/lostitem.c +++ b/src/server/lostitem.c @@ -41,6 +41,7 @@ #include #include "prototypes.h" #include "optlist.h" +#include "server.h" /*ARGSUSED*/ void diff --git a/src/server/main.c b/src/server/main.c index 3ed013c3e..70a6ece25 100644 --- a/src/server/main.c +++ b/src/server/main.c @@ -64,14 +64,11 @@ #include "product.h" #include "optlist.h" #include "global.h" +#include "server.h" #include "prototypes.h" s_char program[] = "server"; -extern void player_accept(void *); -extern void player_kill_idle(void *); -extern void update_sched(void *); -extern void delete_lostitems(void *); void nullify_objects(void); void init_files(void); void close_files(void); diff --git a/src/server/marketup.c b/src/server/marketup.c index afe1e41f6..6f7eed4bb 100644 --- a/src/server/marketup.c +++ b/src/server/marketup.c @@ -37,6 +37,7 @@ #include "keyword.h" #include "empthread.h" #include "file.h" +#include "server.h" #include #include "prototypes.h" diff --git a/src/server/timestamp.c b/src/server/timestamp.c index 14e6dee11..a70f98674 100644 --- a/src/server/timestamp.c +++ b/src/server/timestamp.c @@ -40,12 +40,12 @@ #include #include "prototypes.h" #include "optlist.h" +#include "server.h" /*ARGSUSED*/ void mobility_check(void *argv) { - extern int updating_mob; struct mob_acc_globals timestamps; time_t now; FILE *fp; @@ -93,7 +93,6 @@ mobility_check(void *argv) void mobility_init(void) { - extern int updating_mob; struct mob_acc_globals timestamps; time_t now; time_t lastsavedtime; diff --git a/src/server/update.c b/src/server/update.c index 7a444c421..b7a106645 100644 --- a/src/server/update.c +++ b/src/server/update.c @@ -38,6 +38,7 @@ #include "empthread.h" #include "prototypes.h" #include "optlist.h" +#include "server.h" empth_sem_t *update_sem;