From f3098d830dffc8713b051f176a4f8f784c71aa03 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 15 Nov 2007 20:38:44 +0000 Subject: [PATCH] - fixing a bunch of isspace() mistakes. - horses are big - assume orders come as utf8 --- src/common/util/base36.c | 10 +++++----- src/common/util/dice.c | 2 +- src/common/util/translation.c | 4 ++-- src/res/resources.xml | 2 +- src/scripts/eressea.lua | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/common/util/base36.c b/src/common/util/base36.c index c0354ff55..c0eb6025f 100644 --- a/src/common/util/base36.c +++ b/src/common/util/base36.c @@ -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; diff --git a/src/common/util/dice.c b/src/common/util/dice.c index 4050f3aba..36525074b 100644 --- a/src/common/util/dice.c +++ b/src/common/util/dice.c @@ -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=='(') { diff --git a/src/common/util/translation.c b/src/common/util/translation.c index fe5baf80f..68555d055 100644 --- a/src/common/util/translation.c +++ b/src/common/util/translation.c @@ -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; diff --git a/src/res/resources.xml b/src/res/resources.xml index f61147f22..2960b04e0 100644 --- a/src/res/resources.xml +++ b/src/res/resources.xml @@ -112,7 +112,7 @@ - + diff --git a/src/scripts/eressea.lua b/src/scripts/eressea.lua index 83b8c443f..fb1523e88 100644 --- a/src/scripts/eressea.lua +++ b/src/scripts/eressea.lua @@ -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