forked from github/server
Lange Befehle erscheinen wieder im NR.
This commit is contained in:
parent
0f9353eaaf
commit
9515363c56
|
@ -3489,15 +3489,17 @@ setdefaults (void)
|
||||||
for (u = r->units; u; u = u->next) {
|
for (u = r->units; u; u = u->next) {
|
||||||
order *ord;
|
order *ord;
|
||||||
boolean trade = false;
|
boolean trade = false;
|
||||||
|
boolean hunger = LongHunger(u);
|
||||||
|
|
||||||
if (LongHunger(u)) {
|
if (hunger) {
|
||||||
/* Hungernde Einheiten führen NUR den default-Befehl aus */
|
/* Hungernde Einheiten führen NUR den default-Befehl aus */
|
||||||
set_order(&u->thisorder, default_order(u->faction->locale));
|
set_order(&u->thisorder, default_order(u->faction->locale));
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
#ifdef LASTORDER
|
#ifdef LASTORDER
|
||||||
|
else {
|
||||||
/* by default the default long order becomes the new long order. */
|
/* by default the default long order becomes the new long order. */
|
||||||
u->thisorder = copy_order(u->lastorder);
|
u->thisorder = copy_order(u->lastorder);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
/* check all orders for a potential new long order this round: */
|
/* check all orders for a potential new long order this round: */
|
||||||
for (ord = u->orders; ord; ord = ord->next) {
|
for (ord = u->orders; ord; ord = ord->next) {
|
||||||
|
@ -3505,8 +3507,11 @@ setdefaults (void)
|
||||||
if (u->old_orders && is_repeated(ord)) {
|
if (u->old_orders && is_repeated(ord)) {
|
||||||
/* this new order will replace the old defaults */
|
/* this new order will replace the old defaults */
|
||||||
free_orders(&u->old_orders);
|
free_orders(&u->old_orders);
|
||||||
|
if (hunger) break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (hunger) continue;
|
||||||
|
|
||||||
if (is_exclusive(ord)) {
|
if (is_exclusive(ord)) {
|
||||||
/* Über dieser Zeile nur Befehle, die auch eine idle Faction machen darf */
|
/* Über dieser Zeile nur Befehle, die auch eine idle Faction machen darf */
|
||||||
if (idle(u->faction)) {
|
if (idle(u->faction)) {
|
||||||
|
@ -3546,6 +3551,8 @@ setdefaults (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hunger) continue;
|
||||||
|
|
||||||
/* Wenn die Einheit handelt, muß der Default-Befehl gelöscht
|
/* Wenn die Einheit handelt, muß der Default-Befehl gelöscht
|
||||||
* werden. */
|
* werden. */
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,22 @@ report_item(const unit * owner, const item * i, const faction * viewer, const ch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
size_t
|
||||||
|
buforder(char * bufp, size_t size, const order * ord)
|
||||||
|
{
|
||||||
|
char * cmd = getcommand(ord);
|
||||||
|
size_t len = 0;
|
||||||
|
len += strlcpy(bufp+len, ", \"", size);
|
||||||
|
len += strlcpy(bufp+len, cmd, size-len);
|
||||||
|
if (len>=2) {
|
||||||
|
strcpy(bufp+len, "\"");
|
||||||
|
++len;
|
||||||
|
}
|
||||||
|
free(cmd);
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
bufunit(const faction * f, const unit * u, int indent, int mode)
|
bufunit(const faction * f, const unit * u, int indent, int mode)
|
||||||
{
|
{
|
||||||
|
@ -408,11 +424,27 @@ bufunit(const faction * f, const unit * u, int indent, int mode)
|
||||||
}
|
}
|
||||||
#ifdef LASTORDER
|
#ifdef LASTORDER
|
||||||
if (!isbattle && u->lastorder) {
|
if (!isbattle && u->lastorder) {
|
||||||
char * cmd = getcommand(u->lastorder);
|
bufp += buforder(bufp, sizeof(buf)-(bufp-buf), u->lastorder);
|
||||||
bufp += strlcpy(bufp, ", \"", sizeof(buf)-(bufp-buf));
|
}
|
||||||
bufp += strlcpy(bufp, cmd, sizeof(buf)-(bufp-buf));
|
#else
|
||||||
strcpy(bufp++, "\"");
|
if (!isbattle) {
|
||||||
free(cmd);
|
boolean printed = 0;
|
||||||
|
int i;
|
||||||
|
for (i=0;i!=2;++i) {
|
||||||
|
order * ord = (i==0)?u->old_orders:u->orders;
|
||||||
|
while (ord) {
|
||||||
|
if (is_repeated(ord)) {
|
||||||
|
if (printed==0) {
|
||||||
|
bufp += buforder(bufp, sizeof(buf)-(bufp-buf), ord);
|
||||||
|
} else if (printed==1) {
|
||||||
|
bufp += strlcpy(bufp, ", ...", sizeof(buf)-(bufp-buf));
|
||||||
|
}
|
||||||
|
++printed;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ord=ord->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue