forked from github/server
"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:
parent
95824f5404
commit
56a716622a
3 changed files with 20 additions and 18 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue