"In der Taktikerrunde greifen alle an"
- fixed finding allies

Also:
- fixed an error reading the order file in text mode.
This commit is contained in:
Enno Rehling 2008-01-07 19:26:36 +00:00
parent 95824f5404
commit 56a716622a
3 changed files with 20 additions and 18 deletions

View file

@ -3829,22 +3829,27 @@ battle_attacks(battle * b)
for (s=b->sides;s!=b->sides+b->nsides;++s) {
fighter *fig;
/* Taktikrunde: */
if (b->turn == 0) {
side *stac;
for (stac=b->sides;stac!=b->sides+b->nsides;++stac) {
if (b->max_tactics > 0 && stac->leader.value == b->max_tactics && helping(stac, s)) {
break;
}
}
if (stac==b->sides+b->nsides) {
/* could not find a side that is helping us and won the tactics round */
continue;
}
}
for (fig=s->fighters;fig;fig=fig->next) {
/* ist in dieser Einheit noch jemand handlungsfähig? */
if (fig->fighting <= 0) continue;
/* Taktikrunde: */
if (b->turn == 0) {
side *stac;
for (stac=b->sides;stac!=b->sides+b->nsides;++stac) {
if (b->max_tactics > 0 && stac->leader.value == b->max_tactics && helping(stac, fig->side)) {
break;
}
}
if (stac==NULL) continue;
}
/* Handle the unit's attack on someone */
do_attack(fig);
}

View file

@ -435,11 +435,6 @@ unitorders(FILE * F, int enc, struct faction * f)
if (u && u->faction == f) {
order ** ordp;
if (quiet==0) {
printf(",_%4s_", itoa36(u->no));
fflush(stdout);
}
if (!fval(u, UFL_ORDERS)) {
/* alle wiederholbaren, langen befehle werden gesichert: */
fset(u, UFL_ORDERS);
@ -555,7 +550,7 @@ readorders(const char *filename)
int nfactions=0;
struct faction *f = NULL;
if (filename) F = cfopen(filename, "rt");
if (filename) F = cfopen(filename, "rb");
if (F==NULL) return 0;
puts(" - lese Befehlsdatei...\n");

View file

@ -181,7 +181,9 @@ getbuf_utf8(FILE * F)
do {
const char * bp = fgets(lbuf, MAXLINE, F);
size_t white;
if (bp==NULL) return NULL;
if (bp==NULL) {
return NULL;
}
eatwhite(bp, &white); /* decoding errors will get caught later on, don't have to check */
bp += white;