Unicode WIP, does not compile.

- finishing for today. Spells still need work, the error-messages need translation.
This commit is contained in:
Enno Rehling 2007-06-28 00:39:55 +00:00
parent 219e836791
commit b2cbb1234b
6 changed files with 34 additions and 23 deletions

View file

@ -245,7 +245,7 @@ find_manual(region * r, unit * u)
break;
}
sprintf(zLocation, "manual_location_%d", rng_int() % 4);
sprintf(zLocation, "manual_location_%d", (int)(rng_int() % 4));
sprintf(zBook, "manual_title_%s", skillnames[skill]);
msg = msg_message("find_manual", "unit location book", u, zLocation, zBook);

View file

@ -520,6 +520,24 @@ buildingeffsize(const building * b, boolean img)
return n;
}
const xmlChar *
write_buildingname(const building * b, xmlChar * ibuf, size_t size)
{
snprintf((char*)ibuf, size, "%s (%s)", b->name, itoa36(b->no));
ibuf[size-1] = 0;
return ibuf;
}
const xmlChar *
buildingname(const building * b)
{
typedef char name[OBJECTIDSIZE + 1];
static name idbuf[8];
static int nextbuf = 0;
char *ibuf = idbuf[(++nextbuf) % 8];
return write_buildingname(b, (xmlChar*)ibuf, sizeof(name));
}
unit *
buildingowner(const region * r, const building * b)
{

View file

@ -1602,21 +1602,6 @@ cstring(const char *s)
return cstring_i(ibuf);
}
const xmlChar *
write_buildingname(const building * b, xmlChar * ibuf, size_t size)
{
snprintf((char*)ibuf, sizeof(name), "%s (%s)", b->name, itoa36(b->no));
ibuf[sizeof(name)-1] = 0;
return ibuf;
}
const xmlChar *
buildingname(const building * b)
{
char *ibuf = idbuf[(++nextbuf) % 8];
return write_buildingname(b, (xmlChar*)ibuf, sizeof(name));
}
building *
largestbuilding (const region * r, boolean img)
{

View file

@ -198,15 +198,22 @@ destroy_ship(ship * sh)
handle_event(sh->attribs, "destroy", sh);
}
const char *
const xmlChar *
write_shipname(const ship * sh, xmlChar * ibuf, size_t size)
{
snprintf((char*)ibuf, size, "%s (%s)", sh->name, itoa36(sh->no));
ibuf[size-1] = 0;
return ibuf;
}
const xmlChar *
shipname(const ship * sh)
{
typedef char name[OBJECTIDSIZE + 1];
static name idbuf[8];
static int nextbuf = 0;
char *ibuf = idbuf[(++nextbuf) % 8];
sprintf(ibuf, "%s (%s)", sh->name, itoa36(sh->no));
return ibuf;
return write_shipname(sh, (xmlChar*)ibuf, sizeof(name));
}
int

View file

@ -87,7 +87,8 @@ extern int shipcapacity(const struct ship * sh);
extern void getshipweight(const struct ship * sh, int *weight, int *cabins);
extern ship *new_ship(const struct ship_type * stype, const struct locale * lang, struct region * r);
extern const char *shipname(const struct ship * sh);
extern const xmlChar *shipname(const struct ship * sh);
extern const xmlChar *write_shipname(const struct ship * sh, xmlChar * buffer, size_t size);
extern struct ship *findship(int n);
extern struct ship *findshipr(const struct region *r, int n);

View file

@ -670,7 +670,7 @@ sp_destroy_magic(castorder *co)
building *b;
b = pa->param[0]->data.b;
ap = &b->attribs;
strcpy(ts, buildingname(b));
write_buildingname(b, ts, sizeof(ts));
break;
}
case SPP_SHIP:
@ -678,7 +678,7 @@ sp_destroy_magic(castorder *co)
ship *sh;
sh = pa->param[0]->data.sh;
ap = &sh->attribs;
strcpy(ts, shipname(sh));
write_shipname(sh, ts, sizeof(ts));
break;
}
default:
@ -690,7 +690,7 @@ sp_destroy_magic(castorder *co)
if (succ) {
ADDMSG(&mage->faction->msgs, msg_message(
"destroy_magic_effect", "unit region command succ target",
mage, mage->region, co->order, succ, strdup(ts)));
mage, mage->region, co->order, succ, ts));
} else {
ADDMSG(&mage->faction->msgs, msg_message(
"destroy_magic_noeffect", "unit region command",