BUG 2443: Straßen ohne komplizierte String-Bastelei.

This commit is contained in:
Enno Rehling 2018-06-11 20:42:28 +02:00
parent 1f5a31b817
commit a62541a17e
8 changed files with 34 additions and 55 deletions

View File

@ -698,10 +698,16 @@
<arg name="faction" type="faction"/>
</type>
</message>
<message name="nr_borderlist_postfix" section="nr">
<message name="nr_border_transparent" section="nr">
<type>
<arg name="transparent" type="int"/>
<arg name="object" type="string"/>
<arg name="dir" type="direction"/>
</type>
</message>
<message name="nr_border_opaque" section="nr">
<type>
<arg name="object" type="string"/>
<arg name="dir" type="direction"/>
</type>
</message>
<message name="nr_building_besieged" section="nr">

View File

@ -1355,8 +1355,11 @@ msgstr "\"Es herrscht eine fröhliche und ausgelassene Stimmung. ($int36($id))\"
msgid "buildroad"
msgstr "\"$unit($unit) erweitert in $region($region) das Straßennetz um $int($size).\""
msgid "nr_borderlist_postfix"
msgstr "\"$if($transparent,\" befindet sich\",\" versperrt\") ${object}$if($transparent,\"\",\" die Sicht\").\""
msgid "nr_border_opaque"
msgstr "Im $direction($dir) verperrt ${object} die Sicht."
msgid "nr_border_transparent"
msgstr "Im $direction($dir) befindet sich ${object}."
msgid "effectstrength"
msgstr "\"$unit($mage) erhöht die Körperkraft von $unit.dative($target) beträchtlich.\""

View File

@ -1355,8 +1355,11 @@ msgstr "\"Everyone in this region seems to be having a very good time. ($int36($
msgid "buildroad"
msgstr "\"$unit($unit) extends the road network in $region($region) by $int($size).\""
msgid "nr_borderlist_postfix"
msgstr "\"$if($transparent,\" there is\",\" sight is blocked by \") ${object}.\""
msgid "nr_border_opaque"
msgstr "To the $direction($dir), ${object} is blocking the view."
msgid "nr_border_transparent"
msgstr "To the $direction($dir) is ${object}."
msgid "effectstrength"
msgstr "\"$unit($mage) increases the strength of $unit($target) dramatically.\""

View File

@ -1906,9 +1906,6 @@ msgstr "Mallorn"
msgid "castle"
msgstr "Burg"
msgid "nr_borderlist_infix"
msgstr ", im "
msgctxt "race"
msgid "shadowbat_p"
msgstr "Todesflattern"
@ -3706,9 +3703,6 @@ msgctxt "spell"
msgid "analyse_object"
msgstr "Lied des Ortes analysieren"
msgid "nr_borderlist_lastfix"
msgstr "und im "
msgctxt "race"
msgid "shadowknight_d"
msgstr "Schattenrittern"

View File

@ -1642,9 +1642,6 @@ msgstr "mallorn"
msgid "castle"
msgstr "castle"
msgid "nr_borderlist_infix"
msgstr ", to the "
msgctxt "race"
msgid "shadowbat_p"
msgstr "darkbats"
@ -3261,9 +3258,6 @@ msgctxt "spell"
msgid "analyse_object"
msgstr "Analysis"
msgid "nr_borderlist_lastfix"
msgstr ", and to the "
msgctxt "race"
msgid "shadowknight_d"
msgstr "shadow knights"

View File

@ -188,7 +188,7 @@ border_type *find_bordertype(const char *name)
{
border_type *bt = bordertypes;
while (bt && strcmp(bt->__name, name)!=0)
while (bt && strcmp(bt->_name, name)!=0)
bt = bt->next;
return bt;
}
@ -563,7 +563,7 @@ void write_borders(struct storage *store)
for (b = bhash; b != NULL; b = b->next) {
if (b->type->valid && !b->type->valid(b))
continue;
WRITE_TOK(store, b->type->__name);
WRITE_TOK(store, b->type->_name);
WRITE_INT(store, b->id);
WRITE_INT(store, b->from->uid);
WRITE_INT(store, b->to->uid);
@ -614,7 +614,7 @@ int read_borders(gamedata *data)
if (to == from && from) {
direction_t dir = (direction_t)(rng_int() % MAXDIRECTIONS);
region *r = rconnect(from, dir);
log_error("[read_borders] invalid %s in %s\n", type->__name, regionname(from, NULL));
log_error("[read_borders] invalid %s in %s\n", type->_name, regionname(from, NULL));
if (r != NULL)
to = r;
}
@ -633,5 +633,5 @@ int read_borders(gamedata *data)
}
const char * border_name(const connection *co, const struct region * r, const struct faction * f, int flags) {
return (co->type->name) ? co->type->name(co, r, f, flags) : co->type->__name;
return (co->type->name) ? co->type->name(co, r, f, flags) : co->type->_name;
}

View File

@ -45,7 +45,7 @@ extern "C" {
} connection;
typedef struct border_type {
const char *__name; /* internal use only */
const char *_name; /* internal use only */
variant_type datatype;
bool(*transparent) (const connection *, const struct faction *);
/* is it possible to see through this? */

View File

@ -769,11 +769,11 @@ static void rp_battles(struct stream *out, faction * f)
while (bm) {
char buf[256];
RENDER(f, buf, sizeof(buf), ("header_battle", "region", bm->r));
newline(out);
centre(out, buf, true);
newline(out);
rp_messages(out, bm->msgs, f, 0, false);
bm = bm->next;
newline(out);
}
}
}
@ -1237,39 +1237,17 @@ void report_region(struct stream *out, const region * r, faction * f)
if (edges)
newline(out);
for (e = edges; e; e = e->next) {
bool first = true;
message *msg;
bufp = buf;
size = sizeof(buf) - 1;
for (d = 0; d != MAXDIRECTIONS; ++d) {
if (!e->exist[d])
continue;
/* this localization might not work for every language but is fine for de and en */
if (first)
bytes = (int)str_strlcpy(bufp, LOC(f->locale, "nr_borderlist_prefix"), size);
else if (e->lastd == d)
bytes = (int)str_strlcpy(bufp, LOC(f->locale, "nr_borderlist_lastfix"), size);
else
bytes = (int)str_strlcpy(bufp, LOC(f->locale, "nr_borderlist_infix"), size);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
bytes = (int)str_strlcpy(bufp, LOC(f->locale, directions[d]), size);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
first = false;
if (e->exist[d]) {
msg = msg_message(e->transparent ? "nr_border_transparent" : "nr_border_opaque",
"object dir", e->name, d);
nr_render(msg, f->locale, buf, sizeof(buf), f);
msg_release(msg);
paragraph(out, buf, 0, 0, 0);
}
}
/* TODO name is localized? Works for roads anyway... */
/* TODO: creating messages during reporting makes them not show up in CR? */
msg = msg_message("nr_borderlist_postfix", "transparent object",
e->transparent, e->name);
bytes = (int)nr_render(msg, f->locale, bufp, size, f);
msg_release(msg);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
*bufp = 0;
paragraph(out, buf, 0, 0, 0);
}
if (edges) {
while (edges) {
@ -1299,7 +1277,6 @@ static void statistics(struct stream *out, const region * r, const faction * f)
}
}
/* print */
newline(out);
m = msg_message("nr_stat_header", "region", r);
nr_render(m, f->locale, buf, sizeof(buf), f);
msg_release(m);
@ -2305,8 +2282,10 @@ report_plaintext(const char *filename, report_context * ctx,
report_travelthru(out, r, f);
}
if (wants_stats && r->seen.mode >= seen_unit)
if (wants_stats && r->seen.mode >= seen_unit) {
statistics(out, r, f);
newline(out);
}
/* Nachrichten an REGION in der Region */
if (r->seen.mode >= seen_travel) {