simplify destroy_cmd parsing.

This commit is contained in:
Enno Rehling 2016-08-28 16:48:06 +01:00
parent 808d51429e
commit a451d61f23
1 changed files with 4 additions and 6 deletions

View File

@ -165,19 +165,17 @@ int destroy_cmd(unit * u, struct order *ord)
init_order(ord); init_order(ord);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
if (findparam(s, u->faction->locale) == P_ROAD) {
destroy_road(u, INT_MAX, ord);
return 0;
}
if (s && *s) { if (s && *s) {
n = atoi((const char *)s); n = atoi((const char *)s);
if (n <= 0) { if (n <= 0) {
n = INT_MAX; n = INT_MAX;
} }
else {
s = gettoken(token, sizeof(token));
}
} }
if (getparam(u->faction->locale) == P_ROAD) { if (isparam(s, u->faction->locale, P_ROAD)) {
destroy_road(u, n, ord); destroy_road(u, n, ord);
return 0; return 0;
} }