/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
*
* ---
*
- * 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.
+ * See files README, COPYING and CREDITS in the root of the source
+ * tree for related information and legal notices. It is expected
+ * that future projects/authors will amend these files as needed.
*
* ---
*
* Steve McClure, 1998-1999
*/
+#include <config.h>
+
#include "misc.h"
-#include "var.h"
#include "sect.h"
#include "ship.h"
#include "land.h"
#include "nat.h"
#include "file.h"
#include "optlist.h"
-#include "mission.h"
#include "update.h"
#include "gen.h"
#include "subs.h"
#include "optlist.h"
+#include "server.h"
+
-extern int timestamp_fixing;
-extern int update_pending;
-int do_upd_checking = 0;
+int updating_mob = 1;
-static void do_mob_land(register struct lndstr *, register int);
-static void do_mob_plane(register struct plnstr *, register int);
-static void do_mob_sect(register struct sctstr *sp, register int etus);
-static void do_mob_ship(register struct shpstr *, register int);
+static int timestamp_fixing;
+static int do_upd_checking = 0;
+
+static void do_mob_land(struct lndstr *, int);
+static void do_mob_plane(struct plnstr *, int);
+static void do_mob_sect(struct sctstr *sp, int etus);
+static void do_mob_ship(struct shpstr *, int);
static int
-increase_mob(time_t * counter, float mult)
+increase_mob(time_t *counter, float mult)
{
time_t secs;
time_t now;
time_t left;
- extern long s_p_etu;
- extern int updating_mob;
int newetus;
float newmob;
int inewmob;
*counter = *counter - left;
if (updating_mob)
- return (newetus);
+ return newetus;
return 0;
}
}
void
-sct_do_upd_mob(register struct sctstr *sp)
+sct_do_upd_mob(struct sctstr *sp)
{
- extern float sect_mob_scale;
int etus;
if (do_upd_checking || timestamp_fixing || update_pending)
}
void
-shp_do_upd_mob(register struct shpstr *sp)
+shp_do_upd_mob(struct shpstr *sp)
{
- extern float ship_mob_scale;
int etus;
if (do_upd_checking || timestamp_fixing || update_pending)
}
void
-lnd_do_upd_mob(register struct lndstr *lp)
+lnd_do_upd_mob(struct lndstr *lp)
{
- extern float land_mob_scale;
int etus;
if (do_upd_checking || timestamp_fixing || update_pending)
}
void
-pln_do_upd_mob(register struct plnstr *pp)
+pln_do_upd_mob(struct plnstr *pp)
{
- extern float plane_mob_scale;
int etus;
if (do_upd_checking || timestamp_fixing || update_pending)
}
void
-mob_sect(register int etus)
+mob_sect(int etus)
{
- register struct sctstr *sp;
- register int n;
+ struct sctstr *sp;
+ int n;
time_t now;
time(&now);
}
static void
-do_mob_sect(register struct sctstr *sp, register int etus)
+do_mob_sect(struct sctstr *sp, int etus)
{
- extern float sect_mob_scale;
- extern int sect_mob_max;
- register int value;
+ int value;
if (sp->sct_own == 0)
return;
}
void
-mob_ship(register int etus)
+mob_ship(int etus)
{
- register struct shpstr *sp;
- register int n;
+ struct shpstr *sp;
+ int n;
time_t now;
time(&now);
}
static void
-do_mob_ship(register struct shpstr *sp, register int etus)
+do_mob_ship(struct shpstr *sp, int etus)
{
- extern int ship_mob_max;
- extern float ship_mob_scale;
int newfuel = 0;
- register int value;
+ int value;
int can_add, have_fuel_for, total_add;
double d;
- extern int fuel_mult;
if (sp->shp_own == 0)
return;
d *= (double)mchr[(int)sp->shp_type].m_fuelu;
d /= (double)fuel_mult;
sp->shp_fuel -= (u_char)ldround(d, 1);
- sp->shp_fuel = (u_char)min(sp->shp_fuel,
+ sp->shp_fuel = (u_char)MIN(sp->shp_fuel,
mchr[(int)sp->shp_type].m_fuelc);
sp->shp_mobil += (s_char)total_add;
}
}
void
-mob_land(register int etus)
+mob_land(int etus)
{
- register struct lndstr *lp;
- register int n;
+ struct lndstr *lp;
+ int n;
time_t now;
time(&now);
}
static void
-do_mob_land(register struct lndstr *lp, register int etus)
+do_mob_land(struct lndstr *lp, int etus)
{
- extern int land_mob_max;
- extern float land_mob_scale;
int newfuel = 0;
- register int value;
+ int value;
int can_add, have_fuel_for, total_add;
double d;
- extern int fuel_mult;
if (lp->lnd_own == 0)
return;
d *= (double)lp->lnd_fuelu;
d /= (double)fuel_mult;
lp->lnd_fuel -= (u_char)ldround(d, 1);
- lp->lnd_fuel = (u_char)min(lp->lnd_fuel, lp->lnd_fuelc);
+ lp->lnd_fuel = (u_char)MIN(lp->lnd_fuel, lp->lnd_fuelc);
if (total_add + lp->lnd_mobil > land_mob_max) {
total_add = land_mob_max - lp->lnd_mobil;
}
}
void
-mob_plane(register int etus)
+mob_plane(int etus)
{
- register struct plnstr *pp;
- register int n;
+ struct plnstr *pp;
+ int n;
time_t now;
time(&now);
}
static void
-do_mob_plane(register struct plnstr *pp, register int etus)
+do_mob_plane(struct plnstr *pp, int etus)
{
- extern int plane_mob_max;
- extern float plane_mob_scale;
- register int value;
+ int value;
if (pp->pln_own == 0)
return;