Fix put_empobj() for types other than units
put_empobj() used struct empobj member uid, which is valid only for units. Existing users pass only units, fortunately. Fix by making it take type and uid parameters.
This commit is contained in:
parent
dd2d2d361a
commit
59c65239f7
4 changed files with 5 additions and 15 deletions
|
@ -91,7 +91,7 @@ struct empobj_chr;
|
||||||
|
|
||||||
extern char *obj_nameof(struct empobj *gp);
|
extern char *obj_nameof(struct empobj *gp);
|
||||||
extern struct empobj *get_empobjp(int type, int id);
|
extern struct empobj *get_empobjp(int type, int id);
|
||||||
extern int put_empobj(struct empobj *gp);
|
extern int put_empobj(int, int, struct empobj *gp);
|
||||||
extern struct empobj_chr *get_empobj_chr(struct empobj *gp);
|
extern struct empobj_chr *get_empobj_chr(struct empobj *gp);
|
||||||
extern char *emp_obj_chr_name(struct empobj *gp);
|
extern char *emp_obj_chr_name(struct empobj *gp);
|
||||||
extern int get_empobj_mob_max(int type);
|
extern int get_empobj_mob_max(int type);
|
||||||
|
|
|
@ -321,7 +321,7 @@ mission(void)
|
||||||
gp->mission = mission;
|
gp->mission = mission;
|
||||||
gp->opx = x;
|
gp->opx = x;
|
||||||
gp->opy = y;
|
gp->opy = y;
|
||||||
put_empobj(gp);
|
put_empobj(type, gp->uid, gp);
|
||||||
}
|
}
|
||||||
if (num == 0) {
|
if (num == 0) {
|
||||||
pr("No %s%s\n", ef_nameof(type), splur(num));
|
pr("No %s%s\n", ef_nameof(type), splur(num));
|
||||||
|
|
|
@ -66,19 +66,9 @@ get_empobjp(int type, int id)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
put_empobj(struct empobj *gp)
|
put_empobj(int type, int id, struct empobj *gp)
|
||||||
{
|
{
|
||||||
switch (gp->ef_type)
|
return ef_write(type, id, gp);
|
||||||
{
|
|
||||||
case EF_SECTOR:
|
|
||||||
return ef_write(gp->ef_type, sctoff(gp->x, gp->y), gp);
|
|
||||||
case EF_NATION:
|
|
||||||
case EF_BMAP:
|
|
||||||
case EF_MAP:
|
|
||||||
return ef_write(gp->ef_type, gp->own, gp);
|
|
||||||
default:
|
|
||||||
return ef_write(gp->ef_type, gp->uid, gp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct empobj_chr *
|
struct empobj_chr *
|
||||||
|
|
|
@ -118,7 +118,7 @@ unit_put(struct emp_qelem *list, natid actor)
|
||||||
}
|
}
|
||||||
if (ulp->unit.ef_type == EF_SHIP)
|
if (ulp->unit.ef_type == EF_SHIP)
|
||||||
ulp->unit.ship.shp_mobil = (int)ulp->mobil;
|
ulp->unit.ship.shp_mobil = (int)ulp->mobil;
|
||||||
put_empobj(&ulp->unit.gen);
|
put_empobj(ulp->unit.gen.ef_type, ulp->unit.gen.uid, &ulp->unit.gen);
|
||||||
newqp = qp->q_back;
|
newqp = qp->q_back;
|
||||||
emp_remque(qp);
|
emp_remque(qp);
|
||||||
free(qp);
|
free(qp);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue