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); a_removeall(&u->attribs, &at_otherfaction);
} else { } else {
struct faction * f = findfaction(nr); struct faction * f = findfaction(nr);
/* TODO: Prüfung ob Partei sichtbar */
if(f==NULL) { if(f==NULL) {
cmistake(u, ord, 66, MSG_EVENT); cmistake(u, ord, 66, MSG_EVENT);
} else { } else {
attrib *a; region * lastr = NULL;
a = a_find(u->attribs, &at_otherfaction); /* for all units mu of our faction, check all the units in the region
if (!a) a = a_add(&u->attribs, make_otherfaction(f)); * they are in, if their visible faction is f, it's ok. use lastr to
else a->data.v = f; * 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 { } else {

View File

@ -489,7 +489,7 @@ learn(void)
continue; continue;
} }
} }
if (get_keyword(u->thisorder) == K_STUDY) { if (get_keyword(u->thisorder) == K_STUDY) {
double multi = 1.0; double multi = 1.0;
attrib * a = NULL; attrib * a = NULL;
teaching_info * teach = NULL; teaching_info * teach = NULL;
@ -502,7 +502,7 @@ learn(void)
continue; continue;
} }
if (attacked(u)) { if (attacked(u)) {
cmistake(u, u->thisorder, 52, MSG_PRODUCE); cmistake(u, u->thisorder, 52, MSG_PRODUCE);
continue; continue;
} }
if ((u->race->flags & RCF_NOLEARN) || fval(u, UFL_WERE)) { if ((u->race->flags & RCF_NOLEARN) || fval(u, UFL_WERE)) {
@ -516,7 +516,7 @@ learn(void)
sk = getskill(u->faction->locale); sk = getskill(u->faction->locale);
if (sk < 0) { if (sk < 0) {
cmistake(u, u->thisorder, 77, MSG_EVENT); cmistake(u, u->thisorder, 77, MSG_EVENT);
continue; continue;
} }
if (SkillCap(sk) && SkillCap(sk) <= effskill(u, sk)) { 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 * faction *
visible_faction(const faction *f, const unit * u) 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); attrib *a = a_find(u->attribs, &at_otherfaction);
if (a) { if (a) {
faction *fv = get_otherfaction(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 setstealth_cmd(struct unit * u, struct order * ord);
extern int spy_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); 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 OCEAN_SWIMMER_CHANCE 0.1
#define CANAL_SWIMMER_CHANCE 0.9 #define CANAL_SWIMMER_CHANCE 0.9