more code that fails when there are no luxuries

This commit is contained in:
Enno Rehling 2005-11-26 01:24:28 +00:00
parent 38062fa990
commit ba2e0fef8c
2 changed files with 6 additions and 2 deletions

View File

@ -2067,8 +2067,9 @@ expandselling(region * r, request * sellorders, int limit)
if (++counter[i] > max_products) { if (++counter[i] > max_products) {
int d = r_demand(r, ltype); int d = r_demand(r, ltype);
if (d > 1) if (d > 1) {
r_setdemand(r, ltype, d-1); r_setdemand(r, ltype, d-1);
}
counter[i] = 0; counter[i] = 0;
} }
} }

View File

@ -670,6 +670,9 @@ void
r_setdemand(region * r, const luxury_type * ltype, int value) r_setdemand(region * r, const luxury_type * ltype, int value)
{ {
struct demand * d, ** dp = &r->land->demands; struct demand * d, ** dp = &r->land->demands;
if (ltype==NULL) return;
while (*dp && (*dp)->type != ltype) dp = &(*dp)->next; while (*dp && (*dp)->type != ltype) dp = &(*dp)->next;
d = *dp; d = *dp;
if (!d) { if (!d) {