convert from atoi to atoip.

most numbers in commands cannot be negative.
This commit is contained in:
Enno Rehling 2016-11-14 22:27:44 +01:00
parent b48b80a1e9
commit ce4a3c14b3
3 changed files with 6 additions and 6 deletions

View File

@ -1278,7 +1278,7 @@ int make_cmd(unit * u, struct order *ord)
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
if (s) { if (s) {
m = atoi((const char *)s); m = atoip(s);
sprintf(ibuf, "%d", m); sprintf(ibuf, "%d", m);
if (!strcmp(ibuf, (const char *)s)) { if (!strcmp(ibuf, (const char *)s)) {
/* a quantity was given */ /* a quantity was given */
@ -1882,7 +1882,7 @@ static bool sell(unit * u, request ** sellorders, struct order *ord)
} }
} }
else { else {
n = s ? atoi(s) : 0; n = s ? atoip(s) : 0;
if (n == 0) { if (n == 0) {
cmistake(u, ord, 27, MSG_COMMERCE); cmistake(u, ord, 27, MSG_COMMERCE);
return false; return false;
@ -2274,7 +2274,7 @@ static void breed_cmd(unit * u, struct order *ord)
(void)init_order(ord); (void)init_order(ord);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
m = s ? atoi((const char *)s) : 0; m = s ? atoip(s) : 0;
if (m != 0) { if (m != 0) {
/* first came a want-paramter */ /* first came a want-paramter */
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));

View File

@ -3693,7 +3693,7 @@ int use_cmd(unit * u, struct order *ord)
cmistake(u, ord, 43, MSG_PRODUCE); cmistake(u, ord, 43, MSG_PRODUCE);
return err; return err;
} }
n = atoi((const char *)t); n = atoip((const char *)t);
if (n == 0) { if (n == 0) {
if (isparam(t, u->faction->locale, P_ANY)) { if (isparam(t, u->faction->locale, P_ANY)) {
/* BENUTZE ALLES Yanxspirit */ /* BENUTZE ALLES Yanxspirit */
@ -3841,7 +3841,7 @@ int claim_cmd(unit * u, struct order *ord)
t = gettoken(token, sizeof(token)); t = gettoken(token, sizeof(token));
if (t) { if (t) {
n = atoi((const char *)t); n = atoip((const char *)t);
if (n == 0) { if (n == 0) {
n = 1; n = 1;
} }

View File

@ -376,7 +376,7 @@ static int read_seenspell(attrib * a, void *owner, struct gamedata *data)
char token[32]; char token[32];
READ_TOK(store, token, sizeof(token)); READ_TOK(store, token, sizeof(token));
i = atoi(token); i = atoip(token);
if (i != 0) { if (i != 0) {
sp = find_spellbyid((unsigned int)i); sp = find_spellbyid((unsigned int)i);
} }