"Selling luxury goods did not work in some instances."
- fix for accounting bug when material pool off
This commit is contained in:
Enno Rehling 2008-02-03 21:39:22 +00:00
parent bd7d2e1271
commit ee652fa3f3
3 changed files with 8 additions and 1 deletions

View file

@ -2256,7 +2256,7 @@ sell(unit * u, request ** sellorders, struct order * ord)
init_tokens(ord);
skip_token();
s = getstrtoken();
s = getstrtoken();
if (findparam(s, u->faction->locale) == P_ANY) {
unlimited = false;
@ -2334,6 +2334,7 @@ sell(unit * u, request ** sellorders, struct order * ord)
if (o->type.ltype==ltype && o->unit->faction == u->faction) {
int fpool = o->qty - get_pooled(o->unit, itype->rtype, GET_RESERVE, INT_MAX);
available -= max(0, fpool);
assert(available>=0);
}
}

View file

@ -107,6 +107,8 @@ give_item(int want, const item_type * itype, unit * src, unit * dest, struct ord
} else if (itype->give==NULL || itype->give(src, dest, itype, n, ord)!=0) {
int use = use_pooled(src, item2resource(itype), GET_SLACK, n);
if (use<n) use += use_pooled(src, item2resource(itype), GET_RESERVE|GET_POOLED_SLACK, n-use);
assert(n>=use);
n = use;
if (dest) {
i_change(&dest->items, itype, n);
#ifdef RESERVE_GIVE

View file

@ -110,7 +110,11 @@ change_resource(unit * u, const resource_type * rtype, int change)
int
get_reservation(const unit * u, const resource_type * rtype)
{
faction * f = u->faction;
struct reservation * res = u->reservations;
if ((rtype==r_silver && !(f->options & want_sp)) || (rtype!=r_silver && !(f->options & want_mp))) {
return get_resource(u, rtype);
}
if (!rc_stonegolem) init_static();