Replace trade_check_item_ok() by check_obj_ok()
Relaxes the sanity check of the argument's ef_type. Could be avoided, but not worth the bother.
This commit is contained in:
parent
29f6d10a34
commit
f75544ee70
3 changed files with 2 additions and 19 deletions
|
@ -58,7 +58,6 @@ struct trdstr {
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int trade_check_ok(struct trdstr *, union empobj_storage *);
|
extern int trade_check_ok(struct trdstr *, union empobj_storage *);
|
||||||
extern int trade_check_item_ok(union empobj_storage *);
|
|
||||||
extern char *trade_nameof(struct trdstr *, union empobj_storage *);
|
extern char *trade_nameof(struct trdstr *, union empobj_storage *);
|
||||||
extern int trade_desc(struct trdstr *, union empobj_storage *);
|
extern int trade_desc(struct trdstr *, union empobj_storage *);
|
||||||
extern int trade_getitem(struct trdstr *, union empobj_storage *);
|
extern int trade_getitem(struct trdstr *, union empobj_storage *);
|
||||||
|
|
|
@ -93,7 +93,7 @@ set(void)
|
||||||
trade_nameof(&trade, &item), ni.cur);
|
trade_nameof(&trade, &item), ni.cur);
|
||||||
if (!(p = getstarg(player->argp[3], prompt, buf)))
|
if (!(p = getstarg(player->argp[3], prompt, buf)))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if (!trade_check_item_ok(&item))
|
if (!check_obj_ok(&item.gen))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if ((price = atoi(p)) < 0)
|
if ((price = atoi(p)) < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -53,23 +53,7 @@
|
||||||
int
|
int
|
||||||
trade_check_ok(struct trdstr *tp, union empobj_storage *tgp)
|
trade_check_ok(struct trdstr *tp, union empobj_storage *tgp)
|
||||||
{
|
{
|
||||||
return check_trade_ok(tp) && trade_check_item_ok(tgp);
|
return check_trade_ok(tp) && check_obj_ok(&tgp->gen);
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
trade_check_item_ok(union empobj_storage *tgp)
|
|
||||||
{
|
|
||||||
if (tgp->gen.ef_type == EF_LAND)
|
|
||||||
return check_land_ok(&tgp->land);
|
|
||||||
if (tgp->gen.ef_type == EF_PLANE)
|
|
||||||
return check_plane_ok(&tgp->plane);
|
|
||||||
if (tgp->gen.ef_type == EF_SHIP)
|
|
||||||
return check_ship_ok(&tgp->ship);
|
|
||||||
if (tgp->gen.ef_type == EF_NUKE)
|
|
||||||
return check_nuke_ok(&tgp->nuke);
|
|
||||||
CANT_REACH();
|
|
||||||
pr("Trade lot went bad!\n");
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue