forked from github/server
- fixing a bunch of isspace() mistakes.
- horses are big - assume orders come as utf8
This commit is contained in:
parent
6f9c39d3dc
commit
f3098d830d
5 changed files with 10 additions and 10 deletions
|
@ -35,11 +35,11 @@ atoi36(const char * str)
|
||||||
assert(s);
|
assert(s);
|
||||||
if(!(*s)) return 0;
|
if(!(*s)) return 0;
|
||||||
|
|
||||||
while(isspace((int)*s)) ++s;
|
while(isspace(*(unsigned char*)s)) ++s;
|
||||||
while(isalnum((int)*s)) {
|
while(isalnum(*(unsigned char*)s)) {
|
||||||
if (isupper((int)*s)) i = i*36 + (*s)-'A' + 10;
|
if (isupper(*(unsigned char*)s)) i = i*36 + (*s)-'A' + 10;
|
||||||
else if (islower((int)*s)) i=i*36 + (*s)-'a' + 10;
|
else if (islower(*(unsigned char*)s)) i=i*36 + (*s)-'a' + 10;
|
||||||
else if (isdigit((int)*s)) i=i*36 + (*s)-'0';
|
else if (isdigit(*(unsigned char*)s)) i=i*36 + (*s)-'0';
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
++s;
|
++s;
|
||||||
|
|
|
@ -50,7 +50,7 @@ term_eval(const char **sptr)
|
||||||
int state = 1;
|
int state = 1;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (isdigit((int)*c)) {
|
if (isdigit(*(unsigned char*)c)) {
|
||||||
k = k*10+(*c-'0');
|
k = k*10+(*c-'0');
|
||||||
}
|
}
|
||||||
else if (*c=='+' || *c=='-' || *c==0 || *c=='*' || *c==')' || *c=='(') {
|
else if (*c=='+' || *c=='-' || *c==0 || *c=='*' || *c==')' || *c=='(') {
|
||||||
|
|
|
@ -325,7 +325,7 @@ parse_int(opstack ** stack, const char * in)
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
} while (!ok);
|
} while (!ok);
|
||||||
while (isdigit(*in)) {
|
while (isdigit(*(unsigned char*)in)) {
|
||||||
k = k * 10 + (*in++)-'0';
|
k = k * 10 + (*in++)-'0';
|
||||||
}
|
}
|
||||||
var.i = k*vz;
|
var.i = k*vz;
|
||||||
|
@ -347,7 +347,7 @@ parse(opstack ** stack, const char* inn, const void * userdata)
|
||||||
return parse_symbol(stack, ++b, userdata);
|
return parse_symbol(stack, ++b, userdata);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (isdigit(*b) || *b=='-' || *b=='+') {
|
if (isdigit(*(unsigned char*)b) || *b=='-' || *b=='+') {
|
||||||
return parse_int(stack, b);
|
return parse_int(stack, b);
|
||||||
}
|
}
|
||||||
else ++b;
|
else ++b;
|
||||||
|
|
|
@ -112,7 +112,7 @@
|
||||||
</resource>
|
</resource>
|
||||||
|
|
||||||
<resource name="horse" limited="yes">
|
<resource name="horse" limited="yes">
|
||||||
<item weight="5000" score="10" capacity="7000" animal="yes">
|
<item big="yes" weight="5000" score="10" capacity="7000" animal="yes">
|
||||||
<construction skill="training" minskill="1" reqsize="1"/>
|
<construction skill="training" minskill="1" reqsize="1"/>
|
||||||
<function name="give" value="givehorses"/>
|
<function name="give" value="givehorses"/>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -54,7 +54,6 @@ function process(orders)
|
||||||
equipment_setitem("new_faction", "money", "4200");
|
equipment_setitem("new_faction", "money", "4200");
|
||||||
|
|
||||||
file = "" .. get_turn()
|
file = "" .. get_turn()
|
||||||
-- set_encoding(enc_game)
|
|
||||||
if read_game(file)~=0 then
|
if read_game(file)~=0 then
|
||||||
print("could not read game")
|
print("could not read game")
|
||||||
return -1
|
return -1
|
||||||
|
@ -65,6 +64,7 @@ function process(orders)
|
||||||
loadscript("eressea/multis.lua")
|
loadscript("eressea/multis.lua")
|
||||||
|
|
||||||
-- run the turn:
|
-- run the turn:
|
||||||
|
set_encoding("utf8")
|
||||||
if read_orders(orders) ~= 0 then
|
if read_orders(orders) ~= 0 then
|
||||||
print("could not read " .. orders)
|
print("could not read " .. orders)
|
||||||
return -1
|
return -1
|
||||||
|
|
Loading…
Reference in a new issue