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
|
@ -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