Move pln_oninit(), lnd_oninit(), nuk_oninit() to filetable.c
They set up invariants, and thus should be always active, not just in the server. Since ef_blank() isn't used for these files outside the server right now, this isn't a bug fix, just cleanup.
This commit is contained in:
parent
3fe3cd376f
commit
31b9ff08f3
6 changed files with 35 additions and 37 deletions
|
@ -431,7 +431,6 @@ extern void bitinit2(struct nstr_sect *, unsigned char *, int);
|
|||
extern int getele(char *, char *);
|
||||
/* land.c */
|
||||
extern char *prland(struct lndstr *);
|
||||
extern void lnd_oninit(void *);
|
||||
extern void lnd_postread(int, void *);
|
||||
extern void lnd_prewrite(int, void *, void *);
|
||||
/* landgun.c */
|
||||
|
@ -489,7 +488,6 @@ extern void init_nreport(void);
|
|||
extern void nreport(natid, int, natid, int);
|
||||
/* nuke.c */
|
||||
extern char *prnuke(struct nukstr *);
|
||||
extern void nuk_oninit(void *);
|
||||
extern void nuk_postread(int, void *);
|
||||
extern void nuk_prewrite(int, void *, void *);
|
||||
/* nxtitem.c */
|
||||
|
@ -499,7 +497,6 @@ extern void nuk_prewrite(int, void *, void *);
|
|||
extern int onearg(char *, char *);
|
||||
/* plane.c */
|
||||
extern char *prplane(struct plnstr *);
|
||||
extern void pln_oninit(void *);
|
||||
extern void pln_postread(int, void *);
|
||||
extern void pln_prewrite(int, void *, void *);
|
||||
/* plnsub.c */
|
||||
|
|
|
@ -56,6 +56,9 @@
|
|||
#include "xy.h"
|
||||
|
||||
static void sct_oninit(void *);
|
||||
static void pln_oninit(void *);
|
||||
static void lnd_oninit(void *);
|
||||
static void nuk_oninit(void *);
|
||||
static void nat_oninit(void *);
|
||||
static void realm_oninit(void *);
|
||||
static void game_oninit(void *);
|
||||
|
@ -134,14 +137,14 @@ struct empfile empfile[] = {
|
|||
{EF_PLANE, "plane", "plane", plane_ca, EF_BAD,
|
||||
UNMAPPED_CACHE(struct plnstr, -1,
|
||||
EFF_TYPED | EFF_XY | EFF_OWNER | EFF_GROUP),
|
||||
NULL, NULL, NULL, NULL},
|
||||
pln_oninit, NULL, NULL, NULL},
|
||||
{EF_LAND, "land", "land", land_ca, EF_BAD,
|
||||
UNMAPPED_CACHE(struct lndstr, -1,
|
||||
EFF_TYPED | EFF_XY | EFF_OWNER | EFF_GROUP),
|
||||
NULL, NULL, NULL, NULL},
|
||||
lnd_oninit, NULL, NULL, NULL},
|
||||
{EF_NUKE, "nuke", "nuke", nuke_ca, EF_BAD,
|
||||
UNMAPPED_CACHE(struct nukstr, -1, EFF_TYPED | EFF_XY | EFF_OWNER),
|
||||
NULL, NULL, NULL, NULL},
|
||||
nuk_oninit, NULL, NULL, NULL},
|
||||
{EF_NEWS, "news", "news", news_ca, EF_BAD,
|
||||
UNMAPPED_CACHE(struct nwsstr, -1, 0),
|
||||
NULL, NULL, NULL, NULL},
|
||||
|
@ -279,6 +282,30 @@ sct_oninit(void *ptr)
|
|||
sp->sct_coastal = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
pln_oninit(void *ptr)
|
||||
{
|
||||
struct plnstr *pp = ptr;
|
||||
|
||||
pp->pln_ship = pp->pln_land = -1;
|
||||
}
|
||||
|
||||
static void
|
||||
lnd_oninit(void *ptr)
|
||||
{
|
||||
struct lndstr *lp = ptr;
|
||||
|
||||
lp->lnd_ship = lp->lnd_land = -1;
|
||||
}
|
||||
|
||||
static void
|
||||
nuk_oninit(void *ptr)
|
||||
{
|
||||
struct nukstr *np = ptr;
|
||||
|
||||
np->nuk_plane = -1;
|
||||
}
|
||||
|
||||
static void
|
||||
nat_oninit(void *ptr)
|
||||
{
|
||||
|
|
|
@ -40,18 +40,17 @@
|
|||
|
||||
struct fileinit {
|
||||
int ef_type;
|
||||
void (*oninit)(void *);
|
||||
void (*postread)(int, void *);
|
||||
void (*prewrite)(int, void *, void *);
|
||||
void (*onresize)(int);
|
||||
};
|
||||
|
||||
static struct fileinit fileinit[] = {
|
||||
{EF_SECTOR, NULL, sct_postread, sct_prewrite, NULL},
|
||||
{EF_SHIP, NULL, shp_postread, shp_prewrite, unit_onresize},
|
||||
{EF_PLANE, pln_oninit, pln_postread, pln_prewrite, unit_onresize},
|
||||
{EF_LAND, lnd_oninit, lnd_postread, lnd_prewrite, unit_onresize},
|
||||
{EF_NUKE, nuk_oninit, nuk_postread, nuk_prewrite, unit_onresize}
|
||||
{EF_SECTOR, sct_postread, sct_prewrite, NULL},
|
||||
{EF_SHIP, shp_postread, shp_prewrite, unit_onresize},
|
||||
{EF_PLANE, pln_postread, pln_prewrite, unit_onresize},
|
||||
{EF_LAND, lnd_postread, lnd_prewrite, unit_onresize},
|
||||
{EF_NUKE, nuk_postread, nuk_prewrite, unit_onresize}
|
||||
};
|
||||
|
||||
static void ef_open_srv(void);
|
||||
|
@ -66,7 +65,6 @@ ef_init_srv(void)
|
|||
unsigned i;
|
||||
|
||||
for (i = 0; i < sizeof(fileinit) / sizeof(fileinit[0]); i++) {
|
||||
empfile[fileinit[i].ef_type].oninit = fileinit[i].oninit;
|
||||
empfile[fileinit[i].ef_type].postread = fileinit[i].postread;
|
||||
empfile[fileinit[i].ef_type].prewrite = fileinit[i].prewrite;
|
||||
empfile[fileinit[i].ef_type].onresize = fileinit[i].onresize;
|
||||
|
|
|
@ -88,14 +88,6 @@ lnd_prewrite(int n, void *old, void *new)
|
|||
unit_update_cargo((struct empobj *)lp);
|
||||
}
|
||||
|
||||
void
|
||||
lnd_oninit(void *ptr)
|
||||
{
|
||||
struct lndstr *lp = ptr;
|
||||
|
||||
lp->lnd_ship = lp->lnd_land = -1;
|
||||
}
|
||||
|
||||
char *
|
||||
prland(struct lndstr *lp)
|
||||
{
|
||||
|
|
|
@ -77,14 +77,6 @@ nuk_prewrite(int n, void *old, void *new)
|
|||
np->nuk_own = own;
|
||||
}
|
||||
|
||||
void
|
||||
nuk_oninit(void *ptr)
|
||||
{
|
||||
struct nukstr *np = ptr;
|
||||
|
||||
np->nuk_plane = -1;
|
||||
}
|
||||
|
||||
char *
|
||||
prnuke(struct nukstr *np)
|
||||
{
|
||||
|
|
|
@ -87,14 +87,6 @@ pln_prewrite(int n, void *old, void *new)
|
|||
unit_update_cargo((struct empobj *)pp);
|
||||
}
|
||||
|
||||
void
|
||||
pln_oninit(void *ptr)
|
||||
{
|
||||
struct plnstr *pp = ptr;
|
||||
|
||||
pp->pln_ship = pp->pln_land = -1;
|
||||
}
|
||||
|
||||
char *
|
||||
prplane(struct plnstr *pp)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue