count_unit(u) bestimmt, welche einheiten zum partei-limit gezaehlt werden. Das sollten alle sein, sind's aber vorlaeufig nicht.

ausserdem ein bischen code-cleanup.
This commit is contained in:
Enno Rehling 2006-07-29 14:04:49 +00:00
parent 80e445fe96
commit 7b76da7c39
7 changed files with 21 additions and 25 deletions

View File

@ -3411,13 +3411,13 @@ new_units (void)
int g, alias;
order ** newordersp;
if (checkunitnumber(u->faction, 1) == false) {
if (global.unitsperalliance == false) {
ADDMSG(&u->faction->msgs, msg_message("too_many_units_in_faction",
if (!checkunitnumber(u->faction, 1)) {
if (global.unitsperalliance) {
ADDMSG(&u->faction->msgs, msg_message("too_many_units_in_alliance",
"command unit region allowed",
makeord, u, r, maxunits(u->faction)));
} else {
ADDMSG(&u->faction->msgs, msg_message("too_many_units_in_alliance",
ADDMSG(&u->faction->msgs, msg_message("too_many_units_in_faction",
"command unit region allowed",
makeord, u, r, maxunits(u->faction)));
}

View File

@ -1131,7 +1131,7 @@ spawn_undead(void)
for (r = regions; r; r = r->next) {
int unburied = deathcount(r);
if(is_cursed(r->attribs, C_HOLYGROUND, 0)) continue;
if (is_cursed(r->attribs, C_HOLYGROUND, 0)) continue;
/* Chance 0.1% * chaosfactor */
if (r->land && unburied > r->land->peasants / 20 && rng_int() % 10000 < (100 + 100 * chaosfactor(r))) {

View File

@ -126,7 +126,7 @@ addfaction(const char *email, const char * password,
f->locale = loc;
f->subscription = subscription;
f->options = Pow(O_REPORT) | Pow(O_ZUGVORLAGE) | Pow(O_SILBERPOOL) | Pow(O_COMPUTER) | Pow(O_COMPRESS) | Pow(O_ADRESSEN) | Pow(O_STATISTICS);
f->options = want(O_REPORT) | want(O_ZUGVORLAGE) | want(O_SILBERPOOL) | want(O_COMPUTER) | want(O_COMPRESS) | want(O_ADRESSEN) | want(O_STATISTICS);
f->no = unused_faction_id();
addlist(&factions, f);

View File

@ -718,7 +718,7 @@ spskill(char * buffer, size_t size, const struct locale * lang, const struct uni
size -= rsize;
bufp += rsize;
if(u->faction->options & Pow(O_SHOWSKCHANGE)) {
if (u->faction->options & want(O_SHOWSKCHANGE)) {
skill *skill = get_skill(u, sk);
int oldeff = 0;
int diff;

View File

@ -1002,9 +1002,9 @@ readunit(FILE * F)
u_setfaction(u, findfaction(MONSTER_FACTION));
set_number(u, 0);
}
if (playerrace(u->race)) {
u->faction->no_units++;
}
if (count_unit(u)) u->faction->no_units++;
set_number(u, number);
u->building = findbuilding(rid(F));
u->ship = findship(rid(F));
@ -1561,9 +1561,9 @@ readfaction(FILE * F)
i = f->options = ri(F);
if ((i & ((1<<O_REPORT)|(1<<O_COMPUTER)))==0 && f->no!=MONSTER_FACTION) {
if ((i & (want(O_REPORT)|want(O_COMPUTER)))==0 && f->no!=MONSTER_FACTION) {
/* Kein Report eingestellt, Fehler */
f->options = f->options | Pow(O_REPORT) | Pow(O_ZUGVORLAGE);
f->options = f->options | want(O_REPORT) | want(O_ZUGVORLAGE);
}
if (global.data_version < TYPES_VERSION) {
@ -1650,7 +1650,7 @@ writefaction(FILE * F, const faction * f)
wi(F, ur->y);
}
wnl(F);
wi(F, f->options & ~Pow(O_DEBUG));
wi(F, f->options & ~want(O_DEBUG));
wnl(F);
for (sf = f->allies; sf; sf = sf->next) {

View File

@ -904,9 +904,7 @@ u_setfaction(unit * u, faction * f)
if (u->faction) {
unit ** iunit;
set_number(u, 0);
if (playerrace(u->race)) {
--u->faction->no_units;
}
join_group(u, NULL);
free_orders(&u->orders);
set_order(&u->thisorder, NULL);
@ -932,10 +930,8 @@ u_setfaction(unit * u, faction * f)
if (u->region) update_interval(f, u->region);
if (cnt && f) {
set_number(u, cnt);
if (playerrace(u->race)) {
++f->no_units;
}
}
}
/* vorsicht Sprüche können u->number == RS_FARVISION haben! */

View File

@ -1520,7 +1520,7 @@ makemonsters(void)
f->locale=default_locale;
factions=f;
f->options = Pow(O_REPORT);
f->options = want(O_REPORT);
f->no=MONSTER_FACTION;
f->subscription = 0;
f->name=strdup("Monster");