From a451d61f2309b1acbf1823484e80515665a0c5e2 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 28 Aug 2016 16:48:06 +0100 Subject: [PATCH] simplify destroy_cmd parsing. --- src/kernel/build.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/kernel/build.c b/src/kernel/build.c index 871ccfc89..5d8f955c5 100644 --- a/src/kernel/build.c +++ b/src/kernel/build.c @@ -165,19 +165,17 @@ int destroy_cmd(unit * u, struct order *ord) init_order(ord); s = gettoken(token, sizeof(token)); - if (findparam(s, u->faction->locale) == P_ROAD) { - destroy_road(u, INT_MAX, ord); - return 0; - } - if (s && *s) { n = atoi((const char *)s); if (n <= 0) { 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); return 0; }