forked from github/server
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.
This commit is contained in:
parent
1729f137de
commit
32a3c0103f
|
@ -28,7 +28,6 @@ SOURCES =
|
||||||
racename.c
|
racename.c
|
||||||
raceprefix.c
|
raceprefix.c
|
||||||
reduceproduction.c
|
reduceproduction.c
|
||||||
synonym.c
|
|
||||||
targetregion.c
|
targetregion.c
|
||||||
viewrange.c
|
viewrange.c
|
||||||
variable.c
|
variable.c
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "racename.h"
|
#include "racename.h"
|
||||||
#include "raceprefix.h"
|
#include "raceprefix.h"
|
||||||
#include "reduceproduction.h"
|
#include "reduceproduction.h"
|
||||||
#include "synonym.h"
|
|
||||||
#include "targetregion.h"
|
#include "targetregion.h"
|
||||||
#include "variable.h"
|
#include "variable.h"
|
||||||
#ifdef AT_OPTION
|
#ifdef AT_OPTION
|
||||||
|
@ -72,7 +71,6 @@ init_attributes(void)
|
||||||
init_reduceproduction();
|
init_reduceproduction();
|
||||||
init_otherfaction();
|
init_otherfaction();
|
||||||
init_racename();
|
init_racename();
|
||||||
init_synonym();
|
|
||||||
init_movement();
|
init_movement();
|
||||||
|
|
||||||
init_moved();
|
init_moved();
|
||||||
|
|
|
@ -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 <config.h>
|
|
||||||
#include <eressea.h>
|
|
||||||
#include "synonym.h"
|
|
||||||
|
|
||||||
#include <attrib.h>
|
|
||||||
|
|
||||||
/* libc includes */
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
|
@ -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
|
|
|
@ -67,7 +67,6 @@
|
||||||
/* attributes includes */
|
/* attributes includes */
|
||||||
#include <attributes/racename.h>
|
#include <attributes/racename.h>
|
||||||
#include <attributes/raceprefix.h>
|
#include <attributes/raceprefix.h>
|
||||||
#include <attributes/synonym.h>
|
|
||||||
#include <attributes/variable.h>
|
#include <attributes/variable.h>
|
||||||
|
|
||||||
/* util includes */
|
/* util includes */
|
||||||
|
@ -1279,52 +1278,6 @@ prefix_cmd(unit * u, struct order * ord)
|
||||||
return 0;
|
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
|
static int
|
||||||
display_cmd(unit * u, struct order * ord)
|
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_URSPRUNG, &origin_cmd, 0, NULL);
|
||||||
add_proc_order(p, K_ALLY, &ally_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_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_SETSTEALTH, &setstealth_cmd, 0, NULL);
|
||||||
add_proc_order(p, K_STATUS, &status_cmd, 0, NULL);
|
add_proc_order(p, K_STATUS, &status_cmd, 0, NULL);
|
||||||
add_proc_order(p, K_COMBAT, &combatspell_cmd, 0, NULL);
|
add_proc_order(p, K_COMBAT, &combatspell_cmd, 0, NULL);
|
||||||
|
|
|
@ -385,7 +385,6 @@ const char *keywords[MAXKEYWORDS] =
|
||||||
"GM",
|
"GM",
|
||||||
"INFO",
|
"INFO",
|
||||||
"PRAEFIX",
|
"PRAEFIX",
|
||||||
"SYNONYM",
|
|
||||||
"PFLANZEN",
|
"PFLANZEN",
|
||||||
"WERWESEN",
|
"WERWESEN",
|
||||||
"XONTORMIA",
|
"XONTORMIA",
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
|
|
||||||
/* attrib includes */
|
/* attrib includes */
|
||||||
#include <attributes/raceprefix.h>
|
#include <attributes/raceprefix.h>
|
||||||
#include <attributes/synonym.h>
|
|
||||||
|
|
||||||
/* libc includes */
|
/* libc includes */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -181,12 +180,6 @@ add_raceprefix(const char * prefix)
|
||||||
/* Die Bezeichnungen dürfen wegen der Art des Speicherns keine
|
/* Die Bezeichnungen dürfen wegen der Art des Speicherns keine
|
||||||
* Leerzeichen enthalten! */
|
* 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" */
|
/* "den Zwergen", "Halblingsparteien" */
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -295,22 +288,15 @@ const char *
|
||||||
racename(const struct locale *loc, const unit *u, const race * rc)
|
racename(const struct locale *loc, const unit *u, const race * rc)
|
||||||
{
|
{
|
||||||
const char * prefix = raceprefix(u);
|
const char * prefix = raceprefix(u);
|
||||||
attrib * asyn = a_find(u->faction->attribs, &at_synonym);
|
|
||||||
|
|
||||||
if (prefix!=NULL) {
|
if (prefix!=NULL) {
|
||||||
static char lbuf[80];
|
static char lbuf[80];
|
||||||
char * s = lbuf;
|
char * s = lbuf;
|
||||||
strcpy(lbuf, locale_string(loc, mkname("prefix", prefix)));
|
strcpy(lbuf, locale_string(loc, mkname("prefix", prefix)));
|
||||||
s += strlen(lbuf);
|
s += strlen(lbuf);
|
||||||
if (asyn!=NULL) {
|
strcpy(s, LOC(loc, rc_name(rc, u->number != 1)));
|
||||||
strcpy(s, LOC(loc, ((frace_synonyms *)(asyn->data.v))->synonyms[u->number != 1]));
|
|
||||||
} else {
|
|
||||||
strcpy(s, LOC(loc, rc_name(rc, u->number != 1)));
|
|
||||||
}
|
|
||||||
s[0] = (char)tolower(s[0]);
|
s[0] = (char)tolower(s[0]);
|
||||||
return lbuf;
|
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));
|
return LOC(loc, rc_name(rc, u->number != 1));
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,11 +50,6 @@ typedef struct att {
|
||||||
int flags;
|
int flags;
|
||||||
} att;
|
} att;
|
||||||
|
|
||||||
typedef struct race_syn {
|
|
||||||
race_t race;
|
|
||||||
const char *synonyms[4];
|
|
||||||
} race_syn;
|
|
||||||
|
|
||||||
typedef struct race {
|
typedef struct race {
|
||||||
const char *_name[4]; /* neu: name[4]völker */
|
const char *_name[4]; /* neu: name[4]völker */
|
||||||
float magres;
|
float magres;
|
||||||
|
@ -176,7 +171,6 @@ extern boolean r_insectstalled(const struct region *r);
|
||||||
|
|
||||||
extern void add_raceprefix(const char *);
|
extern void add_raceprefix(const char *);
|
||||||
extern char ** race_prefixes;
|
extern char ** race_prefixes;
|
||||||
extern const struct race_syn race_synonyms[];
|
|
||||||
|
|
||||||
extern void write_race_reference(const struct race * rc, FILE * F);
|
extern void write_race_reference(const struct race * rc, FILE * F);
|
||||||
extern int read_race_reference(const struct race ** rp, FILE * F);
|
extern int read_race_reference(const struct race ** rp, FILE * F);
|
||||||
|
|
|
@ -135,7 +135,6 @@ enum {
|
||||||
K_GM, /* perform GM commands */
|
K_GM, /* perform GM commands */
|
||||||
K_INFO, /* set player-info */
|
K_INFO, /* set player-info */
|
||||||
K_PREFIX,
|
K_PREFIX,
|
||||||
K_SYNONYM,
|
|
||||||
K_PLANT,
|
K_PLANT,
|
||||||
K_WEREWOLF,
|
K_WEREWOLF,
|
||||||
K_XE,
|
K_XE,
|
||||||
|
|
Loading…
Reference in New Issue