extern int get_materials(struct sctstr *, short[], int);
/* mobility.c */
extern void mob_inc_all(int);
-extern void sct_do_upd_mob(struct sctstr *sp);
-extern void shp_do_upd_mob(struct shpstr *sp);
-extern void lnd_do_upd_mob(struct lndstr *lp);
-extern void pln_do_upd_mob(struct plnstr *pp);
+extern void mob_inc_sect(struct sctstr *, int);
+extern void mob_inc_ship(struct shpstr *, int);
+extern void mob_inc_plane(struct plnstr *, int);
+extern void mob_inc_land(struct lndstr *, int);
extern void mob_access_all(void);
/* move_sat.c */
extern void move_sat(struct plnstr *);
#include "optlist.h"
#include "plane.h"
#include "sect.h"
-#include "server.h"
#include "ship.h"
#include "update.h"
-static int do_upd_checking;
-
-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);
-
-void
-sct_do_upd_mob(struct sctstr *sp)
-{
- int etus;
-
- if (do_upd_checking || update_running)
- return;
- if (sp->sct_own == 0)
- return;
- if (sp->sct_type == SCT_SANCT)
- return;
- etus = game_tick_to_now(&sp->sct_access);
- if (etus == 0)
- return;
-
- do_upd_checking = 1; /* avoid recursion */
- do_mob_sect(sp, etus);
- do_upd_checking = 0;
-}
-
-void
-shp_do_upd_mob(struct shpstr *sp)
-{
- int etus;
-
- if (do_upd_checking || update_running)
- return;
- if (sp->shp_own == 0)
- return;
- etus = game_tick_to_now(&sp->shp_access);
- if (etus == 0)
- return;
-
- do_upd_checking = 1; /* avoid recursion */
- do_mob_ship(sp, etus);
- do_upd_checking = 0;
-}
-
-void
-lnd_do_upd_mob(struct lndstr *lp)
-{
- int etus;
-
- if (do_upd_checking || update_running)
- return;
- if (lp->lnd_own == 0)
- return;
- etus = game_tick_to_now(&lp->lnd_access);
- if (etus == 0)
- return;
-
- do_upd_checking = 1; /* avoid recursion */
- do_mob_land(lp, etus);
- do_upd_checking = 0;
-}
-
-void
-pln_do_upd_mob(struct plnstr *pp)
-{
- int etus;
-
- if (do_upd_checking || update_running)
- return;
- if (pp->pln_own == 0)
- return;
- etus = game_tick_to_now(&pp->pln_access);
- if (etus == 0)
- return;
-
- do_upd_checking = 1; /* avoid recursion */
- do_mob_plane(pp, etus);
- do_upd_checking = 0;
-}
-
/* Increase mobility of everything for @etus ETUs, update timestamps */
void
mob_inc_all(int etus)
for (i = 0; (sectp = getsectid(i)); i++) {
sectp->sct_timestamp = now;
if (!opt_MOB_ACCESS)
- do_mob_sect(sectp, etus);
+ mob_inc_sect(sectp, etus);
}
for (i = 0; (sp = getshipp(i)); i++) {
sp->shp_timestamp = now;
if (!opt_MOB_ACCESS)
- do_mob_ship(sp, etus);
+ mob_inc_ship(sp, etus);
}
for (i = 0; (pp = getplanep(i)); i++) {
pp->pln_timestamp = now;
if (!opt_MOB_ACCESS)
- do_mob_plane(pp, etus);
+ mob_inc_plane(pp, etus);
}
for (i = 0; (lp = getlandp(i)); i++) {
lp->lnd_timestamp = now;
if (!opt_MOB_ACCESS)
- do_mob_land(lp, etus);
+ mob_inc_land(lp, etus);
}
}
-static void
-do_mob_sect(struct sctstr *sp, int etus)
+/* Increase @sp's mobility for @etus ETUs */
+void
+mob_inc_sect(struct sctstr *sp, int etus)
{
int value;
sp->sct_mobil = value;
}
-static void
-do_mob_ship(struct shpstr *sp, int etus)
+/* Increase @sp's mobility for @etus ETUs */
+void
+mob_inc_ship(struct shpstr *sp, int etus)
{
int value;
sp->shp_mobil = (signed char)value;
}
-static void
-do_mob_land(struct lndstr *lp, int etus)
+/* Increase @lp's mobility for @etus ETUs */
+void
+mob_inc_land(struct lndstr *lp, int etus)
{
int value;
lp->lnd_mobil = value;
}
-static void
-do_mob_plane(struct plnstr *pp, int etus)
+/* Increase @pp's mobility for @etus ETUs */
+void
+mob_inc_plane(struct plnstr *pp, int etus)
{
int value;
return;
for (i = 0; (sectp = getsectid(i)); i++)
- do_mob_sect(sectp, game_reset_tick(§p->sct_access));
+ mob_inc_sect(sectp, game_reset_tick(§p->sct_access));
for (i = 0; (sp = getshipp(i)); i++)
- do_mob_ship(sp, game_reset_tick(&sp->shp_access));
+ mob_inc_ship(sp, game_reset_tick(&sp->shp_access));
for (i = 0; (pp = getplanep(i)); i++)
- do_mob_plane(pp, game_reset_tick(&pp->pln_access));
+ mob_inc_plane(pp, game_reset_tick(&pp->pln_access));
for (i = 0; (lp = getlandp(i)); i++)
- do_mob_land(lp, game_reset_tick(&lp->lnd_access));
+ mob_inc_land(lp, game_reset_tick(&lp->lnd_access));
}