fix floating point exception.

This commit is contained in:
Enno Rehling 2014-12-26 01:41:19 +01:00
parent 108a909131
commit f1008fa231
1 changed files with 6 additions and 3 deletions

View File

@ -139,17 +139,20 @@ int fix_demand(region * rd)
const luxury_type *ltypes[MAXLUXURIES];
const luxury_type *sale = NULL;
int maxlux = 0;
static int maxluxuries = 0;
static int maxluxuries = -1;
// TODO: this entire function is impossible to understand
recurse_regions(rd, &rlist, f_nolux);
if (maxluxuries == 0) {
if (maxluxuries < 0) {
int i = 0;
for (sale = luxurytypes; sale; sale = sale->next) {
mlux[i] = 0;
ltypes[i++] = sale;
}
maxluxuries = i;
}
if (maxluxuries == 0) {
return -1;
}
else {
int i;
for (i = 0; i != maxluxuries; ++i) {