Unicode WIP:

- links on Linux (Jamfile changes)
- bugfix latin1/newfactions file
This commit is contained in:
Enno Rehling 2007-08-19 20:40:42 +00:00
parent 8fbb513b63
commit b132ffdd2b
9 changed files with 37 additions and 18 deletions

View File

@ -18,10 +18,11 @@ SOURCES =
luck.c
monster.c
randenc.c
# report.c
report.c
spells.c
spy.c
study.c
summary.c
xmlreport.c
;

View File

@ -908,12 +908,12 @@ describe(FILE * F, const region * r, int partial, faction * f)
/* Spezielle Richtungen */
for (a = a_find(r->attribs, &at_direction);a && a->type==&at_direction;a=a->next) {
spec_direction * d = (spec_direction *)(a->data.v);
strcpy(bufp++, " ");
bufp += strxcpy(bufp, d->desc);
bufp += strxcpy(bufp, " (\"");
bufp += strxcpy(bufp, d->keyword);
bufp += strxcpy(bufp, "\")");
strcpy(bufp++, ".");
bufp += strlcpy(bufp, " ", sizeof(buf) - (bufp-buf));
bufp += strlcpy(bufp, LOC(f->locale, d->desc), sizeof(buf) - (bufp-buf));
bufp += strlcpy(bufp, " (\"", sizeof(buf) - (bufp-buf));
bufp += strlcpy(bufp, LOC(f->locale, d->keyword), sizeof(buf) - (bufp-buf));
bufp += strlcpy(bufp, "\")", sizeof(buf) - (bufp-buf));
bufp += strlcpy(bufp, ".", sizeof(buf) - (bufp-buf));
dh = 1;
}
}

View File

@ -248,21 +248,21 @@ register_special_direction(const char * name)
static int
a_readdirection(attrib *a, FILE *f)
{
char lbuf[16];
spec_direction *d = (spec_direction *)(a->data.v);
fscanf(f, "%hd %hd %d", &d->x, &d->y, &d->duration);
fscanf(f, "%15s ", lbuf);
d->desc = strdup(lbuf);
fscanf(f, "%15s ", lbuf);
if (global.data_version<UNICODE_VERSION) {
char lbuf[16];
fscanf(f, "%*s ");
fscanf(f, "%s ", lbuf);
dir_lookup * dl = dir_name_lookup;
cstring_i(d->desc);
cstring_i(lbuf);
for (;dl;dl=dl->next) {
if (strcmp(lbuf, dl->oldname)==0) {
d->keyword=strdup(dl->name);
sprintf(lbuf, "%s_desc", d->keyword);
d->desc=strdup(dl->name);
break;
}
}
@ -272,6 +272,10 @@ a_readdirection(attrib *a, FILE *f)
}
}
else {
char lbuf[16];
fscanf(f, "%15s ", lbuf);
d->desc = strdup(lbuf);
fscanf(f, "%15s ", lbuf);
d->keyword = strdup(lbuf);
}
d->active = true;

View File

@ -169,7 +169,7 @@ extern struct region * find_special_direction(const struct region *r, const char
extern void register_special_direction(const char * name);
extern struct spec_direction * special_direction(const region * from, const region * to);
extern struct attrib *create_special_direction(struct region *r, struct region *rt,
int duration, const char *desc,
int duration, const char *desc,
const char *keyword);
int deathcount(const struct region * r);

View File

@ -33,6 +33,8 @@
#include <util/rng.h>
#include <util/sql.h>
#include <libxml/encoding.h>
/* libc includes */
#include <limits.h>
#include <memory.h>
@ -239,6 +241,18 @@ read_newfactions(const char * filename)
/* if the script didn't supply the race as a token, then it gives us a
* race in the default locale (which means that itis a UTF8 string) */
nf->race = findrace(race, default_locale);
if (nf->race==NULL) {
char buffer[32];
int outbytes = sizeof(buffer);
int inbytes = strlen(race);
isolat1ToUTF8((unsigned char *)buffer, &outbytes, (const unsigned char *)race, &inbytes);
nf->race = findrace(buffer, default_locale);
if (nf->race==NULL) {
log_error(("new faction has unknown race '%s'.\n", race));
free(nf);
continue;
}
}
}
nf->lang = find_locale(lang);
nf->bonus = bonus;

View File

@ -11,6 +11,7 @@ SubDirHdrs $(XMLHDRS) ;
SOURCES =
dragons.c
illusion.c
races.c
zombies.c
;

View File

@ -16,6 +16,7 @@ SOURCES =
cvector.c
dice.c
event.c
filereader.c
functions.c
goodies.c
graph.c

View File

@ -620,7 +620,7 @@ load_inifile(const char * filename)
luafile = iniparser_getstring(d, "eressea:run", luafile);
g_reportdir = iniparser_getstring(d, "eressea:report", g_reportdir);
str = iniparser_getstring(d, "common:locales", "de");
str = iniparser_getstring(d, "common:locales", "de,en");
make_locales(str);
}
inifile = d;

View File

@ -1,7 +1,5 @@
-- the locales that this gameworld supports.
local locales = { "de", "en" }
enc_orders = "ISO-8859-1"
enc_game = "ISO-8859-1"
function loadscript(name)
local script = scriptpath .. "/" .. name
@ -56,7 +54,7 @@ function process(orders)
equipment_setitem("new_faction", "money", "4200");
file = "" .. get_turn()
set_encoding(enc_game)
-- set_encoding(enc_game)
if read_game(file)~=0 then
print("could not read game")
return -1
@ -67,7 +65,7 @@ function process(orders)
loadscript("eressea/multis.lua")
-- run the turn:
if read_orders(orders, enc_orders) ~= 0 then
if read_orders(orders) ~= 0 then
print("could not read " .. orders)
return -1
end