forked from github/server
commit
f56bbd64c1
|
@ -27,6 +27,7 @@ ipch/
|
||||||
*~
|
*~
|
||||||
*.pyc
|
*.pyc
|
||||||
*.bak
|
*.bak
|
||||||
|
*.swp
|
||||||
bin/
|
bin/
|
||||||
build*/
|
build*/
|
||||||
*.log
|
*.log
|
||||||
|
|
Binary file not shown.
|
@ -1399,7 +1399,7 @@ static void cr_output_region(FILE * F, report_context * ctx, region * r)
|
||||||
fprintf(F, "%d;Bauern\n", rpeasants(r));
|
fprintf(F, "%d;Bauern\n", rpeasants(r));
|
||||||
fprintf(F, "%d;Pferde\n", rhorses(r));
|
fprintf(F, "%d;Pferde\n", rhorses(r));
|
||||||
|
|
||||||
if (r->seen.mode >= seen_unit) {
|
if (r->seen.mode >= seen_travel) {
|
||||||
if (rule_region_owners()) {
|
if (rule_region_owners()) {
|
||||||
faction *owner = region_get_owner(r);
|
faction *owner = region_get_owner(r);
|
||||||
if (owner) {
|
if (owner) {
|
||||||
|
|
76
src/report.c
76
src/report.c
|
@ -1160,26 +1160,14 @@ void report_region(struct stream *out, const region * r, faction * f)
|
||||||
|
|
||||||
static void statistics(struct stream *out, const region * r, const faction * f)
|
static void statistics(struct stream *out, const region * r, const faction * f)
|
||||||
{
|
{
|
||||||
const unit *u;
|
int p = rpeasants(r);
|
||||||
int number = 0, p = rpeasants(r);
|
|
||||||
message *m;
|
message *m;
|
||||||
item *itm, *items = NULL;
|
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
|
|
||||||
/* count */
|
|
||||||
for (u = r->units; u; u = u->next) {
|
|
||||||
if (u->faction == f && !fval(u_race(u), RCF_INVISIBLE)) {
|
|
||||||
for (itm = u->items; itm; itm = itm->next) {
|
|
||||||
i_change(&items, itm->type, itm->number);
|
|
||||||
}
|
|
||||||
number += u->number;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* print */
|
/* print */
|
||||||
m = msg_message("nr_stat_header", "region", r);
|
m = msg_message("nr_stat_header", "region", r);
|
||||||
nr_render(m, f->locale, buf, sizeof(buf), f);
|
nr_render(m, f->locale, buf, sizeof(buf), f);
|
||||||
msg_release(m);
|
msg_release(m);
|
||||||
newline(out);
|
|
||||||
paragraph(out, buf, 0, 0, 0);
|
paragraph(out, buf, 0, 0, 0);
|
||||||
newline(out);
|
newline(out);
|
||||||
|
|
||||||
|
@ -1211,6 +1199,21 @@ static void statistics(struct stream *out, const region * r, const faction * f)
|
||||||
paragraph(out, buf, 2, 2, 0);
|
paragraph(out, buf, 2, 2, 0);
|
||||||
msg_release(m);
|
msg_release(m);
|
||||||
|
|
||||||
|
if (r->land->ownership) {
|
||||||
|
m = msg_message("nr_stat_morale", "morale", region_get_morale(r));
|
||||||
|
nr_render(m, f->locale, buf, sizeof(buf), f);
|
||||||
|
paragraph(out, buf, 2, 2, 0);
|
||||||
|
msg_release(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* info about units */
|
||||||
|
if (r->seen.mode >= seen_unit) {
|
||||||
|
int number;
|
||||||
|
item *itm, *items = NULL;
|
||||||
|
unit *u;
|
||||||
|
|
||||||
if (!markets_module()) {
|
if (!markets_module()) {
|
||||||
if (buildingtype_exists(r, bt_find("caravan"), true)) {
|
if (buildingtype_exists(r, bt_find("caravan"), true)) {
|
||||||
m = msg_message("nr_stat_luxuries", "max", (p * 2) / TRADE_FRACTION);
|
m = msg_message("nr_stat_luxuries", "max", (p * 2) / TRADE_FRACTION);
|
||||||
|
@ -1223,28 +1226,28 @@ static void statistics(struct stream *out, const region * r, const faction * f)
|
||||||
msg_release(m);
|
msg_release(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r->land->ownership) {
|
/* count */
|
||||||
m = msg_message("nr_stat_morale", "morale", region_get_morale(r));
|
for (number = 0, u = r->units; u; u = u->next) {
|
||||||
nr_render(m, f->locale, buf, sizeof(buf), f);
|
if (u->faction == f && !fval(u_race(u), RCF_INVISIBLE)) {
|
||||||
paragraph(out, buf, 2, 2, 0);
|
for (itm = u->items; itm; itm = itm->next) {
|
||||||
msg_release(m);
|
i_change(&items, itm->type, itm->number);
|
||||||
|
}
|
||||||
|
number += u->number;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
m = msg_message("nr_stat_people", "max", number);
|
||||||
}
|
nr_render(m, f->locale, buf, sizeof(buf), f);
|
||||||
/* info about units */
|
|
||||||
|
|
||||||
m = msg_message("nr_stat_people", "max", number);
|
|
||||||
nr_render(m, f->locale, buf, sizeof(buf), f);
|
|
||||||
paragraph(out, buf, 2, 2, 0);
|
|
||||||
msg_release(m);
|
|
||||||
|
|
||||||
for (itm = items; itm; itm = itm->next) {
|
|
||||||
sprintf(buf, "%s: %d",
|
|
||||||
LOC(f->locale, resourcename(itm->type->rtype, GR_PLURAL)), itm->number);
|
|
||||||
paragraph(out, buf, 2, 2, 0);
|
paragraph(out, buf, 2, 2, 0);
|
||||||
|
msg_release(m);
|
||||||
|
|
||||||
|
for (itm = items; itm; itm = itm->next) {
|
||||||
|
sprintf(buf, "%s: %d",
|
||||||
|
LOC(f->locale, resourcename(itm->type->rtype, GR_PLURAL)), itm->number);
|
||||||
|
paragraph(out, buf, 2, 2, 0);
|
||||||
|
}
|
||||||
|
while (items)
|
||||||
|
i_free(i_remove(&items, items));
|
||||||
}
|
}
|
||||||
while (items)
|
|
||||||
i_free(i_remove(&items, items));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2170,10 +2173,13 @@ report_plaintext(const char *filename, report_context * ctx,
|
||||||
newline(out);
|
newline(out);
|
||||||
report_travelthru(out, r, f);
|
report_travelthru(out, r, f);
|
||||||
}
|
}
|
||||||
|
newline(out);
|
||||||
|
|
||||||
if (wants_stats && r->seen.mode >= seen_unit) {
|
if (wants_stats && r->seen.mode >= seen_travel) {
|
||||||
statistics(out, r, f);
|
if (r->land || r->seen.mode >= seen_unit) {
|
||||||
newline(out);
|
newline(out);
|
||||||
|
statistics(out, r, f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Nachrichten an REGION in der Region */
|
/* Nachrichten an REGION in der Region */
|
||||||
|
|
|
@ -15,14 +15,14 @@
|
||||||
#define ESCAPE_CHAR '\\'
|
#define ESCAPE_CHAR '\\'
|
||||||
#define MAXTOKENSIZE 8192
|
#define MAXTOKENSIZE 8192
|
||||||
|
|
||||||
typedef struct parser_state {
|
typedef struct parse_state {
|
||||||
const char *current_token;
|
const char *current_token;
|
||||||
struct parser_state *next;
|
struct parse_state *next;
|
||||||
void *data;
|
void *data;
|
||||||
void(*dtor)(void *);
|
void(*dtor)(void *);
|
||||||
} parser_state;
|
} parse_state;
|
||||||
|
|
||||||
static parser_state *states;
|
static parse_state *states;
|
||||||
|
|
||||||
static int eatwhitespace_c(const char **str_p)
|
static int eatwhitespace_c(const char **str_p)
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ static int eatwhitespace_c(const char **str_p)
|
||||||
void init_tokens_ex(const char *initstr, void *data, void (*dtor)(void *))
|
void init_tokens_ex(const char *initstr, void *data, void (*dtor)(void *))
|
||||||
{
|
{
|
||||||
if (states == NULL) {
|
if (states == NULL) {
|
||||||
states = calloc(1, sizeof(parser_state));
|
states = calloc(1, sizeof(parse_state));
|
||||||
if (!states) abort();
|
if (!states) abort();
|
||||||
}
|
}
|
||||||
else if (states->dtor) {
|
else if (states->dtor) {
|
||||||
|
@ -74,7 +74,7 @@ void init_tokens_str(const char *initstr) {
|
||||||
|
|
||||||
void parser_pushstate(void)
|
void parser_pushstate(void)
|
||||||
{
|
{
|
||||||
parser_state *new_state = calloc(1, sizeof(parser_state));
|
parse_state *new_state = calloc(1, sizeof(parse_state));
|
||||||
if (!new_state) abort();
|
if (!new_state) abort();
|
||||||
new_state->current_token = NULL;
|
new_state->current_token = NULL;
|
||||||
new_state->next = states;
|
new_state->next = states;
|
||||||
|
@ -83,7 +83,7 @@ void parser_pushstate(void)
|
||||||
|
|
||||||
void parser_popstate(void)
|
void parser_popstate(void)
|
||||||
{
|
{
|
||||||
parser_state *new_state = states->next;
|
parse_state *new_state = states->next;
|
||||||
if (states->dtor) {
|
if (states->dtor) {
|
||||||
states->dtor(states->data);
|
states->dtor(states->data);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue