forked from github/server
reorder fleeing units to the end of the region.
This commit is contained in:
parent
b83ae9fb58
commit
e4c2bb2d30
|
@ -2645,6 +2645,31 @@ battle_effects(battle * b, int dead_players)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
reorder_fleeing(region * r)
|
||||
{
|
||||
unit **usrc = &r->units;
|
||||
unit **udst = &r->units;
|
||||
unit *ufirst = NULL;
|
||||
unit *u;
|
||||
|
||||
for (;*udst;udst=&u->next) {
|
||||
u = *udst;
|
||||
}
|
||||
|
||||
for (u=*usrc;u!=ufirst;u=*usrc) {
|
||||
if (u->next && fval(u, UFL_FLEEING)) {
|
||||
*usrc = u->next;
|
||||
*udst = u;
|
||||
udst = &u->next;
|
||||
if (!ufirst) ufirst = u;
|
||||
} else {
|
||||
usrc = &u->next;
|
||||
}
|
||||
}
|
||||
*udst = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
aftermath(battle * b)
|
||||
{
|
||||
|
@ -2819,6 +2844,7 @@ aftermath(battle * b)
|
|||
}
|
||||
fset(du, UFL_LONGACTION|UFL_NOTMOVING);
|
||||
#endif /* SIMPLE_ESCAPE */
|
||||
fset(du, UFL_FLEEING);
|
||||
} else {
|
||||
/* nur teilweise geflohene Einheiten mergen sich wieder */
|
||||
df->alive += df->run.number;
|
||||
|
@ -2957,6 +2983,8 @@ aftermath(battle * b)
|
|||
free(trollsave);
|
||||
#endif
|
||||
|
||||
reorder_fleeing(r);
|
||||
|
||||
if (bdebug) {
|
||||
fprintf(bdebug, "The battle lasted %d turns, %s and %s.\n",
|
||||
b->turn,
|
||||
|
|
|
@ -50,6 +50,7 @@ struct item;
|
|||
|
||||
/* warning: von 512/1024 gewechslet, wegen konflikt mit NEW_FOLLOW */
|
||||
#define UFL_LOCKED (1<<16) /* Einheit kann keine Personen aufnehmen oder weggeben, nicht rekrutieren. */
|
||||
#define UFL_FLEEING (1<<17) /* unit was in a battle, fleeing. */
|
||||
#define UFL_STORM (1<<19) /* Kapitän war in einem Sturm */
|
||||
#define UFL_FOLLOWING (1<<20)
|
||||
#define UFL_FOLLOWED (1<<21)
|
||||
|
|
Loading…
Reference in New Issue