TARNE PARTEI NUMMER <NR> auch wenn man die Partei nicht sieht
This commit is contained in:
Enno Rehling 2004-12-03 19:08:00 +00:00
parent a436127625
commit 3691f8c9ca
5 changed files with 1155 additions and 1226 deletions

File diff suppressed because it is too large Load Diff

View File

@ -225,14 +225,34 @@ setstealth_cmd(unit * u, struct order * ord)
a_removeall(&u->attribs, &at_otherfaction);
} else {
struct faction * f = findfaction(nr);
/* TODO: Prüfung ob Partei sichtbar */
if(f==NULL) {
cmistake(u, ord, 66, MSG_EVENT);
} else {
attrib *a;
a = a_find(u->attribs, &at_otherfaction);
if (!a) a = a_add(&u->attribs, make_otherfaction(f));
else a->data.v = f;
region * lastr = NULL;
/* for all units mu of our faction, check all the units in the region
* they are in, if their visible faction is f, it's ok. use lastr to
* avoid testing the same region twice in a row. */
unit * mu = u->faction->units;
while (mu!=NULL) {
unit * ru = mu->region->units;
if (mu->region==lastr) continue;
while (ru!=NULL) {
attrib *a = a_find(ru->attribs, &at_otherfaction);
if (a) {
faction *fv = get_otherfaction(a);
if (fv==f) break;
}
ru = ru->next;
}
if (ru!=NULL) break;
lastr = mu->region;
mu = mu->nextF;
}
if (mu!=NULL) {
attrib * a = a_find(u->attribs, &at_otherfaction);
if (!a) a = a_add(&u->attribs, make_otherfaction(f));
else a->data.v = f;
}
}
}
} else {

View File

@ -489,7 +489,7 @@ learn(void)
continue;
}
}
if (get_keyword(u->thisorder) == K_STUDY) {
if (get_keyword(u->thisorder) == K_STUDY) {
double multi = 1.0;
attrib * a = NULL;
teaching_info * teach = NULL;
@ -502,7 +502,7 @@ learn(void)
continue;
}
if (attacked(u)) {
cmistake(u, u->thisorder, 52, MSG_PRODUCE);
cmistake(u, u->thisorder, 52, MSG_PRODUCE);
continue;
}
if ((u->race->flags & RCF_NOLEARN) || fval(u, UFL_WERE)) {
@ -516,7 +516,7 @@ learn(void)
sk = getskill(u->faction->locale);
if (sk < 0) {
cmistake(u, u->thisorder, 77, MSG_EVENT);
cmistake(u, u->thisorder, 77, MSG_EVENT);
continue;
}
if (SkillCap(sk) && SkillCap(sk) <= effskill(u, sk)) {

View File

@ -852,7 +852,7 @@ ucansee(const struct faction *f, const struct unit *u, const struct unit *x)
faction *
visible_faction(const faction *f, const unit * u)
{
if(!alliedunit(u, f, HELP_FSTEALTH)) {
if (!alliedunit(u, f, HELP_FSTEALTH)) {
attrib *a = a_find(u->attribs, &at_otherfaction);
if (a) {
faction *fv = get_otherfaction(a);

View File

@ -33,7 +33,7 @@ extern int setwere_cmd(struct unit * u, struct order * ord);
extern int setstealth_cmd(struct unit * u, struct order * ord);
extern int spy_cmd(struct unit * u, struct order * ord);
extern int sabotage_cmd(struct unit * u, struct order * ord);
void spy_message(int spy, struct unit *u, struct unit *target);
extern void spy_message(int spy, struct unit *u, struct unit *target);
#define OCEAN_SWIMMER_CHANCE 0.1
#define CANAL_SWIMMER_CHANCE 0.9