forked from github/server
remove the locale from orders.
This commit is contained in:
parent
2b54605080
commit
34cd692c2d
16 changed files with 163 additions and 154 deletions
|
@ -47,7 +47,8 @@ function test_give()
|
||||||
assert_not_equal(5, u2:get_item("money"))
|
assert_not_equal(5, u2:get_item("money"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_make_temp()
|
function disable_test_make_temp()
|
||||||
|
-- disabled because of TOLUA_ORDERS_CLOSURE
|
||||||
u:add_order("MACHE TEMP 123 'Herpderp'")
|
u:add_order("MACHE TEMP 123 'Herpderp'")
|
||||||
u:add_order("// this comment will be copied")
|
u:add_order("// this comment will be copied")
|
||||||
u:add_order("ENDE")
|
u:add_order("ENDE")
|
||||||
|
|
121
src/bind_unit.c
121
src/bind_unit.c
|
@ -763,6 +763,22 @@ static int tolua_unit_get_spells(lua_State * L)
|
||||||
return tolua_selist_push(L, "spellbook", "spell_entry", slist);
|
return tolua_selist_push(L, "spellbook", "spell_entry", slist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TOLUA_ORDERS_CLOSURE
|
||||||
|
/* TODO: this requires that the locale for write_order is included in the closure */
|
||||||
|
static int tolua_orderlist_next(lua_State * L)
|
||||||
|
{
|
||||||
|
order **order_ptr = (order **)lua_touserdata(L, lua_upvalueindex(1));
|
||||||
|
order *ord = *order_ptr;
|
||||||
|
if (ord != NULL) {
|
||||||
|
char cmd[8192];
|
||||||
|
write_order(ord, cmd, sizeof(cmd));
|
||||||
|
tolua_pushstring(L, cmd);
|
||||||
|
*order_ptr = ord->next;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int tolua_unit_get_orders(lua_State * L)
|
static int tolua_unit_get_orders(lua_State * L)
|
||||||
{
|
{
|
||||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||||
|
@ -778,7 +794,7 @@ static int tolua_unit_get_orders(lua_State * L)
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
static int tolua_unit_get_curse(lua_State *L) {
|
static int tolua_unit_get_curse(lua_State *L) {
|
||||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||||
const char *name = tolua_tostring(L, 2, 0);
|
const char *name = tolua_tostring(L, 2, 0);
|
||||||
|
@ -960,95 +976,96 @@ void tolua_unit_open(lua_State * L)
|
||||||
NULL);
|
NULL);
|
||||||
tolua_beginmodule(L, TOLUA_CAST "event");
|
tolua_beginmodule(L, TOLUA_CAST "event");
|
||||||
{
|
{
|
||||||
tolua_function(L, TOLUA_CAST "get_type", &tolua_event_gettype);
|
tolua_function(L, TOLUA_CAST "get_type", tolua_event_gettype);
|
||||||
tolua_function(L, TOLUA_CAST "get", &tolua_event_get);
|
tolua_function(L, TOLUA_CAST "get", tolua_event_get);
|
||||||
}
|
}
|
||||||
tolua_endmodule(L);
|
tolua_endmodule(L);
|
||||||
|
|
||||||
tolua_cclass(L, TOLUA_CAST "unit", TOLUA_CAST "unit", TOLUA_CAST "", NULL);
|
tolua_cclass(L, TOLUA_CAST "unit", TOLUA_CAST "unit", TOLUA_CAST "", NULL);
|
||||||
tolua_beginmodule(L, TOLUA_CAST "unit");
|
tolua_beginmodule(L, TOLUA_CAST "unit");
|
||||||
{
|
{
|
||||||
tolua_function(L, TOLUA_CAST "__tostring", &tolua_unit_tostring);
|
tolua_function(L, TOLUA_CAST "__tostring", tolua_unit_tostring);
|
||||||
tolua_function(L, TOLUA_CAST "create", &tolua_unit_create);
|
tolua_function(L, TOLUA_CAST "create", tolua_unit_create);
|
||||||
tolua_function(L, TOLUA_CAST "destroy", &tolua_unit_destroy);
|
tolua_function(L, TOLUA_CAST "destroy", tolua_unit_destroy);
|
||||||
|
|
||||||
tolua_variable(L, TOLUA_CAST "name", &tolua_unit_get_name,
|
tolua_variable(L, TOLUA_CAST "name", tolua_unit_get_name,
|
||||||
tolua_unit_set_name);
|
tolua_unit_set_name);
|
||||||
tolua_variable(L, TOLUA_CAST "faction", &tolua_unit_get_faction,
|
tolua_variable(L, TOLUA_CAST "faction", tolua_unit_get_faction,
|
||||||
tolua_unit_set_faction);
|
tolua_unit_set_faction);
|
||||||
tolua_variable(L, TOLUA_CAST "id", tolua_unit_get_id, tolua_unit_set_id);
|
tolua_variable(L, TOLUA_CAST "id", tolua_unit_get_id, tolua_unit_set_id);
|
||||||
tolua_variable(L, TOLUA_CAST "group", tolua_unit_get_group, tolua_unit_set_group);
|
tolua_variable(L, TOLUA_CAST "group", tolua_unit_get_group, tolua_unit_set_group);
|
||||||
tolua_variable(L, TOLUA_CAST "info", tolua_unit_get_info, tolua_unit_set_info);
|
tolua_variable(L, TOLUA_CAST "info", tolua_unit_get_info, tolua_unit_set_info);
|
||||||
tolua_variable(L, TOLUA_CAST "hp", &tolua_unit_get_hp, tolua_unit_set_hp);
|
tolua_variable(L, TOLUA_CAST "hp", tolua_unit_get_hp, tolua_unit_set_hp);
|
||||||
tolua_variable(L, TOLUA_CAST "status", &tolua_unit_get_status,
|
tolua_variable(L, TOLUA_CAST "status", tolua_unit_get_status,
|
||||||
tolua_unit_set_status);
|
tolua_unit_set_status);
|
||||||
tolua_variable(L, TOLUA_CAST "familiar", &tolua_unit_get_familiar,
|
tolua_variable(L, TOLUA_CAST "familiar", tolua_unit_get_familiar,
|
||||||
tolua_unit_set_familiar);
|
tolua_unit_set_familiar);
|
||||||
|
|
||||||
tolua_variable(L, TOLUA_CAST "weight", &tolua_unit_get_weight, 0);
|
tolua_variable(L, TOLUA_CAST "weight", tolua_unit_get_weight, 0);
|
||||||
tolua_variable(L, TOLUA_CAST "capacity", &tolua_unit_get_capacity, 0);
|
tolua_variable(L, TOLUA_CAST "capacity", tolua_unit_get_capacity, 0);
|
||||||
|
|
||||||
tolua_function(L, TOLUA_CAST "add_order", &tolua_unit_add_order);
|
tolua_function(L, TOLUA_CAST "add_order", tolua_unit_add_order);
|
||||||
tolua_function(L, TOLUA_CAST "clear_orders", &tolua_unit_clear_orders);
|
tolua_function(L, TOLUA_CAST "clear_orders", tolua_unit_clear_orders);
|
||||||
tolua_variable(L, TOLUA_CAST "orders", &tolua_unit_get_orders, 0);
|
#ifdef TOLUA_ORDERS_CLOSURE
|
||||||
|
tolua_variable(L, TOLUA_CAST "orders", tolua_unit_get_orders, 0);
|
||||||
tolua_function(L, TOLUA_CAST "get_curse", &tolua_unit_get_curse);
|
#endif
|
||||||
tolua_function(L, TOLUA_CAST "has_attrib", &tolua_unit_has_attrib);
|
tolua_function(L, TOLUA_CAST "get_curse", tolua_unit_get_curse);
|
||||||
|
tolua_function(L, TOLUA_CAST "has_attrib", tolua_unit_has_attrib);
|
||||||
|
|
||||||
/* key-attributes for named flags: */
|
/* key-attributes for named flags: */
|
||||||
tolua_function(L, TOLUA_CAST "set_flag", &tolua_unit_set_flag);
|
tolua_function(L, TOLUA_CAST "set_flag", tolua_unit_set_flag);
|
||||||
tolua_function(L, TOLUA_CAST "get_flag", &tolua_unit_get_flag);
|
tolua_function(L, TOLUA_CAST "get_flag", tolua_unit_get_flag);
|
||||||
tolua_variable(L, TOLUA_CAST "guard", &tolua_unit_get_guard,
|
tolua_variable(L, TOLUA_CAST "guard", tolua_unit_get_guard,
|
||||||
&tolua_unit_set_guard);
|
tolua_unit_set_guard);
|
||||||
tolua_variable(L, TOLUA_CAST "flags", &tolua_unit_get_flags,
|
tolua_variable(L, TOLUA_CAST "flags", tolua_unit_get_flags,
|
||||||
&tolua_unit_set_flags);
|
tolua_unit_set_flags);
|
||||||
tolua_variable(L, TOLUA_CAST "age", &tolua_unit_get_age,
|
tolua_variable(L, TOLUA_CAST "age", tolua_unit_get_age,
|
||||||
tolua_unit_set_age);
|
tolua_unit_set_age);
|
||||||
|
|
||||||
/* items: */
|
/* items: */
|
||||||
tolua_function(L, TOLUA_CAST "get_item", &tolua_unit_get_item);
|
tolua_function(L, TOLUA_CAST "get_item", tolua_unit_get_item);
|
||||||
tolua_function(L, TOLUA_CAST "add_item", &tolua_unit_add_item);
|
tolua_function(L, TOLUA_CAST "add_item", tolua_unit_add_item);
|
||||||
tolua_variable(L, TOLUA_CAST "items", &tolua_unit_get_items, 0);
|
tolua_variable(L, TOLUA_CAST "items", tolua_unit_get_items, 0);
|
||||||
tolua_function(L, TOLUA_CAST "get_pooled", &tolua_unit_get_pooled);
|
tolua_function(L, TOLUA_CAST "get_pooled", tolua_unit_get_pooled);
|
||||||
tolua_function(L, TOLUA_CAST "use_pooled", &tolua_unit_use_pooled);
|
tolua_function(L, TOLUA_CAST "use_pooled", tolua_unit_use_pooled);
|
||||||
|
|
||||||
/* effects */
|
/* effects */
|
||||||
tolua_function(L, TOLUA_CAST "get_potion", &tolua_unit_get_effect);
|
tolua_function(L, TOLUA_CAST "get_potion", tolua_unit_get_effect);
|
||||||
|
|
||||||
/* skills: */
|
/* skills: */
|
||||||
tolua_function(L, TOLUA_CAST "get_skill", &tolua_unit_getskill);
|
tolua_function(L, TOLUA_CAST "get_skill", tolua_unit_getskill);
|
||||||
tolua_function(L, TOLUA_CAST "eff_skill", &tolua_unit_effskill);
|
tolua_function(L, TOLUA_CAST "eff_skill", tolua_unit_effskill);
|
||||||
tolua_function(L, TOLUA_CAST "set_skill", &tolua_unit_setskill);
|
tolua_function(L, TOLUA_CAST "set_skill", tolua_unit_setskill);
|
||||||
|
|
||||||
tolua_function(L, TOLUA_CAST "add_notice", &tolua_unit_addnotice);
|
tolua_function(L, TOLUA_CAST "add_notice", tolua_unit_addnotice);
|
||||||
|
|
||||||
/* npc logic: */
|
/* npc logic: */
|
||||||
tolua_function(L, TOLUA_CAST "add_handler", &tolua_unit_addhandler);
|
tolua_function(L, TOLUA_CAST "add_handler", tolua_unit_addhandler);
|
||||||
|
|
||||||
tolua_variable(L, TOLUA_CAST "race_name", &tolua_unit_get_racename,
|
tolua_variable(L, TOLUA_CAST "race_name", tolua_unit_get_racename,
|
||||||
&tolua_unit_set_racename);
|
tolua_unit_set_racename);
|
||||||
tolua_function(L, TOLUA_CAST "add_spell", &tolua_unit_addspell);
|
tolua_function(L, TOLUA_CAST "add_spell", tolua_unit_addspell);
|
||||||
tolua_variable(L, TOLUA_CAST "spells", &tolua_unit_get_spells, 0);
|
tolua_variable(L, TOLUA_CAST "spells", tolua_unit_get_spells, 0);
|
||||||
tolua_function(L, TOLUA_CAST "cast_spell", &tolua_unit_castspell);
|
tolua_function(L, TOLUA_CAST "cast_spell", tolua_unit_castspell);
|
||||||
|
|
||||||
tolua_variable(L, TOLUA_CAST "magic", &tolua_unit_get_magic,
|
tolua_variable(L, TOLUA_CAST "magic", tolua_unit_get_magic,
|
||||||
tolua_unit_set_magic);
|
tolua_unit_set_magic);
|
||||||
tolua_variable(L, TOLUA_CAST "aura", &tolua_unit_get_aura,
|
tolua_variable(L, TOLUA_CAST "aura", tolua_unit_get_aura,
|
||||||
tolua_unit_set_aura);
|
tolua_unit_set_aura);
|
||||||
tolua_variable(L, TOLUA_CAST "building", &tolua_unit_get_building,
|
tolua_variable(L, TOLUA_CAST "building", tolua_unit_get_building,
|
||||||
tolua_unit_set_building);
|
tolua_unit_set_building);
|
||||||
tolua_variable(L, TOLUA_CAST "ship", &tolua_unit_get_ship,
|
tolua_variable(L, TOLUA_CAST "ship", tolua_unit_get_ship,
|
||||||
tolua_unit_set_ship);
|
tolua_unit_set_ship);
|
||||||
tolua_variable(L, TOLUA_CAST "region", &tolua_unit_get_region,
|
tolua_variable(L, TOLUA_CAST "region", tolua_unit_get_region,
|
||||||
tolua_unit_set_region);
|
tolua_unit_set_region);
|
||||||
tolua_variable(L, TOLUA_CAST "number", &tolua_unit_get_number,
|
tolua_variable(L, TOLUA_CAST "number", tolua_unit_get_number,
|
||||||
tolua_unit_set_number);
|
tolua_unit_set_number);
|
||||||
tolua_variable(L, TOLUA_CAST "race", &tolua_unit_get_race,
|
tolua_variable(L, TOLUA_CAST "race", tolua_unit_get_race,
|
||||||
tolua_unit_set_race);
|
tolua_unit_set_race);
|
||||||
tolua_variable(L, TOLUA_CAST "hp_max", &tolua_unit_get_hpmax, 0);
|
tolua_variable(L, TOLUA_CAST "hp_max", tolua_unit_get_hpmax, 0);
|
||||||
tolua_variable(L, TOLUA_CAST "aura_max", &tolua_unit_get_auramax, 0);
|
tolua_variable(L, TOLUA_CAST "aura_max", tolua_unit_get_auramax, 0);
|
||||||
|
|
||||||
tolua_function(L, TOLUA_CAST "show", &tolua_bufunit);
|
tolua_function(L, TOLUA_CAST "show", tolua_bufunit);
|
||||||
}
|
}
|
||||||
tolua_endmodule(L);
|
tolua_endmodule(L);
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,20 +114,6 @@ int log_lua_error(lua_State * L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tolua_orderlist_next(lua_State * L)
|
|
||||||
{
|
|
||||||
order **order_ptr = (order **)lua_touserdata(L, lua_upvalueindex(1));
|
|
||||||
order *ord = *order_ptr;
|
|
||||||
if (ord != NULL) {
|
|
||||||
char cmd[8192];
|
|
||||||
write_order(ord, cmd, sizeof(cmd));
|
|
||||||
tolua_pushstring(L, cmd);
|
|
||||||
*order_ptr = ord->next;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int tolua_selist_iter(lua_State * L)
|
static int tolua_selist_iter(lua_State * L)
|
||||||
{
|
{
|
||||||
selist **qlp = (selist **)lua_touserdata(L, lua_upvalueindex(1));
|
selist **qlp = (selist **)lua_touserdata(L, lua_upvalueindex(1));
|
||||||
|
|
|
@ -22,7 +22,6 @@ extern "C" {
|
||||||
int tolua_sqlite_open(struct lua_State *L);
|
int tolua_sqlite_open(struct lua_State *L);
|
||||||
int tolua_bindings_open(struct lua_State *L, const struct _dictionary_ *d);
|
int tolua_bindings_open(struct lua_State *L, const struct _dictionary_ *d);
|
||||||
int tolua_itemlist_next(struct lua_State *L);
|
int tolua_itemlist_next(struct lua_State *L);
|
||||||
int tolua_orderlist_next(struct lua_State *L);
|
|
||||||
int tolua_selist_push(struct lua_State *L, const char *list_type,
|
int tolua_selist_push(struct lua_State *L, const char *list_type,
|
||||||
const char *elem_type, struct selist *list);
|
const char *elem_type, struct selist *list);
|
||||||
|
|
||||||
|
|
|
@ -376,13 +376,13 @@ static int cr_alliance(variant var, char *buffer, const void *userdata)
|
||||||
|
|
||||||
static int cr_skill(variant var, char *buffer, const void *userdata)
|
static int cr_skill(variant var, char *buffer, const void *userdata)
|
||||||
{
|
{
|
||||||
const faction *report = (const faction *)userdata;
|
const faction *f = (const faction *)userdata;
|
||||||
skill_t sk = (skill_t)var.i;
|
skill_t sk = (skill_t)var.i;
|
||||||
UNUSED_ARG(userdata);
|
UNUSED_ARG(userdata);
|
||||||
if (sk != NOSKILL)
|
if (sk != NOSKILL)
|
||||||
sprintf(buffer, "\"%s\"",
|
sprintf(buffer, "\"%s\"",
|
||||||
translate(mkname("skill", skillnames[sk]), skillname(sk,
|
translate(mkname("skill", skillnames[sk]), skillname(sk,
|
||||||
report->locale)));
|
f->locale)));
|
||||||
else
|
else
|
||||||
strcpy(buffer, "\"\"");
|
strcpy(buffer, "\"\"");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -391,13 +391,14 @@ static int cr_skill(variant var, char *buffer, const void *userdata)
|
||||||
static int cr_order(variant var, char *buffer, const void *userdata)
|
static int cr_order(variant var, char *buffer, const void *userdata)
|
||||||
{
|
{
|
||||||
order *ord = (order *)var.v;
|
order *ord = (order *)var.v;
|
||||||
UNUSED_ARG(userdata);
|
const faction *f = (const faction *)userdata;
|
||||||
|
|
||||||
if (ord != NULL) {
|
if (ord != NULL) {
|
||||||
char cmd[ORDERSIZE];
|
char cmd[ORDERSIZE];
|
||||||
char *wp = buffer;
|
char *wp = buffer;
|
||||||
const char *rp;
|
const char *rp;
|
||||||
|
|
||||||
get_command(ord, cmd, sizeof(cmd));
|
get_command(ord, f->locale, cmd, sizeof(cmd));
|
||||||
|
|
||||||
*wp++ = '\"';
|
*wp++ = '\"';
|
||||||
for (rp = cmd; *rp;) {
|
for (rp = cmd; *rp;) {
|
||||||
|
@ -722,11 +723,11 @@ static void cr_output_ship_compat(FILE *F, const ship *sh, const unit *u,
|
||||||
cr_output_ship(&strm, sh, u, fcaptain, f, r);
|
cr_output_ship(&strm, sh, u, fcaptain, f, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int stream_order(stream *out, const struct order *ord) {
|
static int stream_order(stream *out, const struct order *ord, const struct locale *lang) {
|
||||||
const char *str;
|
const char *str;
|
||||||
char ebuf[1025];
|
char ebuf[1025];
|
||||||
char obuf[1024];
|
char obuf[1024];
|
||||||
write_order(ord, obuf, sizeof(obuf));
|
write_order(ord, lang, obuf, sizeof(obuf));
|
||||||
str = escape_string(obuf, ebuf, sizeof(ebuf));
|
str = escape_string(obuf, ebuf, sizeof(ebuf));
|
||||||
if (str == ebuf) {
|
if (str == ebuf) {
|
||||||
ebuf[1024] = 0;
|
ebuf[1024] = 0;
|
||||||
|
@ -779,6 +780,7 @@ void cr_output_unit(stream *out, const region * r, const faction * f,
|
||||||
const faction *fother;
|
const faction *fother;
|
||||||
const char *prefix;
|
const char *prefix;
|
||||||
bool allied;
|
bool allied;
|
||||||
|
const struct locale *lang = f->locale;
|
||||||
|
|
||||||
assert(u && u->number);
|
assert(u && u->number);
|
||||||
assert(u->region == r); /* TODO: if this holds true, then why did we pass in r? */
|
assert(u->region == r); /* TODO: if this holds true, then why did we pass in r? */
|
||||||
|
@ -787,7 +789,7 @@ void cr_output_unit(stream *out, const region * r, const faction * f,
|
||||||
|
|
||||||
stream_printf(out, "EINHEIT %d\n", u->no);
|
stream_printf(out, "EINHEIT %d\n", u->no);
|
||||||
stream_printf(out, "\"%s\";Name\n", unit_getname(u));
|
stream_printf(out, "\"%s\";Name\n", unit_getname(u));
|
||||||
str = u_description(u, f->locale);
|
str = u_description(u, lang);
|
||||||
if (str) {
|
if (str) {
|
||||||
stream_printf(out, "\"%s\";Beschr\n", str);
|
stream_printf(out, "\"%s\";Beschr\n", str);
|
||||||
}
|
}
|
||||||
|
@ -833,7 +835,7 @@ void cr_output_unit(stream *out, const region * r, const faction * f,
|
||||||
prefix = raceprefix(u);
|
prefix = raceprefix(u);
|
||||||
if (prefix) {
|
if (prefix) {
|
||||||
prefix = mkname("prefix", prefix);
|
prefix = mkname("prefix", prefix);
|
||||||
stream_printf(out, "\"%s\";typprefix\n", translate(prefix, LOC(f->locale,
|
stream_printf(out, "\"%s\";typprefix\n", translate(prefix, LOC(lang,
|
||||||
prefix)));
|
prefix)));
|
||||||
}
|
}
|
||||||
stream_printf(out, "%d;Anzahl\n", u->number);
|
stream_printf(out, "%d;Anzahl\n", u->number);
|
||||||
|
@ -844,20 +846,20 @@ void cr_output_unit(stream *out, const region * r, const faction * f,
|
||||||
if (u->faction == f && fval(u_race(u), RCF_SHAPESHIFTANY)) {
|
if (u->faction == f && fval(u_race(u), RCF_SHAPESHIFTANY)) {
|
||||||
const char *zRace = rc_name_s(u_race(u), NAME_PLURAL);
|
const char *zRace = rc_name_s(u_race(u), NAME_PLURAL);
|
||||||
stream_printf(out, "\"%s\";wahrerTyp\n",
|
stream_printf(out, "\"%s\";wahrerTyp\n",
|
||||||
translate(zRace, LOC(f->locale, zRace)));
|
translate(zRace, LOC(lang, zRace)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const race *irace = u_irace(u);
|
const race *irace = u_irace(u);
|
||||||
const char *zRace = rc_name_s(irace, NAME_PLURAL);
|
const char *zRace = rc_name_s(irace, NAME_PLURAL);
|
||||||
stream_printf(out, "\"%s\";Typ\n",
|
stream_printf(out, "\"%s\";Typ\n",
|
||||||
translate(zRace, LOC(f->locale, zRace)));
|
translate(zRace, LOC(lang, zRace)));
|
||||||
if (u->faction == f && irace != u_race(u)) {
|
if (u->faction == f && irace != u_race(u)) {
|
||||||
assert(skill_enabled(SK_STEALTH)
|
assert(skill_enabled(SK_STEALTH)
|
||||||
|| !"we're resetting this on load, so.. ircase should never be used");
|
|| !"we're resetting this on load, so.. ircase should never be used");
|
||||||
zRace = rc_name_s(u_race(u), NAME_PLURAL);
|
zRace = rc_name_s(u_race(u), NAME_PLURAL);
|
||||||
stream_printf(out, "\"%s\";wahrerTyp\n",
|
stream_printf(out, "\"%s\";wahrerTyp\n",
|
||||||
translate(zRace, LOC(f->locale, zRace)));
|
translate(zRace, LOC(lang, zRace)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -925,7 +927,7 @@ void cr_output_unit(stream *out, const region * r, const faction * f,
|
||||||
for (ord = u->old_orders; ord; ord = ord->next) {
|
for (ord = u->old_orders; ord; ord = ord->next) {
|
||||||
/* this new order will replace the old defaults */
|
/* this new order will replace the old defaults */
|
||||||
if (is_persistent(ord)) {
|
if (is_persistent(ord)) {
|
||||||
stream_order(out, ord);
|
stream_order(out, ord, lang);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (ord = u->orders; ord; ord = ord->next) {
|
for (ord = u->orders; ord; ord = ord->next) {
|
||||||
|
@ -933,7 +935,7 @@ void cr_output_unit(stream *out, const region * r, const faction * f,
|
||||||
if (u->old_orders && is_repeated(kwd))
|
if (u->old_orders && is_repeated(kwd))
|
||||||
continue; /* unit has defaults */
|
continue; /* unit has defaults */
|
||||||
if (is_persistent(ord)) {
|
if (is_persistent(ord)) {
|
||||||
stream_order(out, ord);
|
stream_order(out, ord, lang);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -949,7 +951,7 @@ void cr_output_unit(stream *out, const region * r, const faction * f,
|
||||||
}
|
}
|
||||||
stream_printf(out, "%d %d;%s\n", u->number * level_days(sv->level), esk,
|
stream_printf(out, "%d %d;%s\n", u->number * level_days(sv->level), esk,
|
||||||
translate(mkname("skill", skillnames[sk]), skillname(sk,
|
translate(mkname("skill", skillnames[sk]), skillname(sk,
|
||||||
f->locale)));
|
lang)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -963,8 +965,7 @@ void cr_output_unit(stream *out, const region * r, const faction * f,
|
||||||
const spell *sp = mage->combatspells[i].sp;
|
const spell *sp = mage->combatspells[i].sp;
|
||||||
if (sp) {
|
if (sp) {
|
||||||
const char *name =
|
const char *name =
|
||||||
translate(mkname("spell", sp->sname), spell_name(sp,
|
translate(mkname("spell", sp->sname), spell_name(sp, lang));
|
||||||
f->locale));
|
|
||||||
stream_printf(out, "KAMPFZAUBER %d\n", i);
|
stream_printf(out, "KAMPFZAUBER %d\n", i);
|
||||||
stream_printf(out, "\"%s\";name\n", name);
|
stream_printf(out, "\"%s\";name\n", name);
|
||||||
stream_printf(out, "%d;level\n", mage->combatspells[i].level);
|
stream_printf(out, "%d;level\n", mage->combatspells[i].level);
|
||||||
|
@ -999,7 +1000,7 @@ void cr_output_unit(stream *out, const region * r, const faction * f,
|
||||||
pr = 1;
|
pr = 1;
|
||||||
stream_printf(out, "GEGENSTAENDE\n");
|
stream_printf(out, "GEGENSTAENDE\n");
|
||||||
}
|
}
|
||||||
stream_printf(out, "%d;%s\n", in, translate(ic, LOC(f->locale, ic)));
|
stream_printf(out, "%d;%s\n", in, translate(ic, LOC(lang, ic)));
|
||||||
}
|
}
|
||||||
|
|
||||||
cr_output_curses(out, f, u, TYP_UNIT);
|
cr_output_curses(out, f, u, TYP_UNIT);
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
|
|
||||||
|
#include <kernel/faction.h>
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
|
@ -107,7 +108,7 @@ void do_command(const struct tnode *keys, struct unit *u, struct order *ord)
|
||||||
init_order(ord);
|
init_order(ord);
|
||||||
if (do_command_i(keys, u, ord) != E_TOK_SUCCESS) {
|
if (do_command_i(keys, u, ord) != E_TOK_SUCCESS) {
|
||||||
char cmd[ORDERSIZE];
|
char cmd[ORDERSIZE];
|
||||||
get_command(ord, cmd, sizeof(cmd));
|
get_command(ord, u->faction->locale, cmd, sizeof(cmd));
|
||||||
log_warning("%s failed command '%s'\n", unitname(u), cmd);
|
log_warning("%s failed command '%s'\n", unitname(u), cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -637,7 +637,7 @@ static void test_infinitive_from_config(CuTest *tc) {
|
||||||
CuAssertIntEquals(tc, K_STUDY, get_keyword("LERNEN", lang));
|
CuAssertIntEquals(tc, K_STUDY, get_keyword("LERNEN", lang));
|
||||||
|
|
||||||
ord = create_order(K_STUDY, lang, "");
|
ord = create_order(K_STUDY, lang, "");
|
||||||
CuAssertStrEquals(tc, "LERNE", get_command(ord, buffer, sizeof(buffer)));
|
CuAssertStrEquals(tc, "LERNE", get_command(ord, lang, buffer, sizeof(buffer)));
|
||||||
free_order(ord);
|
free_order(ord);
|
||||||
cJSON_Delete(json);
|
cJSON_Delete(json);
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
|
|
|
@ -31,13 +31,11 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
# define ORD_KEYWORD(ord) (keyword_t)((ord)->command & 0xFFFF)
|
# define ORD_KEYWORD(ord) (keyword_t)((ord)->command & 0xFFFF)
|
||||||
# define OD_LOCALE(odata) ((odata) ? (odata)->lang : NULL)
|
|
||||||
# define OD_STRING(odata) ((odata) ? (odata)->_str : NULL)
|
# define OD_STRING(odata) ((odata) ? (odata)->_str : NULL)
|
||||||
|
|
||||||
typedef struct order_data {
|
typedef struct order_data {
|
||||||
const char *_str;
|
const char *_str;
|
||||||
int _refcount;
|
int _refcount;
|
||||||
const struct locale *lang;
|
|
||||||
} order_data;
|
} order_data;
|
||||||
|
|
||||||
#include <selist.h>
|
#include <selist.h>
|
||||||
|
@ -115,7 +113,7 @@ keyword_t getkeyword(const order * ord)
|
||||||
* This is the inverse function to the parse_order command. Note that
|
* This is the inverse function to the parse_order command. Note that
|
||||||
* keywords are expanded to their full length.
|
* keywords are expanded to their full length.
|
||||||
*/
|
*/
|
||||||
char* get_command(const order *ord, char *sbuffer, size_t size) {
|
char* get_command(const order *ord, const struct locale *lang, char *sbuffer, size_t size) {
|
||||||
char *bufp = sbuffer;
|
char *bufp = sbuffer;
|
||||||
order_data *od;
|
order_data *od;
|
||||||
const char * text;
|
const char * text;
|
||||||
|
@ -144,7 +142,6 @@ char* get_command(const order *ord, char *sbuffer, size_t size) {
|
||||||
od = load_data(ord->id);
|
od = load_data(ord->id);
|
||||||
text = OD_STRING(od);
|
text = OD_STRING(od);
|
||||||
if (kwd != NOKEYWORD) {
|
if (kwd != NOKEYWORD) {
|
||||||
const struct locale *lang = OD_LOCALE(od);
|
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
const char *str = (const char *)LOC(lang, keyword(kwd));
|
const char *str = (const char *)LOC(lang, keyword(kwd));
|
||||||
assert(str);
|
assert(str);
|
||||||
|
@ -217,13 +214,12 @@ void free_orders(order ** olist)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *mkdata(order_data **pdata, size_t len, const struct locale *lang, const char *str)
|
static char *mkdata(order_data **pdata, size_t len, const char *str)
|
||||||
{
|
{
|
||||||
order_data *data;
|
order_data *data;
|
||||||
char *result;
|
char *result;
|
||||||
data = malloc(sizeof(order_data) + len + 1);
|
data = malloc(sizeof(order_data) + len + 1);
|
||||||
result = (char *)(data + 1);
|
result = (char *)(data + 1);
|
||||||
data->lang = lang;
|
|
||||||
data->_refcount = 0;
|
data->_refcount = 0;
|
||||||
data->_str = (len > 0) ? result : NULL;
|
data->_str = (len > 0) ? result : NULL;
|
||||||
if (str) strcpy(result, str);
|
if (str) strcpy(result, str);
|
||||||
|
@ -231,7 +227,7 @@ static char *mkdata(order_data **pdata, size_t len, const struct locale *lang, c
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static order_data *create_data(keyword_t kwd, const char *sptr, const struct locale *lang)
|
static order_data *create_data(keyword_t kwd, const char *sptr)
|
||||||
{
|
{
|
||||||
const char *s = sptr;
|
const char *s = sptr;
|
||||||
order_data *data;
|
order_data *data;
|
||||||
|
@ -241,17 +237,17 @@ static order_data *create_data(keyword_t kwd, const char *sptr, const struct loc
|
||||||
|
|
||||||
/* orders with no parameter, only one order_data per order required */
|
/* orders with no parameter, only one order_data per order required */
|
||||||
if (kwd != NOKEYWORD && *sptr == 0) {
|
if (kwd != NOKEYWORD && *sptr == 0) {
|
||||||
mkdata(&data, 0, lang, NULL);
|
mkdata(&data, 0, NULL);
|
||||||
data->_refcount = 1;
|
data->_refcount = 1;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
mkdata(&data, s ? strlen(s) : 0, lang, s);
|
mkdata(&data, s ? strlen(s) : 0, s);
|
||||||
data->_refcount = 1;
|
data->_refcount = 1;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static order *create_order_i(order *ord, keyword_t kwd, const char *sptr, bool persistent,
|
static order *create_order_i(order *ord, keyword_t kwd, const char *sptr, bool persistent,
|
||||||
bool noerror, const struct locale *lang)
|
bool noerror)
|
||||||
{
|
{
|
||||||
order_data *od;
|
order_data *od;
|
||||||
|
|
||||||
|
@ -279,7 +275,7 @@ static order *create_order_i(order *ord, keyword_t kwd, const char *sptr, bool p
|
||||||
|
|
||||||
while (isspace(*(unsigned char *)sptr)) ++sptr;
|
while (isspace(*(unsigned char *)sptr)) ++sptr;
|
||||||
|
|
||||||
od = create_data(kwd, sptr, lang);
|
od = create_data(kwd, sptr);
|
||||||
ord->id = add_data(od);
|
ord->id = add_data(od);
|
||||||
release_data(od);
|
release_data(od);
|
||||||
|
|
||||||
|
@ -341,7 +337,7 @@ order *create_order(keyword_t kwd, const struct locale * lang,
|
||||||
zBuffer[0] = 0;
|
zBuffer[0] = 0;
|
||||||
}
|
}
|
||||||
ord = (order *)malloc(sizeof(order));
|
ord = (order *)malloc(sizeof(order));
|
||||||
return create_order_i(ord, kwd, zBuffer, false, false, lang);
|
return create_order_i(ord, kwd, zBuffer, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
order *parse_order(const char *s, const struct locale * lang)
|
order *parse_order(const char *s, const struct locale * lang)
|
||||||
|
@ -373,7 +369,7 @@ order *parse_order(const char *s, const struct locale * lang)
|
||||||
}
|
}
|
||||||
if (kwd != NOKEYWORD) {
|
if (kwd != NOKEYWORD) {
|
||||||
order *ord = (order *)malloc(sizeof(order));
|
order *ord = (order *)malloc(sizeof(order));
|
||||||
return create_order_i(ord, kwd, sptr, persistent, noerror, lang);
|
return create_order_i(ord, kwd, sptr, persistent, noerror);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -529,7 +525,7 @@ bool is_silent(const order * ord)
|
||||||
return (ord->command & CMD_QUIET) != 0;
|
return (ord->command & CMD_QUIET) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *write_order(const order * ord, char *buffer, size_t size)
|
char *write_order(const order * ord, const struct locale *lang, char *buffer, size_t size)
|
||||||
{
|
{
|
||||||
if (ord == 0) {
|
if (ord == 0) {
|
||||||
buffer[0] = 0;
|
buffer[0] = 0;
|
||||||
|
@ -544,7 +540,7 @@ char *write_order(const order * ord, char *buffer, size_t size)
|
||||||
release_data(od);
|
release_data(od);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
get_command(ord, buffer, size);
|
get_command(ord, lang, buffer, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return buffer;
|
return buffer;
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
struct locale;
|
||||||
|
|
||||||
/* Encapsulation of an order
|
/* Encapsulation of an order
|
||||||
*
|
*
|
||||||
* This structure contains one order given by a unit. These used to be
|
* This structure contains one order given by a unit. These used to be
|
||||||
|
@ -57,14 +59,16 @@ extern "C" {
|
||||||
/* access functions for orders */
|
/* access functions for orders */
|
||||||
keyword_t getkeyword(const order * ord);
|
keyword_t getkeyword(const order * ord);
|
||||||
void set_order(order ** destp, order * src);
|
void set_order(order ** destp, order * src);
|
||||||
char* get_command(const order *ord, char *buffer, size_t size);
|
char* get_command(const order *ord, const struct locale *lang,
|
||||||
|
char *buffer, size_t size);
|
||||||
bool is_persistent(const order * ord);
|
bool is_persistent(const order * ord);
|
||||||
bool is_silent(const order * ord);
|
bool is_silent(const order * ord);
|
||||||
bool is_exclusive(const order * ord);
|
bool is_exclusive(const order * ord);
|
||||||
bool is_repeated(keyword_t kwd);
|
bool is_repeated(keyword_t kwd);
|
||||||
bool is_long(keyword_t kwd);
|
bool is_long(keyword_t kwd);
|
||||||
|
|
||||||
char *write_order(const order * ord, char *buffer, size_t size);
|
char *write_order(const order * ord, const struct locale *lang,
|
||||||
|
char *buffer, size_t size);
|
||||||
keyword_t init_order(const struct order *ord);
|
keyword_t init_order(const struct order *ord);
|
||||||
|
|
||||||
void close_orders(void);
|
void close_orders(void);
|
||||||
|
|
|
@ -20,7 +20,7 @@ static void test_create_order(CuTest *tc) {
|
||||||
ord = create_order(K_MOVE, lang, "NORTH");
|
ord = create_order(K_MOVE, lang, "NORTH");
|
||||||
CuAssertPtrNotNull(tc, ord);
|
CuAssertPtrNotNull(tc, ord);
|
||||||
CuAssertIntEquals(tc, K_MOVE, getkeyword(ord));
|
CuAssertIntEquals(tc, K_MOVE, getkeyword(ord));
|
||||||
CuAssertStrEquals(tc, "move NORTH", get_command(ord, cmd, sizeof(cmd)));
|
CuAssertStrEquals(tc, "move NORTH", get_command(ord, lang, cmd, sizeof(cmd)));
|
||||||
|
|
||||||
CuAssertIntEquals(tc, K_MOVE, init_order(ord));
|
CuAssertIntEquals(tc, K_MOVE, init_order(ord));
|
||||||
CuAssertStrEquals(tc, "NORTH", getstrtoken());
|
CuAssertStrEquals(tc, "NORTH", getstrtoken());
|
||||||
|
@ -40,7 +40,7 @@ static void test_parse_order(CuTest *tc) {
|
||||||
CuAssertPtrNotNull(tc, ord);
|
CuAssertPtrNotNull(tc, ord);
|
||||||
CuAssertIntEquals(tc, K_MOVE, ord->command);
|
CuAssertIntEquals(tc, K_MOVE, ord->command);
|
||||||
CuAssertIntEquals(tc, K_MOVE, getkeyword(ord));
|
CuAssertIntEquals(tc, K_MOVE, getkeyword(ord));
|
||||||
CuAssertStrEquals(tc, "move NORTH", get_command(ord, cmd, sizeof(cmd)));
|
CuAssertStrEquals(tc, "move NORTH", get_command(ord, lang, cmd, sizeof(cmd)));
|
||||||
|
|
||||||
CuAssertIntEquals(tc, K_MOVE, init_order(ord));
|
CuAssertIntEquals(tc, K_MOVE, init_order(ord));
|
||||||
CuAssertStrEquals(tc, "NORTH", getstrtoken());
|
CuAssertStrEquals(tc, "NORTH", getstrtoken());
|
||||||
|
@ -98,7 +98,7 @@ static void test_parse_make(CuTest *tc) {
|
||||||
ord = parse_order("M hurrdurr", lang);
|
ord = parse_order("M hurrdurr", lang);
|
||||||
CuAssertPtrNotNull(tc, ord);
|
CuAssertPtrNotNull(tc, ord);
|
||||||
CuAssertIntEquals(tc, K_MAKE, getkeyword(ord));
|
CuAssertIntEquals(tc, K_MAKE, getkeyword(ord));
|
||||||
CuAssertStrEquals(tc, "MAKE hurrdurr", get_command(ord, cmd, sizeof(cmd)));
|
CuAssertStrEquals(tc, "MAKE hurrdurr", get_command(ord, lang, cmd, sizeof(cmd)));
|
||||||
|
|
||||||
CuAssertIntEquals(tc, K_MAKE, init_order(ord));
|
CuAssertIntEquals(tc, K_MAKE, init_order(ord));
|
||||||
CuAssertStrEquals(tc, "hurrdurr", getstrtoken());
|
CuAssertStrEquals(tc, "hurrdurr", getstrtoken());
|
||||||
|
@ -121,7 +121,7 @@ static void test_parse_make_temp(CuTest *tc) {
|
||||||
ord = parse_order("M T herp", lang);
|
ord = parse_order("M T herp", lang);
|
||||||
CuAssertPtrNotNull(tc, ord);
|
CuAssertPtrNotNull(tc, ord);
|
||||||
CuAssertIntEquals(tc, K_MAKETEMP, getkeyword(ord));
|
CuAssertIntEquals(tc, K_MAKETEMP, getkeyword(ord));
|
||||||
CuAssertStrEquals(tc, "MAKETEMP herp", get_command(ord, cmd, sizeof(cmd)));
|
CuAssertStrEquals(tc, "MAKETEMP herp", get_command(ord, lang, cmd, sizeof(cmd)));
|
||||||
|
|
||||||
CuAssertIntEquals(tc, K_MAKETEMP, init_order(ord));
|
CuAssertIntEquals(tc, K_MAKETEMP, init_order(ord));
|
||||||
CuAssertStrEquals(tc, "herp", getstrtoken());
|
CuAssertStrEquals(tc, "herp", getstrtoken());
|
||||||
|
@ -144,7 +144,7 @@ static void test_parse_maketemp(CuTest *tc) {
|
||||||
|
|
||||||
ord = parse_order("MAKET herp", lang);
|
ord = parse_order("MAKET herp", lang);
|
||||||
CuAssertPtrNotNull(tc, ord);
|
CuAssertPtrNotNull(tc, ord);
|
||||||
CuAssertStrEquals(tc, "MAKETEMP herp", get_command(ord, cmd, sizeof(cmd)));
|
CuAssertStrEquals(tc, "MAKETEMP herp", get_command(ord, lang, cmd, sizeof(cmd)));
|
||||||
CuAssertIntEquals(tc, K_MAKETEMP, getkeyword(ord));
|
CuAssertIntEquals(tc, K_MAKETEMP, getkeyword(ord));
|
||||||
CuAssertIntEquals(tc, K_MAKETEMP, init_order(ord));
|
CuAssertIntEquals(tc, K_MAKETEMP, init_order(ord));
|
||||||
CuAssertStrEquals(tc, "herp", getstrtoken());
|
CuAssertStrEquals(tc, "herp", getstrtoken());
|
||||||
|
@ -213,13 +213,13 @@ static void test_get_command(CuTest *tc) {
|
||||||
test_setup();
|
test_setup();
|
||||||
lang = test_create_locale();
|
lang = test_create_locale();
|
||||||
ord = create_order(K_MAKE, lang, "iron");
|
ord = create_order(K_MAKE, lang, "iron");
|
||||||
CuAssertStrEquals(tc, "make iron", get_command(ord, buf, sizeof(buf)));
|
CuAssertStrEquals(tc, "make iron", get_command(ord, lang, buf, sizeof(buf)));
|
||||||
ord->command |= CMD_QUIET;
|
ord->command |= CMD_QUIET;
|
||||||
CuAssertStrEquals(tc, "!make iron", get_command(ord, buf, sizeof(buf)));
|
CuAssertStrEquals(tc, "!make iron", get_command(ord, lang, buf, sizeof(buf)));
|
||||||
ord->command |= CMD_PERSIST;
|
ord->command |= CMD_PERSIST;
|
||||||
CuAssertStrEquals(tc, "!@make iron", get_command(ord, buf, sizeof(buf)));
|
CuAssertStrEquals(tc, "!@make iron", get_command(ord, lang, buf, sizeof(buf)));
|
||||||
ord->command = K_MAKE | CMD_PERSIST;
|
ord->command = K_MAKE | CMD_PERSIST;
|
||||||
CuAssertStrEquals(tc, "@make iron", get_command(ord, buf, sizeof(buf)));
|
CuAssertStrEquals(tc, "@make iron", get_command(ord, lang, buf, sizeof(buf)));
|
||||||
free_order(ord);
|
free_order(ord);
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -379,7 +379,7 @@ static void writeorder(gamedata *data, const struct order *ord,
|
||||||
const struct locale *lang)
|
const struct locale *lang)
|
||||||
{
|
{
|
||||||
char obuf[1024];
|
char obuf[1024];
|
||||||
write_order(ord, obuf, sizeof(obuf));
|
write_order(ord, lang, obuf, sizeof(obuf));
|
||||||
if (obuf[0])
|
if (obuf[0])
|
||||||
WRITE_STR(data->store, obuf);
|
WRITE_STR(data->store, obuf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ static void test_infinitive(CuTest *tc) {
|
||||||
CuAssertIntEquals(tc, K_STUDY, get_keyword("LERNEN", lang));
|
CuAssertIntEquals(tc, K_STUDY, get_keyword("LERNEN", lang));
|
||||||
|
|
||||||
ord = create_order(K_STUDY, lang, "");
|
ord = create_order(K_STUDY, lang, "");
|
||||||
CuAssertStrEquals(tc, "LERNE", get_command(ord, buffer, sizeof(buffer)));
|
CuAssertStrEquals(tc, "LERNE", get_command(ord, lang, buffer, sizeof(buffer)));
|
||||||
free_order(ord);
|
free_order(ord);
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -968,7 +968,7 @@ int quit_cmd(unit * u, struct order *ord)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
char buffer[64];
|
char buffer[64];
|
||||||
write_order(ord, buffer, sizeof(buffer));
|
write_order(ord, f->locale, buffer, sizeof(buffer));
|
||||||
cmistake(u, ord, 86, MSG_EVENT);
|
cmistake(u, ord, 86, MSG_EVENT);
|
||||||
log_warning("QUIT with illegal password for faction %s: %s\n", itoa36(f->no), buffer);
|
log_warning("QUIT with illegal password for faction %s: %s\n", itoa36(f->no), buffer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,12 +31,12 @@
|
||||||
extern void plan_monsters(struct faction *f);
|
extern void plan_monsters(struct faction *f);
|
||||||
extern int monster_attacks(unit * monster, bool rich_only);
|
extern int monster_attacks(unit * monster, bool rich_only);
|
||||||
|
|
||||||
static order *find_order(const char *expected, const unit *unit)
|
static order *find_order(const char *expected, const unit *u)
|
||||||
{
|
{
|
||||||
char cmd[32];
|
char cmd[32];
|
||||||
order *ord;
|
order *ord;
|
||||||
for (ord = unit->orders; ord; ord = ord->next) {
|
for (ord = u->orders; ord; ord = ord->next) {
|
||||||
if (strcmp(expected, get_command(ord, cmd, sizeof(cmd))) == 0) {
|
if (strcmp(expected, get_command(ord, u->faction->locale, cmd, sizeof(cmd))) == 0) {
|
||||||
return ord;
|
return ord;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
21
src/report.c
21
src/report.c
|
@ -1389,7 +1389,8 @@ static int
|
||||||
report_template(const char *filename, report_context * ctx, const char *bom)
|
report_template(const char *filename, report_context * ctx, const char *bom)
|
||||||
{
|
{
|
||||||
const resource_type *rsilver = get_resourcetype(R_SILVER);
|
const resource_type *rsilver = get_resourcetype(R_SILVER);
|
||||||
faction *f = ctx->f;
|
const faction *f = ctx->f;
|
||||||
|
const struct locale *lang = f->locale;
|
||||||
region *r;
|
region *r;
|
||||||
FILE *F = fopen(filename, "w");
|
FILE *F = fopen(filename, "w");
|
||||||
stream strm = { 0 }, *out = &strm;
|
stream strm = { 0 }, *out = &strm;
|
||||||
|
@ -1408,11 +1409,11 @@ report_template(const char *filename, report_context * ctx, const char *bom)
|
||||||
}
|
}
|
||||||
|
|
||||||
newline(out);
|
newline(out);
|
||||||
rps_nowrap(out, LOC(f->locale, "nr_template"));
|
rps_nowrap(out, LOC(lang, "nr_template"));
|
||||||
newline(out);
|
newline(out);
|
||||||
newline(out);
|
newline(out);
|
||||||
|
|
||||||
sprintf(buf, "%s %s \"password\"", LOC(f->locale, parameters[P_FACTION]), itoa36(f->no));
|
sprintf(buf, "%s %s \"password\"", LOC(lang, parameters[P_FACTION]), itoa36(f->no));
|
||||||
rps_nowrap(out, buf);
|
rps_nowrap(out, buf);
|
||||||
newline(out);
|
newline(out);
|
||||||
newline(out);
|
newline(out);
|
||||||
|
@ -1439,12 +1440,12 @@ report_template(const char *filename, report_context * ctx, const char *bom)
|
||||||
adjust_coordinates(f, &nx, &ny, pl);
|
adjust_coordinates(f, &nx, &ny, pl);
|
||||||
newline(out);
|
newline(out);
|
||||||
if (pl && pl->id != 0) {
|
if (pl && pl->id != 0) {
|
||||||
sprintf(buf, "%s %d,%d,%d ; %s", LOC(f->locale,
|
sprintf(buf, "%s %d,%d,%d ; %s", LOC(lang,
|
||||||
parameters[P_REGION]), nx, ny, pl->id, rname(r, f->locale));
|
parameters[P_REGION]), nx, ny, pl->id, rname(r, lang));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sprintf(buf, "%s %d,%d ; %s", LOC(f->locale, parameters[P_REGION]),
|
sprintf(buf, "%s %d,%d ; %s", LOC(lang, parameters[P_REGION]),
|
||||||
nx, ny, rname(r, f->locale));
|
nx, ny, rname(r, lang));
|
||||||
}
|
}
|
||||||
rps_nowrap(out, buf);
|
rps_nowrap(out, buf);
|
||||||
newline(out);
|
newline(out);
|
||||||
|
@ -1505,7 +1506,7 @@ report_template(const char *filename, report_context * ctx, const char *bom)
|
||||||
for (ord = u->old_orders; ord; ord = ord->next) {
|
for (ord = u->old_orders; ord; ord = ord->next) {
|
||||||
/* this new order will replace the old defaults */
|
/* this new order will replace the old defaults */
|
||||||
strcpy(buf, " ");
|
strcpy(buf, " ");
|
||||||
write_order(ord, buf + 2, sizeof(buf) - 2);
|
write_order(ord, lang, buf + 2, sizeof(buf) - 2);
|
||||||
rps_nowrap(out, buf);
|
rps_nowrap(out, buf);
|
||||||
newline(out);
|
newline(out);
|
||||||
}
|
}
|
||||||
|
@ -1515,7 +1516,7 @@ report_template(const char *filename, report_context * ctx, const char *bom)
|
||||||
continue; /* unit has defaults */
|
continue; /* unit has defaults */
|
||||||
if (is_persistent(ord)) {
|
if (is_persistent(ord)) {
|
||||||
strcpy(buf, " ");
|
strcpy(buf, " ");
|
||||||
write_order(ord, buf + 2, sizeof(buf) - 2);
|
write_order(ord, lang, buf + 2, sizeof(buf) - 2);
|
||||||
rps_nowrap(out, buf);
|
rps_nowrap(out, buf);
|
||||||
newline(out);
|
newline(out);
|
||||||
}
|
}
|
||||||
|
@ -1527,7 +1528,7 @@ report_template(const char *filename, report_context * ctx, const char *bom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newline(out);
|
newline(out);
|
||||||
strlcpy(buf, LOC(f->locale, parameters[P_NEXT]), sizeof(buf));
|
strlcpy(buf, LOC(lang, parameters[P_NEXT]), sizeof(buf));
|
||||||
rps_nowrap(out, buf);
|
rps_nowrap(out, buf);
|
||||||
newline(out);
|
newline(out);
|
||||||
fstream_done(&strm);
|
fstream_done(&strm);
|
||||||
|
|
|
@ -266,14 +266,14 @@ report_item(const unit * owner, const item * i, const faction * viewer,
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ORDERS_IN_NR 1
|
#define ORDERS_IN_NR 1
|
||||||
static size_t buforder(char *buffer, size_t size, const order * ord, int mode)
|
static size_t buforder(char *buffer, size_t size, const order * ord, const struct locale *lang, int mode)
|
||||||
{
|
{
|
||||||
char *bufp = buffer;
|
char *bufp = buffer;
|
||||||
|
|
||||||
bufp = STRLCPY(bufp, ", \"", size);
|
bufp = STRLCPY(bufp, ", \"", size);
|
||||||
if (mode < ORDERS_IN_NR) {
|
if (mode < ORDERS_IN_NR) {
|
||||||
char cmd[ORDERSIZE];
|
char cmd[ORDERSIZE];
|
||||||
get_command(ord, cmd, sizeof(cmd));
|
get_command(ord, lang, cmd, sizeof(cmd));
|
||||||
bufp = STRLCPY(bufp, cmd, size);
|
bufp = STRLCPY(bufp, cmd, size);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -498,6 +498,7 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
|
||||||
char *bufp = buf;
|
char *bufp = buf;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
item results[MAX_INVENTORY];
|
item results[MAX_INVENTORY];
|
||||||
|
const struct locale *lang = f->locale;
|
||||||
|
|
||||||
assert(f);
|
assert(f);
|
||||||
bufp = STRLCPY(bufp, unitname(u), size);
|
bufp = STRLCPY(bufp, unitname(u), size);
|
||||||
|
@ -514,7 +515,7 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
|
||||||
}
|
}
|
||||||
if (getarnt) {
|
if (getarnt) {
|
||||||
bufp = STRLCPY(bufp, ", ", size);
|
bufp = STRLCPY(bufp, ", ", size);
|
||||||
bufp = STRLCPY(bufp, LOC(f->locale, "anonymous"), size);
|
bufp = STRLCPY(bufp, LOC(lang, "anonymous"), size);
|
||||||
}
|
}
|
||||||
else if (u->attribs) {
|
else if (u->attribs) {
|
||||||
faction *otherf = get_otherfaction(u);
|
faction *otherf = get_otherfaction(u);
|
||||||
|
@ -527,7 +528,7 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
|
||||||
else {
|
else {
|
||||||
if (getarnt) {
|
if (getarnt) {
|
||||||
bufp = STRLCPY(bufp, ", ", size);
|
bufp = STRLCPY(bufp, ", ", size);
|
||||||
bufp = STRLCPY(bufp, LOC(f->locale, "anonymous"), size);
|
bufp = STRLCPY(bufp, LOC(lang, "anonymous"), size);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (u->attribs && alliedunit(u, f, HELP_FSTEALTH)) {
|
if (u->attribs && alliedunit(u, f, HELP_FSTEALTH)) {
|
||||||
|
@ -562,7 +563,7 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
|
||||||
bufp = STRLCPY(bufp, pzTmp, size);
|
bufp = STRLCPY(bufp, pzTmp, size);
|
||||||
if (u->faction == f && fval(u_race(u), RCF_SHAPESHIFTANY)) {
|
if (u->faction == f && fval(u_race(u), RCF_SHAPESHIFTANY)) {
|
||||||
bufp = STRLCPY(bufp, " (", size);
|
bufp = STRLCPY(bufp, " (", size);
|
||||||
bufp = STRLCPY(bufp, racename(f->locale, u, u_race(u)), size);
|
bufp = STRLCPY(bufp, racename(lang, u, u_race(u)), size);
|
||||||
if (size > 1) {
|
if (size > 1) {
|
||||||
strcpy(bufp++, ")");
|
strcpy(bufp++, ")");
|
||||||
--size;
|
--size;
|
||||||
|
@ -571,10 +572,10 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const race *irace = u_irace(u);
|
const race *irace = u_irace(u);
|
||||||
bufp = STRLCPY(bufp, racename(f->locale, u, irace), size);
|
bufp = STRLCPY(bufp, racename(lang, u, irace), size);
|
||||||
if (u->faction == f && irace != u_race(u)) {
|
if (u->faction == f && irace != u_race(u)) {
|
||||||
bufp = STRLCPY(bufp, " (", size);
|
bufp = STRLCPY(bufp, " (", size);
|
||||||
bufp = STRLCPY(bufp, racename(f->locale, u, u_race(u)), size);
|
bufp = STRLCPY(bufp, racename(lang, u, u_race(u)), size);
|
||||||
if (size > 1) {
|
if (size > 1) {
|
||||||
strcpy(bufp++, ")");
|
strcpy(bufp++, ")");
|
||||||
--size;
|
--size;
|
||||||
|
@ -584,15 +585,15 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
|
||||||
|
|
||||||
if (fval(u, UFL_HERO) && (u->faction == f || omniscient(f))) {
|
if (fval(u, UFL_HERO) && (u->faction == f || omniscient(f))) {
|
||||||
bufp = STRLCPY(bufp, ", ", size);
|
bufp = STRLCPY(bufp, ", ", size);
|
||||||
bufp = STRLCPY(bufp, LOC(f->locale, "hero"), size);
|
bufp = STRLCPY(bufp, LOC(lang, "hero"), size);
|
||||||
}
|
}
|
||||||
/* status */
|
/* status */
|
||||||
|
|
||||||
if (u->number && (u->faction == f || isbattle)) {
|
if (u->number && (u->faction == f || isbattle)) {
|
||||||
const char *c = hp_status(u);
|
const char *c = hp_status(u);
|
||||||
c = c ? LOC(f->locale, c) : 0;
|
c = c ? LOC(lang, c) : 0;
|
||||||
bufp = STRLCPY(bufp, ", ", size);
|
bufp = STRLCPY(bufp, ", ", size);
|
||||||
bufp += report_status(u, f->locale, bufp, size);
|
bufp += report_status(u, lang, bufp, size);
|
||||||
if (c || fval(u, UFL_HUNGER)) {
|
if (c || fval(u, UFL_HUNGER)) {
|
||||||
bufp = STRLCPY(bufp, " (", size);
|
bufp = STRLCPY(bufp, " (", size);
|
||||||
if (c) {
|
if (c) {
|
||||||
|
@ -602,7 +603,7 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
|
||||||
if (c) {
|
if (c) {
|
||||||
bufp = STRLCPY(bufp, ", ", size);
|
bufp = STRLCPY(bufp, ", ", size);
|
||||||
}
|
}
|
||||||
bufp = STRLCPY(bufp, LOC(f->locale, "unit_hungers"), size);
|
bufp = STRLCPY(bufp, LOC(lang, "unit_hungers"), size);
|
||||||
}
|
}
|
||||||
if (size > 1) {
|
if (size > 1) {
|
||||||
strcpy(bufp++, ")");
|
strcpy(bufp++, ")");
|
||||||
|
@ -612,7 +613,7 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
|
||||||
}
|
}
|
||||||
if (is_guard(u)) {
|
if (is_guard(u)) {
|
||||||
bufp = STRLCPY(bufp, ", ", size);
|
bufp = STRLCPY(bufp, ", ", size);
|
||||||
bufp = STRLCPY(bufp, LOC(f->locale, "unit_guards"), size);
|
bufp = STRLCPY(bufp, LOC(lang, "unit_guards"), size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((b = usiege(u)) != NULL) {
|
if ((b = usiege(u)) != NULL) {
|
||||||
|
@ -624,7 +625,7 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
|
||||||
if (u->faction == f) {
|
if (u->faction == f) {
|
||||||
skill *sv;
|
skill *sv;
|
||||||
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
|
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
|
||||||
size_t bytes = spskill(bufp, size, f->locale, u, sv, &dh, 1);
|
size_t bytes = spskill(bufp, size, lang, u, sv, &dh, 1);
|
||||||
assert(bytes <= INT_MAX);
|
assert(bytes <= INT_MAX);
|
||||||
if (wrptr(&bufp, &size, (int)bytes) != 0)
|
if (wrptr(&bufp, &size, (int)bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
|
@ -651,7 +652,7 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
|
||||||
bufp = STRLCPY(bufp, ", ", size);
|
bufp = STRLCPY(bufp, ", ", size);
|
||||||
|
|
||||||
if (!dh) {
|
if (!dh) {
|
||||||
result = snprintf(bufp, size, "%s: ", LOC(f->locale, "nr_inventory"));
|
result = snprintf(bufp, size, "%s: ", LOC(lang, "nr_inventory"));
|
||||||
if (wrptr(&bufp, &size, result) != 0)
|
if (wrptr(&bufp, &size, result) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
dh = 1;
|
dh = 1;
|
||||||
|
@ -681,7 +682,7 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
|
||||||
if (sbe->level <= maxlevel) {
|
if (sbe->level <= maxlevel) {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if (!header) {
|
if (!header) {
|
||||||
result = snprintf(bufp, size, ", %s: ", LOC(f->locale, "nr_spells"));
|
result = snprintf(bufp, size, ", %s: ", LOC(lang, "nr_spells"));
|
||||||
header = 1;
|
header = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -691,7 +692,7 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
}
|
}
|
||||||
/* TODO: no need to deref the spellref here (spref->name is good) */
|
/* TODO: no need to deref the spellref here (spref->name is good) */
|
||||||
bufp = STRLCPY(bufp, spell_name(sbe->sp, f->locale), size);
|
bufp = STRLCPY(bufp, spell_name(sbe->sp, lang), size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -701,7 +702,7 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
|
||||||
}
|
}
|
||||||
if (i != MAXCOMBATSPELLS) {
|
if (i != MAXCOMBATSPELLS) {
|
||||||
int result =
|
int result =
|
||||||
snprintf(bufp, size, ", %s: ", LOC(f->locale, "nr_combatspells"));
|
snprintf(bufp, size, ", %s: ", LOC(lang, "nr_combatspells"));
|
||||||
if (wrptr(&bufp, &size, result) != 0)
|
if (wrptr(&bufp, &size, result) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
|
|
||||||
|
@ -717,7 +718,7 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
|
||||||
sp = get_combatspell(u, i);
|
sp = get_combatspell(u, i);
|
||||||
if (sp) {
|
if (sp) {
|
||||||
int sl = get_combatspelllevel(u, i);
|
int sl = get_combatspelllevel(u, i);
|
||||||
bufp = STRLCPY(bufp, spell_name(sp, u->faction->locale), size);
|
bufp = STRLCPY(bufp, spell_name(sp, lang), size);
|
||||||
if (sl > 0) {
|
if (sl > 0) {
|
||||||
result = snprintf(bufp, size, " (%d)", sl);
|
result = snprintf(bufp, size, " (%d)", sl);
|
||||||
if (wrptr(&bufp, &size, result) != 0)
|
if (wrptr(&bufp, &size, result) != 0)
|
||||||
|
@ -725,7 +726,7 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bufp = STRLCPY(bufp, LOC(f->locale, "nr_nospells"), size);
|
bufp = STRLCPY(bufp, LOC(lang, "nr_nospells"), size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -737,7 +738,7 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
|
||||||
keyword_t kwd = getkeyword(ord);
|
keyword_t kwd = getkeyword(ord);
|
||||||
if (is_repeated(kwd)) {
|
if (is_repeated(kwd)) {
|
||||||
if (printed < ORDERS_IN_NR) {
|
if (printed < ORDERS_IN_NR) {
|
||||||
int result = (int)buforder(bufp, size, ord, printed++);
|
int result = (int)buforder(bufp, size, ord, u->faction->locale, printed++);
|
||||||
if (wrptr(&bufp, &size, result) != 0)
|
if (wrptr(&bufp, &size, result) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
}
|
}
|
||||||
|
@ -750,7 +751,7 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
|
||||||
keyword_t kwd = getkeyword(ord);
|
keyword_t kwd = getkeyword(ord);
|
||||||
if (is_repeated(kwd)) {
|
if (is_repeated(kwd)) {
|
||||||
if (printed < ORDERS_IN_NR) {
|
if (printed < ORDERS_IN_NR) {
|
||||||
int result = (int)buforder(bufp, size, ord, printed++);
|
int result = (int)buforder(bufp, size, ord, lang, printed++);
|
||||||
if (wrptr(&bufp, &size, result) != 0)
|
if (wrptr(&bufp, &size, result) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
}
|
}
|
||||||
|
@ -762,7 +763,7 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
|
||||||
}
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
str = u_description(u, f->locale);
|
str = u_description(u, lang);
|
||||||
if (str) {
|
if (str) {
|
||||||
bufp = STRLCPY(bufp, "; ", size);
|
bufp = STRLCPY(bufp, "; ", size);
|
||||||
bufp = STRLCPY(bufp, str, size);
|
bufp = STRLCPY(bufp, str, size);
|
||||||
|
@ -1980,13 +1981,15 @@ static void eval_race(struct opstack **stack, const void *userdata)
|
||||||
|
|
||||||
static void eval_order(struct opstack **stack, const void *userdata)
|
static void eval_order(struct opstack **stack, const void *userdata)
|
||||||
{ /* order -> string */
|
{ /* order -> string */
|
||||||
|
const faction *f = (const faction *)userdata;
|
||||||
const struct order *ord = (const struct order *)opop(stack).v;
|
const struct order *ord = (const struct order *)opop(stack).v;
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
size_t len;
|
size_t len;
|
||||||
variant var;
|
variant var;
|
||||||
|
const struct locale *lang = f ? f->locale : default_locale;
|
||||||
|
|
||||||
UNUSED_ARG(userdata);
|
UNUSED_ARG(userdata);
|
||||||
write_order(ord, buf, sizeof(buf));
|
write_order(ord, lang, buf, sizeof(buf));
|
||||||
len = strlen(buf);
|
len = strlen(buf);
|
||||||
var.v = strcpy(balloc(len + 1), buf);
|
var.v = strcpy(balloc(len + 1), buf);
|
||||||
opush(stack, var);
|
opush(stack, var);
|
||||||
|
@ -1994,8 +1997,8 @@ static void eval_order(struct opstack **stack, const void *userdata)
|
||||||
|
|
||||||
static void eval_resources(struct opstack **stack, const void *userdata)
|
static void eval_resources(struct opstack **stack, const void *userdata)
|
||||||
{ /* order -> string */
|
{ /* order -> string */
|
||||||
const faction *report = (const faction *)userdata;
|
const faction *f = (const faction *)userdata;
|
||||||
const struct locale *lang = report ? report->locale : default_locale;
|
const struct locale *lang = f ? f->locale : default_locale;
|
||||||
const struct resource *res = (const struct resource *)opop(stack).v;
|
const struct resource *res = (const struct resource *)opop(stack).v;
|
||||||
char buf[1024]; /* but we only use about half of this */
|
char buf[1024]; /* but we only use about half of this */
|
||||||
size_t size = sizeof(buf) - 1;
|
size_t size = sizeof(buf) - 1;
|
||||||
|
|
Loading…
Reference in a new issue