fix crashbug DEFAULT

This commit is contained in:
Enno Rehling 2005-06-03 16:05:54 +00:00
parent 98f69670ab
commit cffaedc001
1 changed files with 4 additions and 2 deletions

View File

@ -3711,17 +3711,19 @@ defaultorders (void)
order * ord = *ordp;
if (get_keyword(ord)==K_DEFAULT) {
char * cmd;
order * new_order;
init_tokens(ord);
skip_token(); /* skip the keyword */
cmd = strdup(getstrtoken());
new_order = parse_order(cmd, u->faction->locale);
#ifdef LASTORDER
set_order(&u->lastorder, parse_order(cmd, u->faction->locale));
if (new_order) set_order(&u->lastorder, new_order);
#else
if (!neworders) {
neworders = true;
free_orders(&u->old_orders);
}
addlist(&u->old_orders, parse_order(cmd, u->faction->locale));
if (new_order) addlist(&u->old_orders, new_order);
#endif
free(cmd);
*ordp = ord->next;