From 32a3c0103fe124f37105bf01f39f9b11849cceca Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 24 Jun 2007 14:04:42 +0000 Subject: [PATCH] The synonym attribute was not in use, and relied on the old race_t type to idntify races. It is better to use racename-attributes for this, I think. --- src/common/attributes/Jamfile | 1 - src/common/attributes/attributes.c | 2 - src/common/attributes/synonym.c | 90 ------------------------------ src/common/attributes/synonym.h | 34 ----------- src/common/gamecode/laws.c | 48 ---------------- src/common/kernel/eressea.c | 1 - src/common/kernel/race.c | 16 +----- src/common/kernel/race.h | 6 -- src/common/kernel/types.h | 1 - 9 files changed, 1 insertion(+), 198 deletions(-) delete mode 100644 src/common/attributes/synonym.c delete mode 100644 src/common/attributes/synonym.h diff --git a/src/common/attributes/Jamfile b/src/common/attributes/Jamfile index 0b00f0379..b1a91e7b6 100644 --- a/src/common/attributes/Jamfile +++ b/src/common/attributes/Jamfile @@ -28,7 +28,6 @@ SOURCES = racename.c raceprefix.c reduceproduction.c - synonym.c targetregion.c viewrange.c variable.c diff --git a/src/common/attributes/attributes.c b/src/common/attributes/attributes.c index 582df283e..5c41bd548 100644 --- a/src/common/attributes/attributes.c +++ b/src/common/attributes/attributes.c @@ -31,7 +31,6 @@ #include "racename.h" #include "raceprefix.h" #include "reduceproduction.h" -#include "synonym.h" #include "targetregion.h" #include "variable.h" #ifdef AT_OPTION @@ -72,7 +71,6 @@ init_attributes(void) init_reduceproduction(); init_otherfaction(); init_racename(); - init_synonym(); init_movement(); init_moved(); diff --git a/src/common/attributes/synonym.c b/src/common/attributes/synonym.c deleted file mode 100644 index 2076d442b..000000000 --- a/src/common/attributes/synonym.c +++ /dev/null @@ -1,90 +0,0 @@ -/* vi: set ts=2: - * - * - * Eressea PB(E)M host Copyright (C) 1998-2003 - * Christian Schlittchen (corwin@amber.kn-bremen.de) - * Katja Zedel (katze@felidae.kn-bremen.de) - * Henning Peters (faroul@beyond.kn-bremen.de) - * Enno Rehling (enno@eressea-pbem.de) - * Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de) - * - * This program may not be used, modified or distributed without - * prior permission by the authors of Eressea. - */ - -#include -#include -#include "synonym.h" - -#include - -/* libc includes */ -#include -#include - -static void -a_initsynonym(struct attrib * a) -{ - a->data.v = calloc(sizeof(frace_synonyms), 1); -} - -static void -a_finalizesynonym(struct attrib * a) -{ - frace_synonyms *frs= (frace_synonyms *)a->data.v; - - free((char *)frs->synonyms[0]); - free((char *)frs->synonyms[1]); - free((char *)frs->synonyms[2]); - free((char *)frs->synonyms[3]); - - free(a->data.v); -} - -static void -a_writesynonym(const attrib *a, FILE *F) -{ - frace_synonyms *frs= (frace_synonyms *)a->data.v; - - fputs(frs->synonyms[0],F); - fputc(' ', F); - fputs(frs->synonyms[1],F); - fputc(' ', F); - fputs(frs->synonyms[2],F); - fputc(' ', F); - fputs(frs->synonyms[3],F); - fputc(' ', F); -} - -static int -a_readsynonym(attrib * a, FILE * F) -{ - char lbuf[32]; - frace_synonyms *frs= (frace_synonyms *)a->data.v; - - fscanf(F, "%s", lbuf); - frs->synonyms[0] = strdup(lbuf); - fscanf(F, "%s", lbuf); - frs->synonyms[1] = strdup(lbuf); - fscanf(F, "%s", lbuf); - frs->synonyms[2] = strdup(lbuf); - fscanf(F, "%s", lbuf); - frs->synonyms[3] = strdup(lbuf); - - return AT_READ_OK; -} - -attrib_type at_synonym = { - "synonym", - a_initsynonym, - a_finalizesynonym, - NULL, - a_writesynonym, - a_readsynonym -}; - -void -init_synonym(void) -{ - at_register(&at_synonym); -} diff --git a/src/common/attributes/synonym.h b/src/common/attributes/synonym.h deleted file mode 100644 index 494cddc1b..000000000 --- a/src/common/attributes/synonym.h +++ /dev/null @@ -1,34 +0,0 @@ -/* vi: set ts=2: - * - * - * Eressea PB(E)M host Copyright (C) 1998-2003 - * Christian Schlittchen (corwin@amber.kn-bremen.de) - * Katja Zedel (katze@felidae.kn-bremen.de) - * Henning Peters (faroul@beyond.kn-bremen.de) - * Enno Rehling (enno@eressea-pbem.de) - * Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de) - * - * This program may not be used, modified or distributed without - * prior permission by the authors of Eressea. - */ - -#ifndef H_ATTRIBUTE_SYNONYM -#define H_ATTRIBUTE_SYNONYM -#ifdef __cplusplus -extern "C" { -#endif - -struct attrib_type; -struct attrib; - -typedef struct { - const char *synonyms[4]; -} frace_synonyms; - -extern void init_synonym(void); -extern struct attrib_type at_synonym; - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 785fac0b3..6b5444084 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -67,7 +67,6 @@ /* attributes includes */ #include #include -#include #include /* util includes */ @@ -1279,52 +1278,6 @@ prefix_cmd(unit * u, struct order * ord) return 0; } -static int -synonym_cmd(unit * u, struct order * ord) -{ - int i; - const char *s; - - attrib * a = a_find(u->faction->attribs, &at_synonym); - if (a!=NULL) { /* Kann nur einmal gesetzt werden */ - cmistake(u, ord, 302, MSG_EVENT); - return 0; - } - - init_tokens(ord); - skip_token(); - s = getstrtoken(); - - if (s==NULL) { - cmistake(u, ord, 301, MSG_EVENT); - return 0; - } - - for (i=0; race_synonyms[i].race != -1; i++) { - if (new_race[race_synonyms[i].race] == u->faction->race - && strcasecmp(s, race_synonyms[i].synonyms[0]) == 0) { - break; - } - } - - if (race_synonyms[i].race == -1) { - cmistake(u, ord, 300, MSG_EVENT); - return 0; - } - - a = a_add(&u->faction->attribs, a_new(&at_synonym)); - ((frace_synonyms *)(a->data.v))->synonyms[0] = - strdup(race_synonyms[i].synonyms[0]); - ((frace_synonyms *)(a->data.v))->synonyms[1] = - strdup(race_synonyms[i].synonyms[1]); - ((frace_synonyms *)(a->data.v))->synonyms[2] = - strdup(race_synonyms[i].synonyms[2]); - ((frace_synonyms *)(a->data.v))->synonyms[3] = - strdup(race_synonyms[i].synonyms[3]); - - return 0; -} - static int display_cmd(unit * u, struct order * ord) { @@ -3833,7 +3786,6 @@ processorders (void) add_proc_order(p, K_URSPRUNG, &origin_cmd, 0, NULL); add_proc_order(p, K_ALLY, &ally_cmd, 0, NULL); add_proc_order(p, K_PREFIX, &prefix_cmd, 0, NULL); - add_proc_order(p, K_SYNONYM, &synonym_cmd, 0, NULL); add_proc_order(p, K_SETSTEALTH, &setstealth_cmd, 0, NULL); add_proc_order(p, K_STATUS, &status_cmd, 0, NULL); add_proc_order(p, K_COMBAT, &combatspell_cmd, 0, NULL); diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index 9bd7f582f..3fab50fea 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -385,7 +385,6 @@ const char *keywords[MAXKEYWORDS] = "GM", "INFO", "PRAEFIX", - "SYNONYM", "PFLANZEN", "WERWESEN", "XONTORMIA", diff --git a/src/common/kernel/race.c b/src/common/kernel/race.c index 23eb99811..c7b889d91 100644 --- a/src/common/kernel/race.c +++ b/src/common/kernel/race.c @@ -50,7 +50,6 @@ /* attrib includes */ #include -#include /* libc includes */ #include @@ -181,12 +180,6 @@ add_raceprefix(const char * prefix) /* Die Bezeichnungen dürfen wegen der Art des Speicherns keine * Leerzeichen enthalten! */ -const struct race_syn race_synonyms[] = { - {1, {"Fee", "Feen", "Feen", "Feen"}}, - {2, {"Gnoll", "Gnolle", "Gnollen", "Gnoll"}}, - {-1, {NULL, NULL, NULL, NULL}} -}; - /* "den Zwergen", "Halblingsparteien" */ void @@ -295,22 +288,15 @@ const char * racename(const struct locale *loc, const unit *u, const race * rc) { const char * prefix = raceprefix(u); - attrib * asyn = a_find(u->faction->attribs, &at_synonym); if (prefix!=NULL) { static char lbuf[80]; char * s = lbuf; strcpy(lbuf, locale_string(loc, mkname("prefix", prefix))); s += strlen(lbuf); - if (asyn!=NULL) { - strcpy(s, LOC(loc, ((frace_synonyms *)(asyn->data.v))->synonyms[u->number != 1])); - } else { - strcpy(s, LOC(loc, rc_name(rc, u->number != 1))); - } + strcpy(s, LOC(loc, rc_name(rc, u->number != 1))); s[0] = (char)tolower(s[0]); return lbuf; - } else if (asyn!=NULL) { - return(LOC(loc, ((frace_synonyms *)(asyn->data.v))->synonyms[u->number != 1])); } return LOC(loc, rc_name(rc, u->number != 1)); } diff --git a/src/common/kernel/race.h b/src/common/kernel/race.h index 427dc57e9..446f7cd27 100644 --- a/src/common/kernel/race.h +++ b/src/common/kernel/race.h @@ -50,11 +50,6 @@ typedef struct att { int flags; } att; -typedef struct race_syn { - race_t race; - const char *synonyms[4]; -} race_syn; - typedef struct race { const char *_name[4]; /* neu: name[4]völker */ float magres; @@ -176,7 +171,6 @@ extern boolean r_insectstalled(const struct region *r); extern void add_raceprefix(const char *); extern char ** race_prefixes; -extern const struct race_syn race_synonyms[]; extern void write_race_reference(const struct race * rc, FILE * F); extern int read_race_reference(const struct race ** rp, FILE * F); diff --git a/src/common/kernel/types.h b/src/common/kernel/types.h index 741010b3f..26c1b5001 100644 --- a/src/common/kernel/types.h +++ b/src/common/kernel/types.h @@ -135,7 +135,6 @@ enum { K_GM, /* perform GM commands */ K_INFO, /* set player-info */ K_PREFIX, - K_SYNONYM, K_PLANT, K_WEREWOLF, K_XE,