fix missing curly brace, indentation. hope I got this right.

This commit is contained in:
Enno Rehling 2014-08-13 19:55:10 +02:00
parent 77f126a0bd
commit 444971542c
1 changed files with 42 additions and 41 deletions

View File

@ -1051,43 +1051,44 @@ static bool maintain(building * b, bool first)
} }
} }
} }
for (c = 0; b->type->maintenance[c].number; ++c) { for (c = 0; b->type->maintenance[c].number; ++c) {
const maintenance *m = b->type->maintenance + c; const maintenance *m = b->type->maintenance + c;
int need = m->number; int need = m->number;
if (fval(m, MTF_VARIABLE)) if (fval(m, MTF_VARIABLE))
need = need * b->size; need = need * b->size;
if (u) { if (u) {
/* first ist im ersten versuch true, im zweiten aber false! Das /* first ist im ersten versuch true, im zweiten aber false! Das
* bedeutet, das in der Runde in die Region geschafften Resourcen * bedeutet, das in der Runde in die Region geschafften Resourcen
* nicht genutzt werden können, weil die reserviert sind! */ * nicht genutzt werden können, weil die reserviert sind! */
if (!first) if (!first)
need -= get_pooled(u, m->rtype, GET_ALL, need); need -= get_pooled(u, m->rtype, GET_ALL, need);
else else
need -= get_pooled(u, m->rtype, GET_DEFAULT, need); need -= get_pooled(u, m->rtype, GET_DEFAULT, need);
if (!first && need > 0) { if (!first && need > 0) {
unit *ua; unit *ua;
for (ua = r->units; ua; ua = ua->next) for (ua = r->units; ua; ua = ua->next)
freset(ua->faction, FFL_SELECT); freset(ua->faction, FFL_SELECT);
fset(u->faction, FFL_SELECT); /* hat schon */ fset(u->faction, FFL_SELECT); /* hat schon */
for (ua = r->units; ua; ua = ua->next) { for (ua = r->units; ua; ua = ua->next) {
if (!fval(ua->faction, FFL_SELECT) && (ua->faction == u->faction if (!fval(ua->faction, FFL_SELECT) && (ua->faction == u->faction
|| alliedunit(ua, u->faction, HELP_MONEY))) { || alliedunit(ua, u->faction, HELP_MONEY))) {
need -= get_pooled(ua, m->rtype, GET_ALL, need); need -= get_pooled(ua, m->rtype, GET_ALL, need);
fset(ua->faction, FFL_SELECT); fset(ua->faction, FFL_SELECT);
if (need <= 0) if (need <= 0)
break; break;
} }
}
}
} }
} if (need > 0) {
if (need > 0) { if (!fval(m, MTF_VITAL))
if (!fval(m, MTF_VITAL)) work = false;
work = false; else {
else { paid = false;
paid = false; break;
break; }
} }
}
} }
if (fval(b, BLD_DONTPAY)) { if (fval(b, BLD_DONTPAY)) {
return false; return false;
@ -2299,7 +2300,7 @@ static void expandselling(region * r, request * sellorders, int limit)
} }
counter[i] = 0; counter[i] = 0;
} }
} }
if (use > 0) { if (use > 0) {
#ifdef NDEBUG #ifdef NDEBUG
use_pooled(oa[j].unit, ltype->itype->rtype, GET_DEFAULT, use); use_pooled(oa[j].unit, ltype->itype->rtype, GET_DEFAULT, use);
@ -2309,7 +2310,7 @@ static void expandselling(region * r, request * sellorders, int limit)
/* assert(i==use); */ /* assert(i==use); */
#endif #endif
} }
} }
free(oa); free(oa);
/* Steuern. Hier werden die Steuern dem Besitzer der größten Burg gegeben. */ /* Steuern. Hier werden die Steuern dem Besitzer der größten Burg gegeben. */
@ -2345,7 +2346,7 @@ static void expandselling(region * r, request * sellorders, int limit)
a_remove(&u->attribs, a); a_remove(&u->attribs, a);
add_income(u, IC_TRADE, u->n, u->n); add_income(u, IC_TRADE, u->n, u->n);
} }
} }
static bool sell(unit * u, request ** sellorders, struct order *ord) static bool sell(unit * u, request ** sellorders, struct order *ord)
{ {
@ -2524,10 +2525,10 @@ static void expandstealing(region * r, request * stealorders)
for (u2 = r->units; u2; u2 = u2->next) { for (u2 = r->units; u2; u2 = u2->next) {
if (u2->faction == u->faction) { if (u2->faction == u->faction) {
uct += maintenance_cost(u2); uct += maintenance_cost(u2);
} }
} }
n -= uct * 2; n -= uct * 2;
} }
#endif #endif
if (n > 10 && rplane(r) && (rplane(r)->flags & PFL_NOALLIANCES)) { if (n > 10 && rplane(r) && (rplane(r)->flags & PFL_NOALLIANCES)) {
/* In Questen nur reduziertes Klauen */ /* In Questen nur reduziertes Klauen */
@ -2543,7 +2544,7 @@ static void expandstealing(region * r, request * stealorders)
} }
add_income(oa[i].unit, IC_STEAL, oa[i].unit->wants, oa[i].unit->n); add_income(oa[i].unit, IC_STEAL, oa[i].unit->wants, oa[i].unit->n);
fset(oa[i].unit, UFL_LONGACTION | UFL_NOTMOVING); fset(oa[i].unit, UFL_LONGACTION | UFL_NOTMOVING);
} }
free(oa); free(oa);
} }