mapper: settg breaks when you have no luxuries

This commit is contained in:
Enno Rehling 2005-11-26 01:02:21 +00:00
parent eaf1c0f447
commit 7fcdcf10dd
1 changed files with 2 additions and 3 deletions

View File

@ -1158,15 +1158,14 @@ void
settg(region *r) settg(region *r)
{ {
const luxury_type * ltype; const luxury_type * ltype;
int g=0; int g = get_maxluxuries();
if (tradegood==NULL) tradegood = luxurytypes; if (tradegood==NULL) tradegood = luxurytypes;
for (ltype=luxurytypes; ltype; ltype=ltype->next) { for (ltype=luxurytypes; ltype; ltype=ltype->next) {
if (ltype!=tradegood) r_setdemand(r, ltype, 1 + rand() % 5); if (ltype!=tradegood) r_setdemand(r, ltype, 1 + rand() % 5);
++g;
} }
r_setdemand(r, tradegood, 0); r_setdemand(r, tradegood, 0);
if (rand()%100 < 20) { if (g>0 && chance(0.2)) {
int t = rand() % g; int t = rand() % g;
for (tradegood = luxurytypes;t;--t) { for (tradegood = luxurytypes;t;--t) {