forked from github/server
Neue Defaults entfernen alte lange Befehle, nicht kurze.
This commit is contained in:
parent
1b07d7513b
commit
c0fcf15184
|
@ -3767,16 +3767,31 @@ monthly_healing(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
remove_exclusive(order ** ordp)
|
||||||
|
{
|
||||||
|
while (*ordp) {
|
||||||
|
order * ord = *ordp;
|
||||||
|
if (is_exclusive(ord)) {
|
||||||
|
*ordp = ord->next;
|
||||||
|
ord->next = NULL;
|
||||||
|
free_order(ord);
|
||||||
|
} else {
|
||||||
|
ordp = &ord->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
defaultorders (void)
|
defaultorders (void)
|
||||||
{
|
{
|
||||||
region *r;
|
region *r;
|
||||||
for (r=regions;r;r=r->next) {
|
for (r=regions;r;r=r->next) {
|
||||||
|
unit *u;
|
||||||
|
for (u=r->units;u;u=u->next) {
|
||||||
#ifndef LASTORDER
|
#ifndef LASTORDER
|
||||||
boolean neworders = false;
|
boolean neworders = false;
|
||||||
#endif
|
#endif
|
||||||
unit *u;
|
|
||||||
for (u=r->units;u;u=u->next) {
|
|
||||||
order ** ordp = &u->orders;
|
order ** ordp = &u->orders;
|
||||||
while (*ordp!=NULL) {
|
while (*ordp!=NULL) {
|
||||||
order * ord = *ordp;
|
order * ord = *ordp;
|
||||||
|
@ -3791,8 +3806,10 @@ defaultorders (void)
|
||||||
if (new_order) set_order(&u->lastorder, new_order);
|
if (new_order) set_order(&u->lastorder, new_order);
|
||||||
#else
|
#else
|
||||||
if (!neworders) {
|
if (!neworders) {
|
||||||
|
/* lange Befehle aus orders und old_orders löschen zu gunsten des neuen */
|
||||||
|
remove_exclusive(&u->orders);
|
||||||
|
remove_exclusive(&u->old_orders);
|
||||||
neworders = true;
|
neworders = true;
|
||||||
free_orders(&u->old_orders);
|
|
||||||
}
|
}
|
||||||
if (new_order) addlist(&u->old_orders, new_order);
|
if (new_order) addlist(&u->old_orders, new_order);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue