use_item can return positive values now

This commit is contained in:
Enno Rehling 2015-05-24 07:43:11 +02:00
parent e99db198eb
commit 6f50027088
1 changed files with 4 additions and 6 deletions

View File

@ -3501,8 +3501,7 @@ void update_long_order(unit * u)
} }
} }
static int static int use_item(unit * u, const item_type * itype, int amount, struct order *ord)
use_item(unit * u, const item_type * itype, int amount, struct order *ord)
{ {
int i; int i;
int target = read_unitid(u->faction, u->region); int target = read_unitid(u->faction, u->region);
@ -3795,10 +3794,6 @@ int use_cmd(unit * u, struct order *ord)
if (itype != NULL) { if (itype != NULL) {
err = use_item(u, itype, n, ord); err = use_item(u, itype, n, ord);
assert(err <= 0 || !"use_item should not return positive values.");
if (err > 0) {
log_error("use_item returned a value>0 for %s\n", resourcename(itype->rtype, 0));
}
} }
switch (err) { switch (err) {
case ENOITEM: case ENOITEM:
@ -3810,6 +3805,9 @@ int use_cmd(unit * u, struct order *ord)
case ENOSKILL: case ENOSKILL:
cmistake(u, ord, 50, MSG_PRODUCE); cmistake(u, ord, 50, MSG_PRODUCE);
break; break;
default:
// no error
break;
} }
return err; return err;
} }