]> git.pond.sub.org Git - empserver/commitdiff
New server.h for server startup, control and shutdown, i.e. stuff in
authorMarkus Armbruster <armbru@pond.sub.org>
Thu, 19 Feb 2004 19:02:30 +0000 (19:02 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 19 Feb 2004 19:02:30 +0000 (19:02 +0000)
src/server.  Use it.

19 files changed:
include/server.h [new file with mode: 0644]
src/lib/commands/forc.c
src/lib/commands/mobu.c
src/lib/commands/shut.c
src/lib/commands/upda.c
src/lib/commands/zdon.c
src/lib/player/dispatch.c
src/lib/subs/aircombat.c
src/lib/subs/pr.c
src/lib/subs/rej.c
src/lib/subs/shpsub.c
src/lib/subs/wu.c
src/lib/update/mobility.c
src/server/idle.c
src/server/lostitem.c
src/server/main.c
src/server/marketup.c
src/server/timestamp.c
src/server/update.c

diff --git a/include/server.h b/include/server.h
new file mode 100644 (file)
index 0000000..b233984
--- /dev/null
@@ -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
index d3a1dd15bb2a659701f372594f39676c0790f2a7..ccca0628725ba992ad253ccfb15ece29bf4c77ce 100644 (file)
 #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;
 
index f67dd0b195e2341f0ff561c5972a6394343ed45d..6de51ece2ec4ca2f9a362cb0373654df22bc5565 100644 (file)
@@ -43,6 +43,7 @@
 #include "file.h"
 #include "commands.h"
 #include "optlist.h"
+#include "server.h"
 #include "prototypes.h"
 
 #include <stdio.h>
@@ -52,7 +53,6 @@ mobupdate(void)
 {
     FILE *fp;
     long minites;
-    extern int updating_mob;
     struct mob_acc_globals timestamps;
     long now;
 
index 1a0c299eb000d6e21fbc5b12d0901bbef1300cae..7af864641074235aa5872811fe76192f2a0ae220 100644 (file)
 #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];
index 0bd8c59b7a2ca10305a98fe66688ba0339e2ca3b..ec80aaabd59c24b2215d4159735b8aa91608c309 100644 (file)
@@ -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");
index 2d44fa55c924168de4b0eaaf893f098edb6cece7..f2257647dc55852d32be72c1552cdcf18b4fb636 100644 (file)
 #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;
index 3ee407c0b9d9729356eed211d67f6f8dfb23ea6a..283dc0969d3f16cc44ebe6221bc6bd15eb2f54a6 100644 (file)
 #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;
index ad128e76ccb4a04da2f1e50000b3a82e679347e1..7aa245fa797f9bf8493074c79a352654b804095c 100644 (file)
@@ -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))
index 449553be330766029d95604a1ddb0083afcd8df8..06cf504a6d4a9f3cbacfb9d122ec3c5cccc73cbe 100644 (file)
@@ -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);
index 462eff93739862f1fddd40c3b52a51fd03a75ba8..8c9e58746e8be185387e472af34f0deb9ba6d46c 100644 (file)
@@ -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)
index 6509700d385d6859c480a25edddf92798b8ec3b3..9c61262c5ffa8b26b9842d3f04406b22f833a7c3 100644 (file)
@@ -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;
index 18b5d3255f7716d7eb44e67b8866362aa9575685..0803be3038ed4418441bf1cfbae0c5c3d499bdfe 100644 (file)
@@ -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);
index 54080b058960189244e316d3aa7c3f7aea535a66..3157cbd872fc066410af03e7c8828d72586f041c 100644 (file)
@@ -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;
index e197dc851307617e36a9ab3793e72728ade215da..1295edce1dfb9d54917c392a1cf923387805d6ff 100644 (file)
@@ -38,6 +38,7 @@
 #include "proto.h"
 #include "prototypes.h"
 #include "optlist.h"
+#include "server.h"
 
 /*ARGSUSED*/
 void
index 5defc990e979601dcd071968dfe7cf7755cd04f5..1910a56ea6a0efde002a029534ce6ab3e4390b4f 100644 (file)
@@ -41,6 +41,7 @@
 #include <stdio.h>
 #include "prototypes.h"
 #include "optlist.h"
+#include "server.h"
 
 /*ARGSUSED*/
 void
index 3ed013c3e8bbb776b6ae5930ce4b2b433cf5a137..70a6ece2568b70d973803fbca213d8c314852706 100644 (file)
 #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);
index afe1e41f6f9de890793ded36e469e2b9bceab989..6f7eed4bbf93578416d2da7b7130d4a07a921c6d 100644 (file)
@@ -37,6 +37,7 @@
 #include "keyword.h"
 #include "empthread.h"
 #include "file.h"
+#include "server.h"
 #include <stdio.h>
 #include "prototypes.h"
 
index 14e6dee117f38a7dbef40bec6ea2a0ca593c221b..a70f98674668f29a3ff907684124da0050a18224 100644 (file)
 #include <stdio.h>
 #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;
index 7a444c421ba6a88ddcb6c16c170270a35481a117..b7a10664545802f13493944dfce6180cf5f70e4d 100644 (file)
@@ -38,6 +38,7 @@
 #include "empthread.h"
 #include "prototypes.h"
 #include "optlist.h"
+#include "server.h"
 
 empth_sem_t *update_sem;