- fixing a bunch of isspace() mistakes.

- horses are big
- assume orders come as utf8
This commit is contained in:
Enno Rehling 2007-11-15 20:38:44 +00:00
parent 6f9c39d3dc
commit f3098d830d
5 changed files with 10 additions and 10 deletions

View file

@ -35,11 +35,11 @@ atoi36(const char * str)
assert(s);
if(!(*s)) return 0;
while(isspace((int)*s)) ++s;
while(isalnum((int)*s)) {
if (isupper((int)*s)) i = i*36 + (*s)-'A' + 10;
else if (islower((int)*s)) i=i*36 + (*s)-'a' + 10;
else if (isdigit((int)*s)) i=i*36 + (*s)-'0';
while(isspace(*(unsigned char*)s)) ++s;
while(isalnum(*(unsigned char*)s)) {
if (isupper(*(unsigned char*)s)) i = i*36 + (*s)-'A' + 10;
else if (islower(*(unsigned char*)s)) i=i*36 + (*s)-'a' + 10;
else if (isdigit(*(unsigned char*)s)) i=i*36 + (*s)-'0';
else
break;
++s;

View file

@ -50,7 +50,7 @@ term_eval(const char **sptr)
int state = 1;
for (;;) {
if (isdigit((int)*c)) {
if (isdigit(*(unsigned char*)c)) {
k = k*10+(*c-'0');
}
else if (*c=='+' || *c=='-' || *c==0 || *c=='*' || *c==')' || *c=='(') {

View file

@ -325,7 +325,7 @@ parse_int(opstack ** stack, const char * in)
ok = true;
}
} while (!ok);
while (isdigit(*in)) {
while (isdigit(*(unsigned char*)in)) {
k = k * 10 + (*in++)-'0';
}
var.i = k*vz;
@ -347,7 +347,7 @@ parse(opstack ** stack, const char* inn, const void * userdata)
return parse_symbol(stack, ++b, userdata);
break;
default:
if (isdigit(*b) || *b=='-' || *b=='+') {
if (isdigit(*(unsigned char*)b) || *b=='-' || *b=='+') {
return parse_int(stack, b);
}
else ++b;

View file

@ -112,7 +112,7 @@
</resource>
<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"/>
<function name="give" value="givehorses"/>
</item>

View file

@ -54,7 +54,6 @@ function process(orders)
equipment_setitem("new_faction", "money", "4200");
file = "" .. get_turn()
-- set_encoding(enc_game)
if read_game(file)~=0 then
print("could not read game")
return -1
@ -65,6 +64,7 @@ function process(orders)
loadscript("eressea/multis.lua")
-- run the turn:
set_encoding("utf8")
if read_orders(orders) ~= 0 then
print("could not read " .. orders)
return -1