Unicode QA:

- irritating comma in HELP status- 
- localized roads in NR
- new function for trails
- lua fix get_resource(horse)
This commit is contained in:
Enno Rehling 2007-08-28 06:19:31 +00:00
parent 9d8edd01bf
commit c3283925b6
8 changed files with 86 additions and 23 deletions

View file

@ -1331,7 +1331,6 @@ show_allies(FILE * F, const faction * f, const ally * allies, char * buf, size_t
break;
case HELP_MONEY:
p = P_MONEY;
hh = 1;
break;
case HELP_FIGHT:
p = P_FIGHT;

View file

@ -427,25 +427,25 @@ b_nameroad(const border * b, const region * r, const struct faction * f, int gfl
unused(f);
if (gflags & GF_ARTICLE) {
if (!(gflags & GF_DETAILED)) strcpy(buffer, "eine Straße");
if (!(gflags & GF_DETAILED)) return LOC(f->locale, "nr_a_road");
else if (r->terrain->max_road<=local) {
int remote = (r2==b->from)?b->data.sa[0]:b->data.sa[1];
if (r2->terrain->max_road<=remote) {
strcpy(buffer, "eine Straße");
return LOC(f->locale, "nr_a_road");
} else {
strcpy(buffer, "eine unvollständige Straße");
return LOC(f->locale, "nr_an_incomplete_road");
}
} else {
int percent = max(1, 100*local/r->terrain->max_road);
if (local) {
sprintf(buffer, "eine zu %d%% vollendete Straße", percent);
sprintf(buffer, LOC(f->locale, "nr_road_percent"), percent);
} else {
strcpy(buffer, "ein Straßenanschluß");
return LOC(f->locale, "nr_a_road_connection");
}
}
}
else if (gflags & GF_PLURAL) return "Straßen";
else return "Straße";
else if (gflags & GF_PLURAL) return LOC(f->locale, "nr_roads");
else return LOC(f->locale, "nr_road");
return buffer;
}

View file

@ -1504,7 +1504,7 @@ travel_route(unit * u, region_list * route_begin, region_list * route_end, order
if (mode!=TRAVEL_TRANSPORTED) {
ADDMSG(&u->faction->msgs, msg_message("travel",
"unit mode start end regions", u, walkmode, r, current, route_begin));
"unit mode start end regions", u, walkmode, r, current, route_begin->next?route_begin:NULL));
}
mark_travelthru(u, r, route_begin, iroute);

View file

@ -1615,8 +1615,8 @@ eval_localize(struct opstack ** stack, const void * userdata) /* (string, locale
opush_v(stack, strcpy(balloc(strlen(c)+1), c));
}
static void
eval_trail(struct opstack ** stack, const void * userdata) /* (int, int) -> int */
static void
eval_trailto(struct opstack ** stack, const void * userdata) /* (int, int) -> int */
{
const struct faction * f = (const struct faction *)userdata;
const struct locale * lang = f?f->locale:default_locale;
@ -1930,6 +1930,36 @@ eval_regions(struct opstack ** stack, const void * userdata) /* order -> string
opush(stack, var);
}
static void
eval_trail(struct opstack ** stack, const void * userdata) /* order -> string */
{
const faction * report = (const faction*)userdata;
int i, end = 0, begin = 0;
const arg_regions * regions = (const arg_regions *)opop(stack).v;
static char buf[256];
variant var;
char * edit = buf;
if (regions!=NULL) {
end = regions->nregions-1;
for (i=begin;i<end;++i) {
region * r = regions->regions[i];
const char * trail = trailinto(r, report->locale);
const char * rn = f_regionid_s(r, report);
edit += snprintf(edit, sizeof(buf)-(edit-buf), trail, rn);
if (i+2<end) {
edit += strlcpy(edit, ", ", sizeof(buf)-(edit-buf));
} else if (i+1<end) {
edit += strlcpy(edit, LOC(report->locale, "list_and"), sizeof(buf)-(edit-buf));
}
}
}
buf[sizeof(buf)-1] = 0;
var.v = strcpy(balloc(edit-buf+1), buf);
opush(stack, var);
}
static void
eval_direction(struct opstack ** stack, const void * userdata)
{
@ -2012,12 +2042,13 @@ reports_init(void)
add_function("order", &eval_order);
add_function("direction", &eval_direction);
add_function("int36", &eval_int36);
add_function("trail", &eval_trail);
add_function("trailto", &eval_trailto);
add_function("localize", &eval_localize);
add_function("spell", &eval_spell);
add_function("curse", &eval_curse);
add_function("resources", &eval_resources);
add_function("regions", &eval_regions);
add_function("trail", &eval_trail);
/* register alternative visibility functions */
register_function((pf_generic)view_neighbours, "view_neighbours");

View file

@ -1341,8 +1341,9 @@ create_unit(region * r, faction * f, int number, const struct race *urace, int i
/* erbt Gebäude/Schiff*/
if (creator->region==r) {
u->building = creator->building;
assert(creator->ship==NULL || fval(u->race, RCF_CANSAIL));
u->ship = creator->ship;
if (creator->ship!=NULL && fval(u->race, RCF_CANSAIL)) {
u->ship = creator->ship;
}
}
/* Tarnlimit wird vererbt */

View file

@ -148,6 +148,7 @@ region_getresource(const region& r, const char * type)
const resource_type * rtype = rt_find(type);
if (rtype!=NULL) {
if (rtype==rt_find("money")) return rmoney(&r);
if (rtype==rt_find("horse")) return rhorses(&r);
if (rtype==rt_find("peasant")) return rpeasants(&r);
} else {
if (strcmp(type, "seed")==0) return rtrees(&r, 0);
@ -165,7 +166,8 @@ region_setresource(region& r, const char * type, int value)
const resource_type * rtype = rt_find(type);
if (rtype!=NULL) {
if (rtype==rt_find("money")) rsetmoney(&r, value);
if (rtype==rt_find("peasant")) return rsetpeasants(&r, value);
else if (rtype==rt_find("peasant")) rsetpeasants(&r, value);
else if (rtype==rt_find("horse")) rsethorses(&r, value);
} else {
if (strcmp(type, "seed")==0) {
rsettrees(&r, 0, value);

View file

@ -7432,4 +7432,34 @@
<text locale="en">Owner</text>
</string>
<string name="nr_a_road">
<text locale="de">eine Straße</text>
<text locale="en">a road</text>
</string>
<string name="nr_roads">
<text locale="de">Straßen</text>
<text locale="en">roads</text>
</string>
<string name="nr_road">
<text locale="de">Straße</text>
<text locale="en">road</text>
</string>
<string name="nr_road_percent">
<text locale="de">eine zu %d%% vollendete Straße</text>
<text locale="en">a road that is %d%% complete</text>
</string>
<string name="nr_a_road_connection">
<text locale="de">ein Straßenanschluß</text>
<text locale="en">a connection to another road</text>
</string>
<string name="nr_an_incomplete_road">
<text locale="de">eine unvollständige Straße</text>
<text locale="en">an incomplete road</text>
</string>
</strings>

View file

@ -714,8 +714,8 @@
<type>
<arg name="region" type="region"/>
</type>
<text locale="de">$trail($region)</text>
<text locale="en">$trail($region)</text>
<text locale="de">$trailto($region)</text>
<text locale="en">$trailto($region)</text>
</message>
<message name="nr_migrants" section="nr">
<type>
@ -813,8 +813,8 @@
<arg name="dir" type="int"/>
<arg name="region" type="region"/>
</type>
<text locale="de">"Im $direction($dir) der Region liegt $trail($region)"</text>
<text locale="en">"To the $direction($dir) lies $trail($region)"</text>
<text locale="de">"Im $direction($dir) der Region liegt $trailto($region)"</text>
<text locale="en">"To the $direction($dir) lies $trailto($region)"</text>
</message>
<message name="nr_market_price" section="nr">
<type>
@ -2819,9 +2819,9 @@
<arg name="end" type="region"/>
<arg name="regions" type="regions"/>
</type>
<text locale="de">"$unit($unit) $if($eq($mode,1),"reitet", "wandert") von $region($start) nach $region($end).$if($isnull($regions),""," Dabei wurde $regions($regions,1,-2) durchquert.")"</text>
<text locale="fr">"$unit($unit) $if($eq($mode,1),"chevauche", "marche") de $region($start) vers $region($end) trans $regions($regions,1,-2)"</text>
<text locale="en">"$unit($unit) $if($eq($mode,1),"rides", "walks") from $region($start) to $region($end)$if($isnull($regions),""," by way of $regions($regions,1,-2)")."</text>
<text locale="de">"$unit($unit) $if($eq($mode,1),"reitet", "wandert") von $region($start) nach $region($end).$if($isnull($regions),""," Dabei wurde $trail($regions) durchquert.")"</text>
<text locale="fr">"$unit($unit) $if($eq($mode,1),"chevauche", "marche") de $region($start) vers $region($end) trans $trail($regions)"</text>
<text locale="en">"$unit($unit) $if($eq($mode,1),"rides", "walks") from $region($start) to $region($end)$if($isnull($regions),""," by way of $trail($regions)")."</text>
</message>
<message name="detectoceandir" section="movement">
<type>
@ -7476,7 +7476,7 @@
<arg name="mage" type="unit"/>
<arg name="building" type="building"/>
</type>
<text locale="de">"Mit einem Ritual bindet $unit($unit) die magischen Kräfte der Erde in die Mauern von $building($building)."</text>
<text locale="de">"Mit einem Ritual bindet $unit($mage) die magischen Kräfte der Erde in die Mauern von $building($building)."</text>
</message>
<message name="blessedstonecircle_effect" section="magic">