Bugfix doppeldeutige Itemnamen

This commit is contained in:
Enno Rehling 2001-02-10 13:20:09 +00:00
parent 131e9c5eb3
commit 3f199d815a
4 changed files with 97 additions and 20 deletions

View File

@ -1,6 +1,6 @@
/* vi: set ts=2:
*
* $Id: eressea.h,v 1.13 2001/02/10 10:40:11 enno Exp $
* $Id: eressea.h,v 1.14 2001/02/10 13:20:09 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)
@ -130,6 +130,7 @@ struct herb_type;
#define GLOBAL_ATTRIB_VERSION 196
#define BASE36IDS_VERSION 197
#define NEWSOURCE_VERSION 197
#define NEWHASH_VERSION 198
#define LOCALE_VERSION 300 /* TODO */
/* globale settings des Spieles */
@ -140,8 +141,8 @@ typedef struct settings {
} settings;
extern settings global;
#define RELEASE_VERSION NEWSOURCE_VERSION
#define ECHECK_VERSION "3.9"
#define RELEASE_VERSION NEWHASH_VERSION
#define ECHECK_VERSION "3.10"
/* changes from->to: 72->73: struct unit::lock entfernt.
* 73->74: struct unit::flags eingeführt.

View File

@ -1,6 +1,6 @@
/* vi: set ts=2:
*
* $Id: item.c,v 1.6 2001/02/03 13:45:32 enno Exp $
* $Id: item.c,v 1.7 2001/02/10 13:20:09 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)
@ -373,6 +373,8 @@ it_find(const char * name)
for (itype=itemtypes; itype; itype=itype->next)
if (itype->rtype->hashkey==hash && strcmp(itype->rtype->_name[0], name) == 0) break;
if (!itype) for (itype=itemtypes; itype; itype=itype->next)
if (strcmp(itype->rtype->_name[1], name) == 0) break;
return itype;
}
@ -1193,6 +1195,38 @@ use_oldtypes(region * r, const resource_type * rtype, int norders)
}
}
typedef const char* translate_t[5];
static translate_t translation[] = {
{ "Holz", "log", "logs", "log", "logs" },
{ "Eisen", "iron", "irons", "iron", "irons" },
{ "Wagen", "cart", "carts", "cart", "carts" },
{ "Plattenpanzer", "plate", "plates", "plate", "plates" },
{ "Balsam", "balm", "balms", "balm", "balms" },
{ "Gewürz", "spice", "spices", "spice", "spices" },
{ "Myrrhe", "myrrh", "myrrhs", "myrrh", "myrrhs" },
{ "Öl", "oil", "oils", "oil", "oils" },
{ "Seide", "silk", "silks", "silk", "silks" },
{ "Weihrauch", "incense", "incenses", "incense", "incenses" },
{ "Bihänder", "greatsword", "greatswords", "greatsword", "greatswords" },
{ "Laen", "laen", "laens", "laen", "laens" },
{ "Goliathwasser", "p1", "p1s", NULL, NULL },
{ "Wasser des Lebens", "p2", "p2s", NULL, NULL },
{ "Bauernblut", "p5", "p5s", NULL, NULL },
{ "Gehirnschmalz", "p6", "p6s", NULL, NULL },
{ "Nestwärme", "p8", "p8s", NULL, NULL },
{ "Pferdeglück", "p9", "p9s", NULL, NULL },
{ "Berserkerblut", "p10", "p10s", NULL, NULL },
{ "Bauernlieb", "p11", "p11s", NULL, NULL },
{ "Heiltrank", "p14", "p14s", NULL, NULL },
{ "Flachwurz", "h0", "h0s", NULL, NULL },
{ "Elfenlieb", "h5", "h5s", NULL, NULL },
{ "Wasserfinder", "h9", "h9s", NULL, NULL },
{ "Windbeutel", "h12", "h12s", NULL, NULL },
{ "Steinbeißer", "h15", "h15s", NULL, NULL },
{ NULL, NULL, NULL, NULL, NULL }
};
static void
init_olditems(void)
{
@ -1240,10 +1274,25 @@ init_olditems(void)
if (itemdata[i].flags & FL_ITEM_NOTINBAG) iflags |= ITF_BIG;
if (itemdata[i].typ == IS_LUXURY) iflags |= ITF_LUXURY;
if (itemdata[i].flags & FL_ITEM_ANIMAL) iflags |= ITF_ANIMAL;
name[0] = reverse_lookup(NULL, itemdata[i].name[0]);
name[1] = reverse_lookup(NULL, itemdata[i].name[1]);
appearance[0] = reverse_lookup(NULL, itemdata[i].name[2]);
appearance[1] = reverse_lookup(NULL, itemdata[i].name[3]);
name[0]=NULL;
{
int ci;
for (ci=0;translation[ci][0];++ci) {
if (!strcmp(translation[ci][0], itemdata[i].name[0])) {
name[0] = translation[ci][1];
name[1] = translation[ci][2];
appearance[0] = translation[ci][2];
appearance[1] = translation[ci][3];
}
}
}
if (name[0]==NULL) {
name[0] = reverse_lookup(NULL, itemdata[i].name[0]);
name[1] = reverse_lookup(NULL, itemdata[i].name[1]);
appearance[0] = reverse_lookup(NULL, itemdata[i].name[2]);
appearance[1] = reverse_lookup(NULL, itemdata[i].name[3]);
}
rtype = new_resourcetype(name, appearance, rflags);
itype = new_itemtype(rtype, iflags, weight, capacity, minskill, skill);
@ -1377,8 +1426,20 @@ init_oldherbs(void)
terrain_t t;
resource_type * rtype;
names[0] = reverse_lookup(NULL, herbdata[0][h]);
names[1] = reverse_lookup(NULL, herbdata[1][h]);
names[0] = NULL;
{
int ci;
for (ci=0;translation[ci][0];++ci) {
if (!strcmp(translation[ci][0], herbdata[0][h])) {
names[0] = translation[ci][1];
names[1] = translation[ci][2];
}
}
}
if (!names[0]) {
names[0] = reverse_lookup(NULL, herbdata[0][h]);
names[1] = reverse_lookup(NULL, herbdata[1][h]);
}
rtype = new_resourcetype(names, appearance, RTF_ITEM);
itype = new_itemtype(rtype, ITF_HERB, 0, 0, 0, NOSKILL);
@ -1765,8 +1826,20 @@ init_oldpotions(void)
con->maxsize = 1;
con->reqsize = 1;
names[0] = reverse_lookup(NULL, potionnames[0][p]);
names[1] = reverse_lookup(NULL, potionnames[1][p]);
names[0] = NULL;
{
int ci;
for (ci=0;translation[ci][0];++ci) {
if (!strcmp(translation[ci][0], potionnames[0][p])) {
names[0] = translation[ci][1];
names[1] = translation[ci][2];
}
}
}
if (!names[0]) {
names[0] = reverse_lookup(NULL, potionnames[0][p]);
names[1] = reverse_lookup(NULL, potionnames[1][p]);
}
rtype = new_resourcetype(names, appearance, RTF_ITEM);
if (p==P_FOOL) rtype->flags |= RTF_SNEAK;
@ -2071,7 +2144,10 @@ rt_read(FILE * F)
}
}
rt_register(rt);
assert(rt->hashkey==hash);
#ifndef NDEBUG
if (global.data_version >= NEWHASH_VERSION)
assert(rt->hashkey==hash);
#endif
return rt;
}

Binary file not shown.

View File

@ -1,6 +1,6 @@
/* vi: set ts=2:
*
* $Id: korrektur.c,v 1.17 2001/02/09 19:52:59 corwin Exp $
* $Id: korrektur.c,v 1.18 2001/02/10 13:20:09 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)
@ -1199,7 +1199,7 @@ fix_balsamfiasko(void)
}
#endif
int
static int
count_demand(const region *r)
{
struct demand *dmd;
@ -1208,7 +1208,7 @@ count_demand(const region *r)
return c;
}
void
static void
fix_demand_region(const region *r)
{
direction_t d;
@ -1237,13 +1237,13 @@ fix_demand_region(const region *r)
}
}
void
static void
fix_demand(void)
{
region *r;
for(r=regions; r; r=r->next) {
if(count_demand(r) != 7) fix_demand_region(r);
for (r=regions; r; r=r->next) if (r->land) {
if (count_demand(r) != 7) fix_demand_region(r);
}
}
@ -1314,7 +1314,7 @@ fix_allies(void) {
extern boolean enable_fuzzy;
#endif
void
static void
fix_icastles(void)
{
region * r;