CR 55 - bugfix pluralitems

This commit is contained in:
Enno Rehling 2001-02-17 15:52:47 +00:00
parent 9f5820fdfe
commit a6fdf6779c
4 changed files with 17 additions and 17 deletions

View File

@ -1,6 +1,6 @@
/* vi: set ts=2:
*
* $Id: creport.c,v 1.7 2001/02/11 20:54:00 enno Exp $
* $Id: creport.c,v 1.8 2001/02/17 15:52:46 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
@ -64,7 +64,7 @@
#include <stdlib.h>
#include <string.h>
#define C_REPORT_VERSION 54
#define C_REPORT_VERSION 55
#define NEWBLOCKS (C_REPORT_VERSION>=35)
#define ENCODE_SPECIAL 1
@ -154,7 +154,7 @@ render_message(FILE * f, faction * receiver, message * m)
for (i=0;i!=mt->argc;++i) {
switch (e->type) {
case IT_RESOURCE:
fprintf(f, "\"%s\";%s\n", resname((resource_t)m->data[i], 1), e->name);
fprintf(f, "\"%s\";%s\n", resname((resource_t)m->data[i], 0), e->name);
break;
case IT_RESOURCETYPE:
fprintf(f, "\"%s\";%s\n", locale_string(receiver->locale, resourcename((const resource_type *)m->data[i], 1)), e->name);
@ -532,13 +532,13 @@ cr_output_unit(FILE * F, region * r,
item * ishow;
const char * ic;
int in;
report_item(u, itm, f, NULL, &ic, &in);
report_item(u, itm, f, NULL, &ic, &in, true);
if (in>0 && ic && *ic) {
for (ishow = show; ishow; ishow=ishow->next) {
const char * sc;
int sn;
if (ishow->type==itm->type) sc=ic;
else report_item(u, ishow, f, NULL, &sc, &sn);
else report_item(u, ishow, f, NULL, &sc, &sn, true);
if (sc==ic || strcmp(sc, ic)==0) {
ishow->number+=itm->number;
break;
@ -558,7 +558,7 @@ cr_output_unit(FILE * F, region * r,
const char * ic;
int in;
assert(itm->type!=lasttype || !"error: list contains two objects of the same item");
report_item(u, itm, f, NULL, &ic, &in);
report_item(u, itm, f, NULL, &ic, &in, true);
if (in==0) continue;
if (!pr) {
pr = 1;

View File

@ -1,6 +1,6 @@
/* vi: set ts=2:
*
* $Id: reports.c,v 1.4 2001/02/09 13:53:52 corwin Exp $
* $Id: reports.c,v 1.5 2001/02/17 15:52:47 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
@ -131,10 +131,10 @@ hp_status(const unit * u)
}
void
report_item(const unit * owner, const item * i, const faction * viewer, const char ** name, const char ** basename, int * number)
report_item(const unit * owner, const item * i, const faction * viewer, const char ** name, const char ** basename, int * number, boolean singular)
{
if (owner->faction == viewer) {
if (name) *name = locale_string(viewer->locale, resourcename(i->type->rtype, ((i->number!=1)?GR_PLURAL:0)));
if (name) *name = locale_string(viewer->locale, resourcename(i->type->rtype, ((i->number!=1 && !singular)?GR_PLURAL:0)));
if (basename) *basename = resourcename(i->type->rtype, 0);
if (number) *number = i->number;
} else if (i->type->rtype==r_silver) {
@ -155,7 +155,7 @@ report_item(const unit * owner, const item * i, const faction * viewer, const ch
if (basename) *basename = NULL;
}
} else {
if (name) *name = locale_string(viewer->locale, resourcename(i->type->rtype, NMF_APPEARANCE|((i->number!=1)?GR_PLURAL:0)));
if (name) *name = locale_string(viewer->locale, resourcename(i->type->rtype, NMF_APPEARANCE|((i->number!=1 && !singular)?GR_PLURAL:0)));
if (basename) *basename = resourcename(i->type->rtype, NMF_APPEARANCE);
if (number) {
const herb_type * htype = resource2herb(i->type->rtype);
@ -274,13 +274,13 @@ bufunit(const faction * f, const unit * u, int indent,
item * ishow;
const char * ic;
int in;
report_item(u, itm, f, NULL, &ic, &in);
report_item(u, itm, f, NULL, &ic, &in, false);
if (ic && *ic && in>0) {
for (ishow = show; ishow; ishow=ishow->next) {
const char * sc;
int sn;
if (ishow->type==itm->type) sc=ic;
else report_item(u, ishow, f, NULL, &sc, &sn);
else report_item(u, ishow, f, NULL, &sc, &sn, false);
if (sc==ic || strcmp(sc, ic)==0) {
ishow->number+=itm->number;
break;
@ -298,7 +298,7 @@ bufunit(const faction * f, const unit * u, int indent,
for (itm=show; itm; itm=itm->next) {
const char * ic;
int in;
report_item(u, itm, f, &ic, NULL, &in);
report_item(u, itm, f, &ic, NULL, &in, false);
if (in==0 || ic==NULL) continue;
scat(", ");

View File

@ -1,6 +1,6 @@
/* vi: set ts=2:
*
* $Id: reports.h,v 1.3 2001/02/05 16:11:58 enno Exp $
* $Id: reports.h,v 1.4 2001/02/17 15:52:47 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
@ -105,7 +105,7 @@ extern int seasons;
extern int weeks_per_month;
extern int months_per_year;
extern void report_item(const struct unit * owner, const struct item * i, const struct faction * viewer, const char ** name, const char ** basename, int * number);
extern void report_item(const struct unit * owner, const struct item * i, const struct faction * viewer, const char ** name, const char ** basename, int * number, boolean singular);
extern void report_building(FILE *F, const struct region * r, const struct building * b, const struct faction * f, int mode);
extern int bufunit(const struct faction * f, const struct unit * u, int indent, int mode);

View File

@ -1,6 +1,6 @@
/* vi: set ts=2:
*
* $Id: umlaut.c,v 1.6 2001/02/17 15:02:50 enno Exp $
* $Id: umlaut.c,v 1.7 2001/02/17 15:52:47 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
@ -87,7 +87,7 @@ addtoken(tnode * root, const char* str, void * id)
next=ref;
} else {
next->node->flags |= SHARED;
if (next->node->flags & LEAF == 0) next->node->id = NULL;
if ((next->node->flags & LEAF) == 0) next->node->id = NULL;
}
addtoken(next->node, str+1, id);
while (replace[i].str) {