New server.h for server startup, control and shutdown, i.e. stuff in
src/server. Use it.
This commit is contained in:
parent
8115388a58
commit
22a356b1e1
19 changed files with 73 additions and 24 deletions
55
include/server.h
Normal file
55
include/server.h
Normal file
|
@ -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
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "proto.h"
|
||||
#include "prototypes.h"
|
||||
#include "optlist.h"
|
||||
#include "server.h"
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <stdio.h>
|
||||
#include "prototypes.h"
|
||||
#include "optlist.h"
|
||||
#include "server.h"
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "keyword.h"
|
||||
#include "empthread.h"
|
||||
#include "file.h"
|
||||
#include "server.h"
|
||||
#include <stdio.h>
|
||||
#include "prototypes.h"
|
||||
|
||||
|
|
|
@ -40,12 +40,12 @@
|
|||
#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;
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "empthread.h"
|
||||
#include "prototypes.h"
|
||||
#include "optlist.h"
|
||||
#include "server.h"
|
||||
|
||||
empth_sem_t *update_sem;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue