forked from github/server
Merge pull request #60 from badgerman/master
NPC units that use their race as the name (Hirntöter, Seeschalnge) can use NULL as their name.
This commit is contained in:
commit
4b9d4ac1cb
|
@ -341,7 +341,7 @@ static int cr_race(variant var, char *buffer, const void *userdata)
|
||||||
{
|
{
|
||||||
const faction *report = (const faction *)userdata;
|
const faction *report = (const faction *)userdata;
|
||||||
const struct race *rc = (const race *)var.v;
|
const struct race *rc = (const race *)var.v;
|
||||||
const char *key = rc_name(rc, NAME_SINGULAR);
|
const char *key = rc_name_s(rc, NAME_SINGULAR);
|
||||||
sprintf(buffer, "\"%s\"",
|
sprintf(buffer, "\"%s\"",
|
||||||
translate(key, locale_string(report->locale, key)));
|
translate(key, locale_string(report->locale, key)));
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -834,20 +834,20 @@ static void cr_output_unit(FILE * F, const region * r, const faction * f,
|
||||||
if (pzTmp) {
|
if (pzTmp) {
|
||||||
fprintf(F, "\"%s\";Typ\n", pzTmp);
|
fprintf(F, "\"%s\";Typ\n", pzTmp);
|
||||||
if (u->faction == f && fval(u_race(u), RCF_SHAPESHIFTANY)) {
|
if (u->faction == f && fval(u_race(u), RCF_SHAPESHIFTANY)) {
|
||||||
const char *zRace = rc_name(u_race(u), NAME_PLURAL);
|
const char *zRace = rc_name_s(u_race(u), NAME_PLURAL);
|
||||||
fprintf(F, "\"%s\";wahrerTyp\n",
|
fprintf(F, "\"%s\";wahrerTyp\n",
|
||||||
translate(zRace, locale_string(f->locale, zRace)));
|
translate(zRace, locale_string(f->locale, zRace)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const race *irace = u_irace(u);
|
const race *irace = u_irace(u);
|
||||||
const char *zRace = rc_name(irace, NAME_PLURAL);
|
const char *zRace = rc_name_s(irace, NAME_PLURAL);
|
||||||
fprintf(F, "\"%s\";Typ\n",
|
fprintf(F, "\"%s\";Typ\n",
|
||||||
translate(zRace, locale_string(f->locale, zRace)));
|
translate(zRace, locale_string(f->locale, zRace)));
|
||||||
if (u->faction == f && irace != u_race(u)) {
|
if (u->faction == f && irace != u_race(u)) {
|
||||||
assert(skill_enabled(SK_STEALTH)
|
assert(skill_enabled(SK_STEALTH)
|
||||||
|| !"we're resetting this on load, so.. ircase should never be used");
|
|| !"we're resetting this on load, so.. ircase should never be used");
|
||||||
zRace = rc_name(u_race(u), NAME_PLURAL);
|
zRace = rc_name_s(u_race(u), NAME_PLURAL);
|
||||||
fprintf(F, "\"%s\";wahrerTyp\n",
|
fprintf(F, "\"%s\";wahrerTyp\n",
|
||||||
translate(zRace, locale_string(f->locale, zRace)));
|
translate(zRace, locale_string(f->locale, zRace)));
|
||||||
}
|
}
|
||||||
|
@ -1548,7 +1548,7 @@ report_computer(const char *filename, report_context * ctx, const char *charset)
|
||||||
fprintf(F, "%d;Punktedurchschnitt\n", avgscore);
|
fprintf(F, "%d;Punktedurchschnitt\n", avgscore);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
const char *zRace = rc_name(f->race, NAME_PLURAL);
|
const char *zRace = rc_name_s(f->race, NAME_PLURAL);
|
||||||
fprintf(F, "\"%s\";Typ\n", translate(zRace, LOC(f->locale, zRace)));
|
fprintf(F, "\"%s\";Typ\n", translate(zRace, LOC(f->locale, zRace)));
|
||||||
}
|
}
|
||||||
prefix = get_prefix(f->attribs);
|
prefix = get_prefix(f->attribs);
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
|
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
#include <util/umlaut.h>
|
#include <util/umlaut.h>
|
||||||
#include <util/language.h>
|
#include <util/language.h>
|
||||||
|
|
|
@ -62,7 +62,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <util/crmessage.h>
|
#include <util/crmessage.h>
|
||||||
#include <util/event.h>
|
#include <util/event.h>
|
||||||
#include <util/language.h>
|
#include <util/language.h>
|
||||||
#include <util/filereader.h>
|
|
||||||
#include <util/functions.h>
|
#include <util/functions.h>
|
||||||
#include <util/log.h>
|
#include <util/log.h>
|
||||||
#include <util/lists.h>
|
#include <util/lists.h>
|
||||||
|
@ -305,7 +304,7 @@ const char *dbrace(const struct race *rc)
|
||||||
char *zPtr = zText;
|
char *zPtr = zText;
|
||||||
|
|
||||||
/* the english names are all in ASCII, so we don't need to worry about UTF8 */
|
/* the english names are all in ASCII, so we don't need to worry about UTF8 */
|
||||||
strcpy(zText, (const char *)LOC(get_locale("en"), rc_name(rc, NAME_SINGULAR)));
|
strcpy(zText, (const char *)LOC(get_locale("en"), rc_name_s(rc, NAME_SINGULAR)));
|
||||||
while (*zPtr) {
|
while (*zPtr) {
|
||||||
*zPtr = (char)(toupper(*zPtr));
|
*zPtr = (char)(toupper(*zPtr));
|
||||||
++zPtr;
|
++zPtr;
|
||||||
|
@ -1093,32 +1092,7 @@ void freestrlist(strlist * s)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* - Namen der Strukturen -------------------------------------- */
|
/* - Namen der Strukturen -------------------------------------- */
|
||||||
typedef char name[OBJECTIDSIZE + 1];
|
char *untilde(char *ibuf)
|
||||||
static name idbuf[8];
|
|
||||||
static int nextbuf = 0;
|
|
||||||
|
|
||||||
char *estring_i(char *ibuf)
|
|
||||||
{
|
|
||||||
char *p = ibuf;
|
|
||||||
|
|
||||||
while (*p) {
|
|
||||||
if (isxspace(*(unsigned *)p) == ' ') {
|
|
||||||
*p = '~';
|
|
||||||
}
|
|
||||||
++p;
|
|
||||||
}
|
|
||||||
return ibuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *estring(const char *s)
|
|
||||||
{
|
|
||||||
char *ibuf = idbuf[(++nextbuf) % 8];
|
|
||||||
|
|
||||||
strlcpy(ibuf, s, sizeof(name));
|
|
||||||
return estring_i(ibuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *cstring_i(char *ibuf)
|
|
||||||
{
|
{
|
||||||
char *p = ibuf;
|
char *p = ibuf;
|
||||||
|
|
||||||
|
@ -1131,14 +1105,6 @@ char *cstring_i(char *ibuf)
|
||||||
return ibuf;
|
return ibuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *cstring(const char *s)
|
|
||||||
{
|
|
||||||
char *ibuf = idbuf[(++nextbuf) % 8];
|
|
||||||
|
|
||||||
strlcpy(ibuf, s, sizeof(name));
|
|
||||||
return cstring_i(ibuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
building *largestbuilding(const region * r, cmp_building_cb cmp_gt,
|
building *largestbuilding(const region * r, cmp_building_cb cmp_gt,
|
||||||
bool imaginary)
|
bool imaginary)
|
||||||
{
|
{
|
||||||
|
@ -1157,19 +1123,6 @@ building *largestbuilding(const region * r, cmp_building_cb cmp_gt,
|
||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *write_unitname(const unit * u, char *buffer, size_t size)
|
|
||||||
{
|
|
||||||
slprintf(buffer, size, "%s (%s)", (const char *)u->name, itoa36(u->no));
|
|
||||||
buffer[size - 1] = 0;
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *unitname(const unit * u)
|
|
||||||
{
|
|
||||||
char *ubuf = idbuf[(++nextbuf) % 8];
|
|
||||||
return write_unitname(u, ubuf, sizeof(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- Erschaffung neuer Einheiten ------------------------------ */
|
/* -- Erschaffung neuer Einheiten ------------------------------ */
|
||||||
|
|
||||||
extern faction *dfindhash(int i);
|
extern faction *dfindhash(int i);
|
||||||
|
@ -1529,9 +1482,9 @@ void init_locale(struct locale *lang)
|
||||||
for (rc = races; rc; rc = rc->next) {
|
for (rc = races; rc; rc = rc->next) {
|
||||||
const char *name;
|
const char *name;
|
||||||
var.v = (void *)rc;
|
var.v = (void *)rc;
|
||||||
name = LOC(lang, rc_name(rc, NAME_PLURAL));
|
name = LOC(lang, rc_name_s(rc, NAME_PLURAL));
|
||||||
if (name) addtoken(tokens, name, var);
|
if (name) addtoken(tokens, name, var);
|
||||||
name = LOC(lang, rc_name(rc, NAME_SINGULAR));
|
name = LOC(lang, rc_name_s(rc, NAME_SINGULAR));
|
||||||
if (name) addtoken(tokens, name, var);
|
if (name) addtoken(tokens, name, var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2374,41 +2327,3 @@ int game_id(void) {
|
||||||
return get_param_int(global.parameters, "game.id", 0);
|
return get_param_int(global.parameters, "game.id", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_inifile(dictionary * d)
|
|
||||||
{
|
|
||||||
const char *reportdir = reportpath();
|
|
||||||
const char *datadir = datapath();
|
|
||||||
const char *basedir = basepath();
|
|
||||||
const char *str;
|
|
||||||
|
|
||||||
assert(d);
|
|
||||||
|
|
||||||
str = iniparser_getstring(d, "eressea:base", basedir);
|
|
||||||
if (str != basedir) {
|
|
||||||
set_basepath(str);
|
|
||||||
}
|
|
||||||
str = iniparser_getstring(d, "eressea:report", reportdir);
|
|
||||||
if (str != reportdir) {
|
|
||||||
set_reportpath(str);
|
|
||||||
}
|
|
||||||
str = iniparser_getstring(d, "eressea:data", datadir);
|
|
||||||
if (str != datadir) {
|
|
||||||
set_datapath(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
lomem = iniparser_getint(d, "eressea:lomem", lomem) ? 1 : 0;
|
|
||||||
|
|
||||||
str = iniparser_getstring(d, "eressea:encoding", NULL);
|
|
||||||
if (str && (_strcmpl(str, "utf8") == 0 || _strcmpl(str, "utf-8") == 0)) {
|
|
||||||
enc_gamedata = ENCODING_UTF8;
|
|
||||||
}
|
|
||||||
|
|
||||||
verbosity = iniparser_getint(d, "eressea:verbose", 2);
|
|
||||||
battledebug = iniparser_getint(d, "eressea:debug", battledebug) ? 1 : 0;
|
|
||||||
|
|
||||||
str = iniparser_getstring(d, "eressea:locales", "de,en");
|
|
||||||
make_locales(str);
|
|
||||||
|
|
||||||
if (global.inifile) iniparser_free(global.inifile);
|
|
||||||
global.inifile = d;
|
|
||||||
}
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ extern "C" {
|
||||||
/* this should always be the first thing included after platform.h */
|
/* this should always be the first thing included after platform.h */
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
struct _dictionary_;
|
|
||||||
/* experimental gameplay features (that don't affect the savefile) */
|
/* experimental gameplay features (that don't affect the savefile) */
|
||||||
/* TODO: move these settings to settings.h or into configuration files */
|
/* TODO: move these settings to settings.h or into configuration files */
|
||||||
#define GOBLINKILL /* Goblin-Spezialklau kann tödlich enden */
|
#define GOBLINKILL /* Goblin-Spezialklau kann tödlich enden */
|
||||||
|
@ -35,6 +34,7 @@ extern "C" {
|
||||||
#define INSECT_POTION /* Spezialtrank für Insekten */
|
#define INSECT_POTION /* Spezialtrank für Insekten */
|
||||||
#define ORCIFICATION /* giving snotlings to the peasants gets counted */
|
#define ORCIFICATION /* giving snotlings to the peasants gets counted */
|
||||||
|
|
||||||
|
// TODO: remove macro, move all alliance code into a module.
|
||||||
#define ALLIED(f1, f2) (f1==f2 || (f1->alliance && f1->alliance==f2->alliance))
|
#define ALLIED(f1, f2) (f1==f2 || (f1->alliance && f1->alliance==f2->alliance))
|
||||||
|
|
||||||
/* for some good prime numbers, check http://www.math.niu.edu/~rusin/known-math/98/pi_x */
|
/* for some good prime numbers, check http://www.math.niu.edu/~rusin/known-math/98/pi_x */
|
||||||
|
@ -180,12 +180,7 @@ extern "C" {
|
||||||
|
|
||||||
struct faction *getfaction(void);
|
struct faction *getfaction(void);
|
||||||
|
|
||||||
char *estring(const char *s);
|
char *untilde(char *s);
|
||||||
char *estring_i(char *s);
|
|
||||||
char *cstring(const char *s);
|
|
||||||
char *cstring_i(char *s);
|
|
||||||
const char *unitname(const struct unit *u);
|
|
||||||
char *write_unitname(const struct unit *u, char *buffer, size_t size);
|
|
||||||
|
|
||||||
typedef int(*cmp_building_cb) (const struct building * b,
|
typedef int(*cmp_building_cb) (const struct building * b,
|
||||||
const struct building * a);
|
const struct building * a);
|
||||||
|
@ -306,7 +301,6 @@ extern "C" {
|
||||||
|
|
||||||
const char *basepath(void);
|
const char *basepath(void);
|
||||||
void set_basepath(const char *);
|
void set_basepath(const char *);
|
||||||
void load_inifile(struct _dictionary_ *d);
|
|
||||||
|
|
||||||
const char *reportpath(void);
|
const char *reportpath(void);
|
||||||
void set_reportpath(const char *);
|
void set_reportpath(const char *);
|
||||||
|
|
|
@ -219,8 +219,7 @@ bool r_insectstalled(const region * r)
|
||||||
return fval(r->terrain, ARCTIC_REGION);
|
return fval(r->terrain, ARCTIC_REGION);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *rc_name(const race * rc, name_t n)
|
const char* rc_name(const race * rc, name_t n, char *name, size_t size) {
|
||||||
{
|
|
||||||
const char * postfix = 0;
|
const char * postfix = 0;
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -230,16 +229,21 @@ const char *rc_name(const race * rc, name_t n)
|
||||||
case NAME_PLURAL: postfix = "_p"; break;
|
case NAME_PLURAL: postfix = "_p"; break;
|
||||||
case NAME_DEFINITIVE: postfix = "_d"; break;
|
case NAME_DEFINITIVE: postfix = "_d"; break;
|
||||||
case NAME_CATEGORY: postfix = "_x"; break;
|
case NAME_CATEGORY: postfix = "_x"; break;
|
||||||
default: assert(!"invalid name_t enum in rc_name");
|
default: assert(!"invalid name_t enum in rc_name_s");
|
||||||
}
|
}
|
||||||
if (postfix) {
|
if (postfix) {
|
||||||
static char name[64]; // FIXME: static return value
|
_snprintf(name, size, "race::%s%s", rc->_name, postfix);
|
||||||
sprintf(name, "race::%s%s", rc->_name, postfix);
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *rc_name_s(const race * rc, name_t n)
|
||||||
|
{
|
||||||
|
static char name[64]; // FIXME: static return value
|
||||||
|
return rc_name(rc, n, name, sizeof(name));
|
||||||
|
}
|
||||||
|
|
||||||
const char *raceprefix(const unit * u)
|
const char *raceprefix(const unit * u)
|
||||||
{
|
{
|
||||||
const attrib *asource = u->faction->attribs;
|
const attrib *asource = u->faction->attribs;
|
||||||
|
@ -266,7 +270,7 @@ const char *racename(const struct locale *loc, const unit * u, const race * rc)
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
|
|
||||||
bytes = (int)strlcpy(bufp, LOC(loc, rc_name(rc, u->number != 1)), size);
|
bytes = (int)strlcpy(bufp, LOC(loc, rc_name_s(rc, u->number != 1)), size);
|
||||||
assert(~bufp[0] & 0x80 || !"unicode/not implemented");
|
assert(~bufp[0] & 0x80 || !"unicode/not implemented");
|
||||||
ch = tolower(*(unsigned char *)bufp);
|
ch = tolower(*(unsigned char *)bufp);
|
||||||
bufp[0] = (char)ch;
|
bufp[0] = (char)ch;
|
||||||
|
@ -276,7 +280,7 @@ const char *racename(const struct locale *loc, const unit * u, const race * rc)
|
||||||
|
|
||||||
return lbuf;
|
return lbuf;
|
||||||
}
|
}
|
||||||
str = LOC(loc, rc_name(rc, (u->number == 1) ? NAME_SINGULAR : NAME_PLURAL));
|
str = LOC(loc, rc_name_s(rc, (u->number == 1) ? NAME_SINGULAR : NAME_PLURAL));
|
||||||
return str ? str : rc->_name;
|
return str ? str : rc->_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
|
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
|
||||||
Katja Zedel <katze@felidae.kn-bremen.de
|
Katja Zedel <katze@felidae.kn-bremen.de
|
||||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -151,10 +151,10 @@ extern "C" {
|
||||||
|
|
||||||
const char *(*generate_name) (const struct unit *);
|
const char *(*generate_name) (const struct unit *);
|
||||||
const char *(*describe) (const struct unit *, const struct locale *);
|
const char *(*describe) (const struct unit *, const struct locale *);
|
||||||
void (*age) (struct unit * u);
|
void(*age) (struct unit * u);
|
||||||
bool(*move_allowed) (const struct region *, const struct region *);
|
bool(*move_allowed) (const struct region *, const struct region *);
|
||||||
struct item *(*itemdrop) (const struct race *, int size);
|
struct item *(*itemdrop) (const struct race *, int size);
|
||||||
void (*init_familiar) (struct unit *);
|
void(*init_familiar) (struct unit *);
|
||||||
|
|
||||||
const struct race *familiars[MAXMAGIETYP];
|
const struct race *familiars[MAXMAGIETYP];
|
||||||
struct attrib *attribs;
|
struct attrib *attribs;
|
||||||
|
@ -181,9 +181,10 @@ extern "C" {
|
||||||
void free_races(void);
|
void free_races(void);
|
||||||
|
|
||||||
typedef enum name_t { NAME_SINGULAR, NAME_PLURAL, NAME_DEFINITIVE, NAME_CATEGORY } name_t;
|
typedef enum name_t { NAME_SINGULAR, NAME_PLURAL, NAME_DEFINITIVE, NAME_CATEGORY } name_t;
|
||||||
const char *rc_name(const race *, name_t);
|
const char * rc_name_s(const race *rc, name_t n);
|
||||||
|
const char * rc_name(const race *rc, name_t n, char *name, size_t size);
|
||||||
|
|
||||||
/* Flags. Do not reorder these without changing json_race() in jsonconf.c */
|
/* Flags. Do not reorder these without changing json_race() in jsonconf.c */
|
||||||
#define RCF_NPC (1<<0) /* cannot be the race for a player faction (and other limits?) */
|
#define RCF_NPC (1<<0) /* cannot be the race for a player faction (and other limits?) */
|
||||||
#define RCF_KILLPEASANTS (1<<1) /* a monster that eats peasants */
|
#define RCF_KILLPEASANTS (1<<1) /* a monster that eats peasants */
|
||||||
#define RCF_SCAREPEASANTS (1<<2) /* a monster that scares peasants out of the hex */
|
#define RCF_SCAREPEASANTS (1<<2) /* a monster that scares peasants out of the hex */
|
||||||
|
@ -214,7 +215,7 @@ extern "C" {
|
||||||
#define RCF_STONEGOLEM (1<<27) /* race gets stonegolem properties */
|
#define RCF_STONEGOLEM (1<<27) /* race gets stonegolem properties */
|
||||||
#define RCF_IRONGOLEM (1<<28) /* race gets irongolem properties */
|
#define RCF_IRONGOLEM (1<<28) /* race gets irongolem properties */
|
||||||
|
|
||||||
/* Economic flags */
|
/* Economic flags */
|
||||||
#define GIVEITEM (1<<1) /* gibt Gegenstände weg */
|
#define GIVEITEM (1<<1) /* gibt Gegenstände weg */
|
||||||
#define GIVEPERSON (1<<2) /* übergibt Personen */
|
#define GIVEPERSON (1<<2) /* übergibt Personen */
|
||||||
#define GIVEUNIT (1<<3) /* Einheiten an andere Partei übergeben */
|
#define GIVEUNIT (1<<3) /* Einheiten an andere Partei übergeben */
|
||||||
|
@ -223,7 +224,7 @@ extern "C" {
|
||||||
#define ECF_REC_ETHEREAL (1<<7) /* Rekrutiert aus dem Nichts */
|
#define ECF_REC_ETHEREAL (1<<7) /* Rekrutiert aus dem Nichts */
|
||||||
#define ECF_REC_UNLIMITED (1<<8) /* Rekrutiert ohne Limit */
|
#define ECF_REC_UNLIMITED (1<<8) /* Rekrutiert ohne Limit */
|
||||||
|
|
||||||
/* Battle-Flags */
|
/* Battle-Flags */
|
||||||
#define BF_EQUIPMENT (1<<0) /* Kann Ausrüstung benutzen */
|
#define BF_EQUIPMENT (1<<0) /* Kann Ausrüstung benutzen */
|
||||||
#define BF_NOBLOCK (1<<1) /* Wird in die Rückzugsberechnung nicht einbezogen */
|
#define BF_NOBLOCK (1<<1) /* Wird in die Rückzugsberechnung nicht einbezogen */
|
||||||
#define BF_RES_PIERCE (1<<2) /* Halber Schaden durch PIERCE */
|
#define BF_RES_PIERCE (1<<2) /* Halber Schaden durch PIERCE */
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
|
|
||||||
static void test_rc_name(CuTest *tc) {
|
static void test_rc_name(CuTest *tc) {
|
||||||
struct race *rc = test_create_race("human");
|
struct race *rc = test_create_race("human");
|
||||||
CuAssertStrEquals(tc, "race::human", rc_name(rc, NAME_SINGULAR));
|
CuAssertStrEquals(tc, "race::human", rc_name_s(rc, NAME_SINGULAR));
|
||||||
CuAssertStrEquals(tc, "race::human_p", rc_name(rc, NAME_PLURAL));
|
CuAssertStrEquals(tc, "race::human_p", rc_name_s(rc, NAME_PLURAL));
|
||||||
CuAssertStrEquals(tc, "race::human_d", rc_name(rc, NAME_DEFINITIVE));
|
CuAssertStrEquals(tc, "race::human_d", rc_name_s(rc, NAME_DEFINITIVE));
|
||||||
CuAssertStrEquals(tc, "race::human_x", rc_name(rc, NAME_CATEGORY));
|
CuAssertStrEquals(tc, "race::human_x", rc_name_s(rc, NAME_CATEGORY));
|
||||||
}
|
}
|
||||||
|
|
||||||
CuSuite *get_race_suite(void)
|
CuSuite *get_race_suite(void)
|
||||||
|
|
|
@ -642,9 +642,6 @@ unit *read_unit(struct gamedata *data)
|
||||||
READ_INT(data->store, &number);
|
READ_INT(data->store, &number);
|
||||||
set_number(u, number);
|
set_number(u, number);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
READ_INT(data->store, &n);
|
READ_INT(data->store, &n);
|
||||||
u->age = (short)n;
|
u->age = (short)n;
|
||||||
|
|
||||||
|
@ -1711,6 +1708,13 @@ int readgame(const char *filename, int backup)
|
||||||
unit *u = read_unit(&gdata);
|
unit *u = read_unit(&gdata);
|
||||||
sc_mage *mage;
|
sc_mage *mage;
|
||||||
|
|
||||||
|
if (gdata.version < AUTO_RACENAME_VERSION) {
|
||||||
|
if (u->name && fval(u->faction, FFL_NPC)) {
|
||||||
|
if (unit_name_equals_race(u)) {
|
||||||
|
unit_setname(u, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
assert(u->region == NULL);
|
assert(u->region == NULL);
|
||||||
u->region = r;
|
u->region = r;
|
||||||
*up = u;
|
*up = u;
|
||||||
|
|
|
@ -858,7 +858,7 @@ bool leave(unit * u, bool force)
|
||||||
|
|
||||||
const struct race *urace(const struct unit *u)
|
const struct race *urace(const struct unit *u)
|
||||||
{
|
{
|
||||||
return u->race_;
|
return u->_race;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool can_survive(const unit * u, const region * r)
|
bool can_survive(const unit * u, const region * r)
|
||||||
|
@ -1766,18 +1766,18 @@ const struct race *u_irace(const struct unit *u)
|
||||||
if (u->irace && skill_enabled(SK_STEALTH)) {
|
if (u->irace && skill_enabled(SK_STEALTH)) {
|
||||||
return u->irace;
|
return u->irace;
|
||||||
}
|
}
|
||||||
return u->race_;
|
return u->_race;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct race *u_race(const struct unit *u)
|
const struct race *u_race(const struct unit *u)
|
||||||
{
|
{
|
||||||
return u->race_;
|
return u->_race;
|
||||||
}
|
}
|
||||||
|
|
||||||
void u_setrace(struct unit *u, const struct race *rc)
|
void u_setrace(struct unit *u, const struct race *rc)
|
||||||
{
|
{
|
||||||
assert(rc);
|
assert(rc);
|
||||||
u->race_ = rc;
|
u->_race = rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void unit_add_spell(unit * u, sc_mage * m, struct spell * sp, int level)
|
void unit_add_spell(unit * u, sc_mage * m, struct spell * sp, int level)
|
||||||
|
@ -1843,3 +1843,41 @@ void remove_empty_units(void)
|
||||||
remove_empty_units_in_region(r);
|
remove_empty_units_in_region(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef char name[OBJECTIDSIZE + 1];
|
||||||
|
static name idbuf[8];
|
||||||
|
static int nextbuf = 0;
|
||||||
|
|
||||||
|
char *write_unitname(const unit * u, char *buffer, size_t size)
|
||||||
|
{
|
||||||
|
if (u->name) {
|
||||||
|
slprintf(buffer, size, "%s (%s)", u->name, itoa36(u->no));
|
||||||
|
} else {
|
||||||
|
const struct locale * lang = u->faction ? u->faction->locale : default_locale;
|
||||||
|
const char * name = rc_name_s(u->_race, u->number == 1 ? NAME_SINGULAR : NAME_PLURAL);
|
||||||
|
slprintf(buffer, size, "%s (%s)", locale_string(lang, name), itoa36(u->no));
|
||||||
|
}
|
||||||
|
buffer[size - 1] = 0;
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *unitname(const unit * u)
|
||||||
|
{
|
||||||
|
char *ubuf = idbuf[(++nextbuf) % 8];
|
||||||
|
return write_unitname(u, ubuf, sizeof(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool unit_name_equals_race(const unit *u) {
|
||||||
|
if (u->name) {
|
||||||
|
char sing[32], plur[32];
|
||||||
|
const struct locale *lang = u->faction->locale;
|
||||||
|
rc_name(u->_race, NAME_SINGULAR, sing, sizeof(sing));
|
||||||
|
rc_name(u->_race, NAME_PLURAL, plur, sizeof(plur));
|
||||||
|
if (strcmp(u->name, sing) == 0 || strcmp(u->name, plur) == 0 ||
|
||||||
|
strcmp(u->name, locale_string(lang, sing)) == 0 ||
|
||||||
|
strcmp(u->name, locale_string(lang, plur)) == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ extern "C" {
|
||||||
struct order *old_orders;
|
struct order *old_orders;
|
||||||
|
|
||||||
/* race and illusionary race */
|
/* race and illusionary race */
|
||||||
const struct race *race_;
|
const struct race *_race;
|
||||||
const struct race *irace;
|
const struct race *irace;
|
||||||
|
|
||||||
int flags;
|
int flags;
|
||||||
|
@ -247,6 +247,10 @@ extern "C" {
|
||||||
|
|
||||||
struct unit *findunitr(const struct region *r, int n);
|
struct unit *findunitr(const struct region *r, int n);
|
||||||
|
|
||||||
|
const char *unitname(const struct unit *u);
|
||||||
|
char *write_unitname(const struct unit *u, char *buffer, size_t size);
|
||||||
|
bool unit_name_equals_race(const struct unit *u);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
|
#include <util/base36.h>
|
||||||
|
#include <util/language.h>
|
||||||
#include "alchemy.h"
|
#include "alchemy.h"
|
||||||
#include "faction.h"
|
#include "faction.h"
|
||||||
#include "unit.h"
|
#include "unit.h"
|
||||||
|
@ -10,7 +12,9 @@
|
||||||
#include <CuTest.h>
|
#include <CuTest.h>
|
||||||
#include <tests.h>
|
#include <tests.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
static void test_remove_empty_units(CuTest *tc) {
|
static void test_remove_empty_units(CuTest *tc) {
|
||||||
|
@ -123,10 +127,81 @@ static void test_scale_number(CuTest *tc) {
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_unit_name(CuTest *tc) {
|
||||||
|
unit *u;
|
||||||
|
char name[32];
|
||||||
|
|
||||||
|
test_cleanup();
|
||||||
|
test_create_world();
|
||||||
|
u = test_create_unit(test_create_faction(test_create_race("human")), findregion(0, 0));
|
||||||
|
unit_setname(u, "Hodor");
|
||||||
|
_snprintf(name, sizeof(name), "Hodor (%s)", itoa36(u->no));
|
||||||
|
CuAssertStrEquals(tc, name, unitname(u));
|
||||||
|
test_cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_unit_name_from_race(CuTest *tc) {
|
||||||
|
unit *u;
|
||||||
|
char name[32];
|
||||||
|
struct locale *lang;
|
||||||
|
|
||||||
|
test_cleanup();
|
||||||
|
test_create_world();
|
||||||
|
u = test_create_unit(test_create_faction(test_create_race("human")), findregion(0, 0));
|
||||||
|
unit_setname(u, NULL);
|
||||||
|
lang = get_or_create_locale("de");
|
||||||
|
locale_setstring(lang, rc_name_s(u->_race, NAME_SINGULAR), "Mensch");
|
||||||
|
locale_setstring(lang, rc_name_s(u->_race, NAME_PLURAL), "Menschen");
|
||||||
|
|
||||||
|
_snprintf(name, sizeof(name), "Mensch (%s)", itoa36(u->no));
|
||||||
|
CuAssertStrEquals(tc, name, unitname(u));
|
||||||
|
|
||||||
|
u->number = 2;
|
||||||
|
_snprintf(name, sizeof(name), "Menschen (%s)", itoa36(u->no));
|
||||||
|
CuAssertStrEquals(tc, name, unitname(u));
|
||||||
|
|
||||||
|
test_cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_update_monster_name(CuTest *tc) {
|
||||||
|
unit *u;
|
||||||
|
struct locale *lang;
|
||||||
|
|
||||||
|
test_cleanup();
|
||||||
|
test_create_world();
|
||||||
|
u = test_create_unit(test_create_faction(test_create_race("human")), findregion(0, 0));
|
||||||
|
lang = get_or_create_locale("de");
|
||||||
|
locale_setstring(lang, rc_name_s(u->_race, NAME_SINGULAR), "Mensch");
|
||||||
|
locale_setstring(lang, rc_name_s(u->_race, NAME_PLURAL), "Menschen");
|
||||||
|
|
||||||
|
unit_setname(u, "Hodor");
|
||||||
|
CuAssertTrue(tc, !unit_name_equals_race(u));
|
||||||
|
|
||||||
|
unit_setname(u, "Menschling");
|
||||||
|
CuAssertTrue(tc, !unit_name_equals_race(u));
|
||||||
|
|
||||||
|
unit_setname(u, rc_name_s(u->_race, NAME_SINGULAR));
|
||||||
|
CuAssertTrue(tc, unit_name_equals_race(u));
|
||||||
|
|
||||||
|
unit_setname(u, rc_name_s(u->_race, NAME_PLURAL));
|
||||||
|
CuAssertTrue(tc, unit_name_equals_race(u));
|
||||||
|
|
||||||
|
unit_setname(u, "Mensch");
|
||||||
|
CuAssertTrue(tc, unit_name_equals_race(u));
|
||||||
|
|
||||||
|
unit_setname(u, "Menschen");
|
||||||
|
CuAssertTrue(tc, unit_name_equals_race(u));
|
||||||
|
|
||||||
|
test_cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
CuSuite *get_unit_suite(void)
|
CuSuite *get_unit_suite(void)
|
||||||
{
|
{
|
||||||
CuSuite *suite = CuSuiteNew();
|
CuSuite *suite = CuSuiteNew();
|
||||||
SUITE_ADD_TEST(suite, test_scale_number);
|
SUITE_ADD_TEST(suite, test_scale_number);
|
||||||
|
SUITE_ADD_TEST(suite, test_unit_name);
|
||||||
|
SUITE_ADD_TEST(suite, test_unit_name_from_race);
|
||||||
|
SUITE_ADD_TEST(suite, test_update_monster_name);
|
||||||
SUITE_ADD_TEST(suite, test_remove_empty_units);
|
SUITE_ADD_TEST(suite, test_remove_empty_units);
|
||||||
SUITE_ADD_TEST(suite, test_remove_units_ignores_spells);
|
SUITE_ADD_TEST(suite, test_remove_units_ignores_spells);
|
||||||
SUITE_ADD_TEST(suite, test_remove_units_without_faction);
|
SUITE_ADD_TEST(suite, test_remove_units_without_faction);
|
||||||
|
|
|
@ -73,8 +73,8 @@
|
||||||
#define INTFLAGS_VERSION 342 /* turn 876, FFL_NPC is now bit 25, flags is an int */
|
#define INTFLAGS_VERSION 342 /* turn 876, FFL_NPC is now bit 25, flags is an int */
|
||||||
#define SAVEGAMEID_VERSION 343 /* instead of XMLNAME, save the game.id parameter from the config */
|
#define SAVEGAMEID_VERSION 343 /* instead of XMLNAME, save the game.id parameter from the config */
|
||||||
#define BUILDNO_VERSION 344 /* storing the build number in the save */
|
#define BUILDNO_VERSION 344 /* storing the build number in the save */
|
||||||
|
#define AUTO_RACENAME_VERSION 345 /* NPC units with name==NULL will automatically get their race for a name */
|
||||||
#define MIN_VERSION CURSETYPE_VERSION /* minimal datafile we support */
|
#define MIN_VERSION CURSETYPE_VERSION /* minimal datafile we support */
|
||||||
#define RELEASE_VERSION BUILDNO_VERSION /* current datafile */
|
#define RELEASE_VERSION AUTO_RACENAME_VERSION /* current datafile */
|
||||||
|
|
||||||
#define STREAM_VERSION 2 /* internal encoding of binary files */
|
#define STREAM_VERSION 2 /* internal encoding of binary files */
|
||||||
|
|
|
@ -781,7 +781,7 @@ static void inactivefaction(faction * f)
|
||||||
if (inactiveFILE) {
|
if (inactiveFILE) {
|
||||||
fprintf(inactiveFILE, "%s:%s:%d:%d\n",
|
fprintf(inactiveFILE, "%s:%s:%d:%d\n",
|
||||||
factionid(f),
|
factionid(f),
|
||||||
LOC(default_locale, rc_name(f->race, NAME_PLURAL)),
|
LOC(default_locale, rc_name_s(f->race, NAME_PLURAL)),
|
||||||
modify(count_all(f)), turn - f->lastorders);
|
modify(count_all(f)), turn - f->lastorders);
|
||||||
|
|
||||||
fclose(inactiveFILE);
|
fclose(inactiveFILE);
|
||||||
|
@ -2301,7 +2301,7 @@ static bool display_race(faction * f, unit * u, const race * rc)
|
||||||
|
|
||||||
if (u && u_race(u) != rc)
|
if (u && u_race(u) != rc)
|
||||||
return false;
|
return false;
|
||||||
name = rc_name(rc, NAME_SINGULAR);
|
name = rc_name_s(rc, NAME_SINGULAR);
|
||||||
|
|
||||||
bytes = slprintf(bufp, size, "%s: ", LOC(f->locale, name));
|
bytes = slprintf(bufp, size, "%s: ", LOC(f->locale, name));
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
|
|
|
@ -444,7 +444,7 @@ static void test_unarmed_races_can_guard(CuTest *tc) {
|
||||||
race * rc;
|
race * rc;
|
||||||
|
|
||||||
setup_guard(&fix, false);
|
setup_guard(&fix, false);
|
||||||
rc = rc_get_or_create(fix.u->race_->_name);
|
rc = rc_get_or_create(fix.u->_race->_name);
|
||||||
rc->flags |= RCF_UNARMEDGUARD;
|
rc->flags |= RCF_UNARMEDGUARD;
|
||||||
update_guards();
|
update_guards();
|
||||||
CuAssertTrue(tc, fval(fix.u, UFL_GUARD));
|
CuAssertTrue(tc, fval(fix.u, UFL_GUARD));
|
||||||
|
|
41
src/main.c
41
src/main.c
|
@ -22,6 +22,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
#include <kernel/save.h>
|
#include <kernel/save.h>
|
||||||
#include <kernel/version.h>
|
#include <kernel/version.h>
|
||||||
|
#include <util/filereader.h>
|
||||||
|
#include <util/language.h>
|
||||||
#include "eressea.h"
|
#include "eressea.h"
|
||||||
#ifdef USE_CURSES
|
#ifdef USE_CURSES
|
||||||
#include "gmtool.h"
|
#include "gmtool.h"
|
||||||
|
@ -43,6 +45,45 @@ static const char *luafile = 0;
|
||||||
static const char *inifile = "eressea.ini";
|
static const char *inifile = "eressea.ini";
|
||||||
static int memdebug = 0;
|
static int memdebug = 0;
|
||||||
|
|
||||||
|
static void load_inifile(dictionary * d)
|
||||||
|
{
|
||||||
|
const char *reportdir = reportpath();
|
||||||
|
const char *datadir = datapath();
|
||||||
|
const char *basedir = basepath();
|
||||||
|
const char *str;
|
||||||
|
|
||||||
|
assert(d);
|
||||||
|
|
||||||
|
str = iniparser_getstring(d, "eressea:base", basedir);
|
||||||
|
if (str != basedir) {
|
||||||
|
set_basepath(str);
|
||||||
|
}
|
||||||
|
str = iniparser_getstring(d, "eressea:report", reportdir);
|
||||||
|
if (str != reportdir) {
|
||||||
|
set_reportpath(str);
|
||||||
|
}
|
||||||
|
str = iniparser_getstring(d, "eressea:data", datadir);
|
||||||
|
if (str != datadir) {
|
||||||
|
set_datapath(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
lomem = iniparser_getint(d, "eressea:lomem", lomem) ? 1 : 0;
|
||||||
|
|
||||||
|
str = iniparser_getstring(d, "eressea:encoding", NULL);
|
||||||
|
if (str && (_strcmpl(str, "utf8") == 0 || _strcmpl(str, "utf-8") == 0)) {
|
||||||
|
enc_gamedata = ENCODING_UTF8;
|
||||||
|
}
|
||||||
|
|
||||||
|
verbosity = iniparser_getint(d, "eressea:verbose", 2);
|
||||||
|
battledebug = iniparser_getint(d, "eressea:debug", battledebug) ? 1 : 0;
|
||||||
|
|
||||||
|
str = iniparser_getstring(d, "eressea:locales", "de,en");
|
||||||
|
make_locales(str);
|
||||||
|
|
||||||
|
if (global.inifile) iniparser_free(global.inifile);
|
||||||
|
global.inifile = d;
|
||||||
|
}
|
||||||
|
|
||||||
static void parse_config(const char *filename)
|
static void parse_config(const char *filename)
|
||||||
{
|
{
|
||||||
dictionary *d = iniparser_new(filename);
|
dictionary *d = iniparser_new(filename);
|
||||||
|
|
|
@ -163,7 +163,7 @@ void score(void)
|
||||||
f->score, f->score - average_score_of_age(f->age, f->age / 24 + 1),
|
f->score, f->score - average_score_of_age(f->age, f->age / 24 + 1),
|
||||||
((float)f->score / (float)allscores) * 100.0,
|
((float)f->score / (float)allscores) * 100.0,
|
||||||
(float)f->score / f->num_total,
|
(float)f->score / f->num_total,
|
||||||
f->name, LOC(default_locale, rc_name(f->race, NAME_SINGULAR)), factionid(f),
|
f->name, LOC(default_locale, rc_name_s(f->race, NAME_SINGULAR)), factionid(f),
|
||||||
f->age);
|
f->age);
|
||||||
}
|
}
|
||||||
fclose(scoreFP);
|
fclose(scoreFP);
|
||||||
|
|
|
@ -243,4 +243,3 @@ void make_zombie(unit * u)
|
||||||
u_setrace(u, get_race(RC_ZOMBIE));
|
u_setrace(u, get_race(RC_ZOMBIE));
|
||||||
u->irace = NULL;
|
u->irace = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
|
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
|
||||||
Katja Zedel <katze@felidae.kn-bremen.de
|
Katja Zedel <katze@felidae.kn-bremen.de
|
||||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -22,7 +22,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MONSTER_ID 666
|
struct unit;
|
||||||
|
|
||||||
void monster_kills_peasants(struct unit *u);
|
void monster_kills_peasants(struct unit *u);
|
||||||
bool monster_is_waiting(const struct unit *u);
|
bool monster_is_waiting(const struct unit *u);
|
||||||
|
@ -30,6 +30,7 @@ extern "C" {
|
||||||
struct faction *get_or_create_monsters(void);
|
struct faction *get_or_create_monsters(void);
|
||||||
void make_zombie(struct unit * u);
|
void make_zombie(struct unit * u);
|
||||||
|
|
||||||
|
#define MONSTER_ID 666
|
||||||
#define is_monsters(f) (f && fval(f, FFL_NPC) && f==get_monsters())
|
#define is_monsters(f) (f && fval(f, FFL_NPC) && f==get_monsters())
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -926,7 +926,7 @@ void spawn_dragons(void)
|
||||||
if (verbosity >= 2) {
|
if (verbosity >= 2) {
|
||||||
log_printf(stdout, "%d %s in %s.\n", u->number,
|
log_printf(stdout, "%d %s in %s.\n", u->number,
|
||||||
LOC(default_locale,
|
LOC(default_locale,
|
||||||
rc_name(u_race(u), (u->number==1) ? NAME_SINGULAR:NAME_PLURAL)), regionname(r, NULL));
|
rc_name_s(u_race(u), (u->number==1) ? NAME_SINGULAR:NAME_PLURAL)), regionname(r, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
name_unit(u);
|
name_unit(u);
|
||||||
|
@ -1001,7 +1001,7 @@ void spawn_undead(void)
|
||||||
if (verbosity >= 2) {
|
if (verbosity >= 2) {
|
||||||
log_printf(stdout, "%d %s in %s.\n", u->number,
|
log_printf(stdout, "%d %s in %s.\n", u->number,
|
||||||
LOC(default_locale,
|
LOC(default_locale,
|
||||||
rc_name(u_race(u), (u->number == 1) ? NAME_SINGULAR : NAME_PLURAL)), regionname(r, NULL));
|
rc_name_s(u_race(u), (u->number == 1) ? NAME_SINGULAR : NAME_PLURAL)), regionname(r, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -215,7 +215,7 @@ const char *silbe3[SIL3] = {
|
||||||
|
|
||||||
static const char *generic_name(const unit * u)
|
static const char *generic_name(const unit * u)
|
||||||
{
|
{
|
||||||
const char * name = rc_name(u_race(u), (u->no == 1) ? NAME_SINGULAR : NAME_PLURAL);
|
const char * name = rc_name_s(u_race(u), (u->no == 1) ? NAME_SINGULAR : NAME_PLURAL);
|
||||||
return LOC(u->faction->locale, name);
|
return LOC(u->faction->locale, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2179,7 +2179,7 @@ const char *charset)
|
||||||
centre(F, gamedate_season(f->locale), true);
|
centre(F, gamedate_season(f->locale), true);
|
||||||
rnl(F);
|
rnl(F);
|
||||||
sprintf(buf, "%s, %s/%s (%s)", factionname(f),
|
sprintf(buf, "%s, %s/%s (%s)", factionname(f),
|
||||||
LOC(f->locale, rc_name(f->race, NAME_PLURAL)),
|
LOC(f->locale, rc_name_s(f->race, NAME_PLURAL)),
|
||||||
LOC(f->locale, mkname("school", magic_school[f->magiegebiet])), f->email);
|
LOC(f->locale, mkname("school", magic_school[f->magiegebiet])), f->email);
|
||||||
centre(F, buf, true);
|
centre(F, buf, true);
|
||||||
if (f_get_alliance(f)) {
|
if (f_get_alliance(f)) {
|
||||||
|
|
|
@ -2161,7 +2161,7 @@ static void eval_race(struct opstack **stack, const void *userdata)
|
||||||
const struct locale *lang = report ? report->locale : default_locale;
|
const struct locale *lang = report ? report->locale : default_locale;
|
||||||
int j = opop(stack).i;
|
int j = opop(stack).i;
|
||||||
const race *r = (const race *)opop(stack).v;
|
const race *r = (const race *)opop(stack).v;
|
||||||
const char *c = LOC(lang, rc_name(r, (j == 1) ? NAME_SINGULAR : NAME_PLURAL));
|
const char *c = LOC(lang, rc_name_s(r, (j == 1) ? NAME_SINGULAR : NAME_PLURAL));
|
||||||
size_t len = strlen(c);
|
size_t len = strlen(c);
|
||||||
variant var;
|
variant var;
|
||||||
|
|
||||||
|
|
|
@ -1546,7 +1546,7 @@ static int sp_create_irongolem(castorder * co)
|
||||||
ADDMSG(&mage->faction->msgs,
|
ADDMSG(&mage->faction->msgs,
|
||||||
msg_message("magiccreate_effect", "region command unit amount object",
|
msg_message("magiccreate_effect", "region command unit amount object",
|
||||||
mage->region, co->order, mage, number,
|
mage->region, co->order, mage, number,
|
||||||
LOC(mage->faction->locale, rc_name(rc_find("irongolem"), (u2->number == 1) ? NAME_SINGULAR : NAME_PLURAL))));
|
LOC(mage->faction->locale, rc_name_s(rc_find("irongolem"), (u2->number == 1) ? NAME_SINGULAR : NAME_PLURAL))));
|
||||||
|
|
||||||
return cast_level;
|
return cast_level;
|
||||||
}
|
}
|
||||||
|
@ -1607,7 +1607,7 @@ static int sp_create_stonegolem(castorder * co)
|
||||||
ADDMSG(&mage->faction->msgs,
|
ADDMSG(&mage->faction->msgs,
|
||||||
msg_message("magiccreate_effect", "region command unit amount object",
|
msg_message("magiccreate_effect", "region command unit amount object",
|
||||||
mage->region, co->order, mage, number,
|
mage->region, co->order, mage, number,
|
||||||
LOC(mage->faction->locale, rc_name(rc_find("stonegolem"), (u2->number == 1) ? NAME_SINGULAR : NAME_PLURAL))));
|
LOC(mage->faction->locale, rc_name_s(rc_find("stonegolem"), (u2->number == 1) ? NAME_SINGULAR : NAME_PLURAL))));
|
||||||
|
|
||||||
return cast_level;
|
return cast_level;
|
||||||
}
|
}
|
||||||
|
@ -5657,7 +5657,7 @@ int sp_showastral(castorder * co)
|
||||||
}
|
}
|
||||||
icat(u->number);
|
icat(u->number);
|
||||||
scat(" ");
|
scat(" ");
|
||||||
scat(LOC(mage->faction->locale, rc_name(u_race(u), (u->number==1) ? NAME_SINGULAR:NAME_PLURAL)));
|
scat(LOC(mage->faction->locale, rc_name_s(u_race(u), (u->number==1) ? NAME_SINGULAR:NAME_PLURAL)));
|
||||||
scat(", Entfernung ");
|
scat(", Entfernung ");
|
||||||
icat(distance(rl2->data, rt));
|
icat(distance(rl2->data, rt));
|
||||||
scat(")");
|
scat(")");
|
||||||
|
|
|
@ -123,11 +123,11 @@ static void out_faction(FILE * file, const struct faction *f)
|
||||||
if (alliances != NULL) {
|
if (alliances != NULL) {
|
||||||
fprintf(file, "%s (%s/%d) (%.3s/%.3s), %d Einh., %d Pers., $%d, %d NMR\n",
|
fprintf(file, "%s (%s/%d) (%.3s/%.3s), %d Einh., %d Pers., $%d, %d NMR\n",
|
||||||
f->name, itoa36(f->no), f_get_alliance(f) ? f->alliance->id : 0,
|
f->name, itoa36(f->no), f_get_alliance(f) ? f->alliance->id : 0,
|
||||||
LOC(default_locale, rc_name(f->race, NAME_SINGULAR)), magic_school[f->magiegebiet],
|
LOC(default_locale, rc_name_s(f->race, NAME_SINGULAR)), magic_school[f->magiegebiet],
|
||||||
count_units(f), f->num_total, f->money, turn - f->lastorders);
|
count_units(f), f->num_total, f->money, turn - f->lastorders);
|
||||||
} else {
|
} else {
|
||||||
fprintf(file, "%s (%.3s/%.3s), %d Einh., %d Pers., $%d, %d NMR\n",
|
fprintf(file, "%s (%.3s/%.3s), %d Einh., %d Pers., $%d, %d NMR\n",
|
||||||
factionname(f), LOC(default_locale, rc_name(f->race, NAME_SINGULAR)),
|
factionname(f), LOC(default_locale, rc_name_s(f->race, NAME_SINGULAR)),
|
||||||
magic_school[f->magiegebiet], count_units(f), f->num_total, f->money,
|
magic_school[f->magiegebiet], count_units(f), f->num_total, f->money,
|
||||||
turn - f->lastorders);
|
turn - f->lastorders);
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ void report_summary(summary * s, summary * o, bool full)
|
||||||
if (i != RC_TEMPLATE && i != RC_CLONE && s->factionrace[i]) {
|
if (i != RC_TEMPLATE && i != RC_CLONE && s->factionrace[i]) {
|
||||||
const race *rc = get_race(i);
|
const race *rc = get_race(i);
|
||||||
if (rc && playerrace(rc)) {
|
if (rc && playerrace(rc)) {
|
||||||
fprintf(F, "%13s%s: %s\n", LOC(default_locale, rc_name(rc, NAME_CATEGORY)),
|
fprintf(F, "%13s%s: %s\n", LOC(default_locale, rc_name_s(rc, NAME_CATEGORY)),
|
||||||
LOC(default_locale, "stat_tribe_p"), pcomp(s->factionrace[i],
|
LOC(default_locale, "stat_tribe_p"), pcomp(s->factionrace[i],
|
||||||
o->factionrace[i]));
|
o->factionrace[i]));
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,7 @@ void report_summary(summary * s, summary * o, bool full)
|
||||||
for (i = 0; i < MAXRACES; i++) {
|
for (i = 0; i < MAXRACES; i++) {
|
||||||
if (s->poprace[i]) {
|
if (s->poprace[i]) {
|
||||||
const race *rc = get_race(i);
|
const race *rc = get_race(i);
|
||||||
fprintf(F, "%20s: %s\n", LOC(default_locale, rc_name(rc, NAME_PLURAL)),
|
fprintf(F, "%20s: %s\n", LOC(default_locale, rc_name_s(rc, NAME_PLURAL)),
|
||||||
rcomp(s->poprace[i], o->poprace[i]));
|
rcomp(s->poprace[i], o->poprace[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ void report_summary(summary * s, summary * o, bool full)
|
||||||
if (i != RC_TEMPLATE && i != RC_CLONE && s->poprace[i]) {
|
if (i != RC_TEMPLATE && i != RC_CLONE && s->poprace[i]) {
|
||||||
const race *rc = get_race(i);
|
const race *rc = get_race(i);
|
||||||
if (playerrace(rc)) {
|
if (playerrace(rc)) {
|
||||||
fprintf(F, "%20s: %s\n", LOC(default_locale, rc_name(rc, NAME_PLURAL)),
|
fprintf(F, "%20s: %s\n", LOC(default_locale, rc_name_s(rc, NAME_PLURAL)),
|
||||||
rcomp(s->poprace[i], o->poprace[i]));
|
rcomp(s->poprace[i], o->poprace[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ static int a_readdirection(attrib * a, void *owner, struct storage *store)
|
||||||
READ_TOK(store, NULL, 0);
|
READ_TOK(store, NULL, 0);
|
||||||
READ_TOK(store, lbuf, sizeof(lbuf));
|
READ_TOK(store, lbuf, sizeof(lbuf));
|
||||||
|
|
||||||
cstring_i(lbuf);
|
untilde(lbuf);
|
||||||
for (; dl; dl = dl->next) {
|
for (; dl; dl = dl->next) {
|
||||||
if (strcmp(lbuf, dl->oldname) == 0) {
|
if (strcmp(lbuf, dl->oldname) == 0) {
|
||||||
d->keyword = _strdup(dl->name);
|
d->keyword = _strdup(dl->name);
|
||||||
|
|
Loading…
Reference in New Issue