forked from github/server
Unicode WIP, does not compile.
- finishing for today. Spells still need work, the error-messages need translation.
This commit is contained in:
parent
219e836791
commit
b2cbb1234b
6 changed files with 34 additions and 23 deletions
|
@ -245,7 +245,7 @@ find_manual(region * r, unit * u)
|
||||||
break;
|
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]);
|
sprintf(zBook, "manual_title_%s", skillnames[skill]);
|
||||||
|
|
||||||
msg = msg_message("find_manual", "unit location book", u, zLocation, zBook);
|
msg = msg_message("find_manual", "unit location book", u, zLocation, zBook);
|
||||||
|
|
|
@ -520,6 +520,24 @@ buildingeffsize(const building * b, boolean img)
|
||||||
return n;
|
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 *
|
unit *
|
||||||
buildingowner(const region * r, const building * b)
|
buildingowner(const region * r, const building * b)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1602,21 +1602,6 @@ cstring(const char *s)
|
||||||
return cstring_i(ibuf);
|
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 *
|
building *
|
||||||
largestbuilding (const region * r, boolean img)
|
largestbuilding (const region * r, boolean img)
|
||||||
{
|
{
|
||||||
|
|
|
@ -198,15 +198,22 @@ destroy_ship(ship * sh)
|
||||||
handle_event(sh->attribs, "destroy", 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)
|
shipname(const ship * sh)
|
||||||
{
|
{
|
||||||
typedef char name[OBJECTIDSIZE + 1];
|
typedef char name[OBJECTIDSIZE + 1];
|
||||||
static name idbuf[8];
|
static name idbuf[8];
|
||||||
static int nextbuf = 0;
|
static int nextbuf = 0;
|
||||||
char *ibuf = idbuf[(++nextbuf) % 8];
|
char *ibuf = idbuf[(++nextbuf) % 8];
|
||||||
sprintf(ibuf, "%s (%s)", sh->name, itoa36(sh->no));
|
return write_shipname(sh, (xmlChar*)ibuf, sizeof(name));
|
||||||
return ibuf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -87,7 +87,8 @@ extern int shipcapacity(const struct ship * sh);
|
||||||
extern void getshipweight(const struct ship * sh, int *weight, int *cabins);
|
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 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 *findship(int n);
|
||||||
extern struct ship *findshipr(const struct region *r, int n);
|
extern struct ship *findshipr(const struct region *r, int n);
|
||||||
|
|
||||||
|
|
|
@ -670,7 +670,7 @@ sp_destroy_magic(castorder *co)
|
||||||
building *b;
|
building *b;
|
||||||
b = pa->param[0]->data.b;
|
b = pa->param[0]->data.b;
|
||||||
ap = &b->attribs;
|
ap = &b->attribs;
|
||||||
strcpy(ts, buildingname(b));
|
write_buildingname(b, ts, sizeof(ts));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SPP_SHIP:
|
case SPP_SHIP:
|
||||||
|
@ -678,7 +678,7 @@ sp_destroy_magic(castorder *co)
|
||||||
ship *sh;
|
ship *sh;
|
||||||
sh = pa->param[0]->data.sh;
|
sh = pa->param[0]->data.sh;
|
||||||
ap = &sh->attribs;
|
ap = &sh->attribs;
|
||||||
strcpy(ts, shipname(sh));
|
write_shipname(sh, ts, sizeof(ts));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -690,7 +690,7 @@ sp_destroy_magic(castorder *co)
|
||||||
if (succ) {
|
if (succ) {
|
||||||
ADDMSG(&mage->faction->msgs, msg_message(
|
ADDMSG(&mage->faction->msgs, msg_message(
|
||||||
"destroy_magic_effect", "unit region command succ target",
|
"destroy_magic_effect", "unit region command succ target",
|
||||||
mage, mage->region, co->order, succ, strdup(ts)));
|
mage, mage->region, co->order, succ, ts));
|
||||||
} else {
|
} else {
|
||||||
ADDMSG(&mage->faction->msgs, msg_message(
|
ADDMSG(&mage->faction->msgs, msg_message(
|
||||||
"destroy_magic_noeffect", "unit region command",
|
"destroy_magic_noeffect", "unit region command",
|
||||||
|
|
Loading…
Reference in a new issue