forked from github/server
fixing "regions" message in CR.
This commit is contained in:
parent
5090303bbe
commit
bda9885774
2 changed files with 28 additions and 26 deletions
|
@ -429,16 +429,18 @@ cr_resources(variant var, char * buffer, const void * userdata)
|
|||
static int
|
||||
cr_regions(variant var, char * buffer, const void * userdata)
|
||||
{
|
||||
faction * f = (faction*)userdata;
|
||||
const arg_regions * rdata = (const arg_regions *)var.v;
|
||||
char * wp = buffer;
|
||||
|
||||
if (rdata!=NULL && rdata->nregions>0) {
|
||||
region * r = rdata->regions[0];
|
||||
int i, z = r->planep?r->planep->id:0;
|
||||
wp += sprintf(wp, "\"%d %d %d", r->x, r->y, z);
|
||||
wp += sprintf(wp, "\"%d %d %d", region_x(r, f), region_y(r, f), z);
|
||||
for (i=1;i!=rdata->nregions;++i) {
|
||||
r = rdata->regions[i];
|
||||
z = r->planep?r->planep->id:0;
|
||||
wp += sprintf(wp, ", %d %d %d", r->x, r->y, z);
|
||||
wp += sprintf(wp, ", %d %d %d", region_x(r, f), region_y(r, f), z);
|
||||
}
|
||||
strcat(wp, "\"");
|
||||
}
|
||||
|
|
|
@ -424,32 +424,32 @@ border_type bt_questportal = {
|
|||
static const char *
|
||||
b_nameroad(const border * b, const region * r, const struct faction * f, int gflags)
|
||||
{
|
||||
region * r2 = (r==b->to)?b->from:b->to;
|
||||
int local = (r==b->from)?b->data.sa[0]:b->data.sa[1];
|
||||
static char buffer[64];
|
||||
region * r2 = (r==b->to)?b->from:b->to;
|
||||
int local = (r==b->from)?b->data.sa[0]:b->data.sa[1];
|
||||
static char buffer[64];
|
||||
|
||||
unused(f);
|
||||
if (gflags & GF_ARTICLE) {
|
||||
if (!(gflags & GF_DETAILED)) return LOC(f->locale, "nr_a_road");
|
||||
else if (r->terrain->max_road<=local) {
|
||||
unused(f);
|
||||
if (gflags & GF_ARTICLE) {
|
||||
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) {
|
||||
return LOC(f->locale, "nr_a_road");
|
||||
} else {
|
||||
return LOC(f->locale, "nr_an_incomplete_road");
|
||||
}
|
||||
} else {
|
||||
int percent = max(1, 100*local/r->terrain->max_road);
|
||||
if (local) {
|
||||
sprintf(buffer, LOC(f->locale, "nr_road_percent"), percent);
|
||||
} else {
|
||||
return LOC(f->locale, "nr_a_road_connection");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (gflags & GF_PLURAL) return LOC(f->locale, "nr_roads");
|
||||
else return LOC(f->locale, "nr_road");
|
||||
return buffer;
|
||||
if (r2->terrain->max_road<=remote) {
|
||||
return LOC(f->locale, "nr_a_road");
|
||||
} else {
|
||||
return LOC(f->locale, "nr_an_incomplete_road");
|
||||
}
|
||||
} else {
|
||||
int percent = max(1, 100*local/r->terrain->max_road);
|
||||
if (local) {
|
||||
snprintf(buffer, sizeof(buffer), LOC(f->locale, "nr_road_percent"), percent);
|
||||
} else {
|
||||
return LOC(f->locale, "nr_a_road_connection");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (gflags & GF_PLURAL) return LOC(f->locale, "nr_roads");
|
||||
else return LOC(f->locale, "nr_road");
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue