From ce4a3c14b3d57e26ea94a27e82f2141de708470a Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 14 Nov 2016 22:27:44 +0100 Subject: [PATCH] convert from atoi to atoip. most numbers in commands cannot be negative. --- src/economy.c | 6 +++--- src/laws.c | 4 ++-- src/magic.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/economy.c b/src/economy.c index 36e8de109..bc0970ff2 100644 --- a/src/economy.c +++ b/src/economy.c @@ -1278,7 +1278,7 @@ int make_cmd(unit * u, struct order *ord) s = gettoken(token, sizeof(token)); if (s) { - m = atoi((const char *)s); + m = atoip(s); sprintf(ibuf, "%d", m); if (!strcmp(ibuf, (const char *)s)) { /* a quantity was given */ @@ -1882,7 +1882,7 @@ static bool sell(unit * u, request ** sellorders, struct order *ord) } } else { - n = s ? atoi(s) : 0; + n = s ? atoip(s) : 0; if (n == 0) { cmistake(u, ord, 27, MSG_COMMERCE); return false; @@ -2274,7 +2274,7 @@ static void breed_cmd(unit * u, struct order *ord) (void)init_order(ord); s = gettoken(token, sizeof(token)); - m = s ? atoi((const char *)s) : 0; + m = s ? atoip(s) : 0; if (m != 0) { /* first came a want-paramter */ s = gettoken(token, sizeof(token)); diff --git a/src/laws.c b/src/laws.c index 0838ba6a2..a2db8e4a0 100644 --- a/src/laws.c +++ b/src/laws.c @@ -3693,7 +3693,7 @@ int use_cmd(unit * u, struct order *ord) cmistake(u, ord, 43, MSG_PRODUCE); return err; } - n = atoi((const char *)t); + n = atoip((const char *)t); if (n == 0) { if (isparam(t, u->faction->locale, P_ANY)) { /* BENUTZE ALLES Yanxspirit */ @@ -3841,7 +3841,7 @@ int claim_cmd(unit * u, struct order *ord) t = gettoken(token, sizeof(token)); if (t) { - n = atoi((const char *)t); + n = atoip((const char *)t); if (n == 0) { n = 1; } diff --git a/src/magic.c b/src/magic.c index 1ac2255c1..803f20c78 100644 --- a/src/magic.c +++ b/src/magic.c @@ -376,7 +376,7 @@ static int read_seenspell(attrib * a, void *owner, struct gamedata *data) char token[32]; READ_TOK(store, token, sizeof(token)); - i = atoi(token); + i = atoip(token); if (i != 0) { sp = find_spellbyid((unsigned int)i); }