forked from github/server
Unicode WIP, does not compile.
- removed a lot more localized text.- currently working on combatspells (buf usage and German text removal)
This commit is contained in:
parent
0a997cadcd
commit
857df3f300
|
@ -448,14 +448,7 @@ recruit(unit * u, struct order * ord, request ** recruitorders)
|
|||
if (f->no==MONSTER_FACTION) {
|
||||
/* Monster dürfen REKRUTIERE 15 dracoid machen */
|
||||
const xmlChar * str = getstrtoken();
|
||||
if (str!=NULL && *str) {
|
||||
for (rc = races;rc;rc=rc->next) {
|
||||
if (xmlStrncasecmp(LOC(f->locale, rc->_name[0]), str, xstrlen(str))==0)
|
||||
break;
|
||||
if (xmlStrncasecmp(LOC(f->locale, rc->_name[1]), str, xstrlen(str))==0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
rc = findrace(str, f->locale);
|
||||
if (rc==NULL) rc = f->race;
|
||||
}
|
||||
|
||||
|
@ -2992,21 +2985,10 @@ expandwork(region * r)
|
|||
|
||||
/* Der Rest wird von den Bauern verdient. n ist das uebriggebliebene
|
||||
* Geld. */
|
||||
#ifdef AFFECT_SALARY
|
||||
{
|
||||
attrib * a = a_find(r->attribs, &at_salary);
|
||||
if (a) verdienst = a->data.i;
|
||||
}
|
||||
#endif
|
||||
|
||||
earnings = min(n, rpeasants(r) * p_wage) + verdienst;
|
||||
/* Mehr oder weniger durch Trank "Riesengrass" oder "Faulobstschnaps" */
|
||||
|
||||
if (verdienst) {
|
||||
sprintf(buf, "%d Bauern verdienen ein Silber %s durch %s.",
|
||||
abs(verdienst), (verdienst > 0) ? "mehr" : "weniger",
|
||||
(verdienst > 0) ? "Riesengras" : "Faulobstschnaps");
|
||||
}
|
||||
rsetmoney(r, rmoney(r) + earnings);
|
||||
}
|
||||
|
||||
|
|
|
@ -169,8 +169,7 @@ use_instantartsculpture(struct unit * u, const struct item_type * itype,
|
|||
|
||||
b = new_building(bt_find("artsculpture"), u->region, u->faction->locale);
|
||||
b->size = 100;
|
||||
sprintf(buf, "%s", LOC(u->faction->locale, "artsculpture"));
|
||||
set_string(&b->name, buf);
|
||||
set_string(&b->name, LOC(u->faction->locale, "artsculpture"));
|
||||
|
||||
ADDMSG(&u->region->msgs, msg_message("artsculpture_create", "unit region",
|
||||
u, u->region));
|
||||
|
@ -193,8 +192,7 @@ use_instantartacademy(struct unit * u, const struct item_type * itype,
|
|||
|
||||
b = new_building(bt_find("artacademy"), u->region, u->faction->locale);
|
||||
b->size = 100;
|
||||
sprintf(buf, "%s", LOC(u->faction->locale, "artacademy"));
|
||||
set_string(&b->name, buf);
|
||||
set_string(&b->name, LOC(u->faction->locale, "artacademy"));
|
||||
|
||||
ADDMSG(&u->region->msgs, msg_message(
|
||||
"artacademy_create", "unit region", u, u->region));
|
||||
|
|
|
@ -2147,34 +2147,35 @@ display_race(faction *f, unit *u, const race * rc)
|
|||
bufp += rsize;
|
||||
|
||||
/* hp_p : Trefferpunkte */
|
||||
sprintf(buf2, " %d Trefferpunkte", rc->hitpoints);
|
||||
sprintf(buf2, " %d %s", rc->hitpoints, LOC(f->locale, "stat_hitpoints"));
|
||||
|
||||
rsize = strlcpy(bufp, buf2, size);
|
||||
if (rsize>size) rsize = size-1;
|
||||
size -= rsize;
|
||||
bufp += rsize;
|
||||
|
||||
/* b_attacke : Angriff */
|
||||
sprintf(buf2, ", %s: %d", LOC(f->locale, "stat_attack"), (rc->at_default+rc->at_bonus));
|
||||
rsize = strlcpy(bufp, buf2, size);
|
||||
if (rsize>size) rsize = size-1;
|
||||
size -= rsize;
|
||||
bufp += rsize;
|
||||
|
||||
/* b_defense : Verteidigung */
|
||||
sprintf(buf2, ", %s: %d", LOC(f->locale, "stat_defense"), (rc->df_default+rc->df_bonus));
|
||||
rsize = strlcpy(bufp, buf2, size);
|
||||
if (rsize>size) rsize = size-1;
|
||||
size -= rsize;
|
||||
bufp += rsize;
|
||||
|
||||
/* b_armor : Rüstung */
|
||||
if (rc->armor > 0) {
|
||||
sprintf(buf2, ", Rüstung: %d", rc->armor);
|
||||
sprintf(buf2, ", %s: %d", LOC(f->locale, "stat_armor"), rc->armor);
|
||||
rsize = strlcpy(bufp, buf2, size);
|
||||
if (rsize>size) rsize = size-1;
|
||||
size -= rsize;
|
||||
bufp += rsize;
|
||||
}
|
||||
/* b_attacke : Angriff */
|
||||
sprintf(buf2, ", Angriff: %d", (rc->at_default+rc->at_bonus));
|
||||
rsize = strlcpy(bufp, buf2, size);
|
||||
if (rsize>size) rsize = size-1;
|
||||
size -= rsize;
|
||||
bufp += rsize;
|
||||
|
||||
/* b_defense : Verteidigung */
|
||||
sprintf(buf2, ", Verteidigung: %d", (rc->df_default+rc->df_bonus));
|
||||
rsize = strlcpy(bufp, buf2, size);
|
||||
if (rsize>size) rsize = size-1;
|
||||
size -= rsize;
|
||||
bufp += rsize;
|
||||
|
||||
if (size>1) {
|
||||
strcpy(bufp++, ".");
|
||||
|
@ -2189,31 +2190,31 @@ display_race(faction *f, unit *u, const race * rc)
|
|||
}
|
||||
}
|
||||
if (rc->battle_flags & BF_EQUIPMENT) {
|
||||
rsize = strlcpy(bufp, " Kann Waffen benutzen.", size);
|
||||
rsize = snprintf(bufp, size, " %s", LOC(f->locale, "stat_equipment"));
|
||||
if (rsize>size) rsize = size-1;
|
||||
size -= rsize;
|
||||
bufp += rsize;
|
||||
}
|
||||
if (rc->battle_flags & BF_RES_PIERCE) {
|
||||
rsize = strlcpy(bufp, " Ist durch Stichwaffen, Bögen und Armbrüste schwer zu verwunden.", size);
|
||||
rsize = snprintf(bufp, size, " %s", LOC(f->locale, "stat_pierce"));
|
||||
if (rsize>size) rsize = size-1;
|
||||
size -= rsize;
|
||||
bufp += rsize;
|
||||
}
|
||||
if (rc->battle_flags & BF_RES_CUT) {
|
||||
rsize = strlcpy(bufp, " Ist durch Hiebwaffen schwer zu verwunden.", size);
|
||||
rsize = snprintf(bufp, size, " %s", LOC(f->locale, "stat_cut"));
|
||||
if (rsize>size) rsize = size-1;
|
||||
size -= rsize;
|
||||
bufp += rsize;
|
||||
}
|
||||
if (rc->battle_flags & BF_RES_BASH) {
|
||||
rsize = strlcpy(bufp, " Ist durch Schlagwaffen und Katapulte schwer zu verwunden.", size);
|
||||
rsize = snprintf(bufp, size, " %s", LOC(f->locale, "stat_bash"));
|
||||
if (rsize>size) rsize = size-1;
|
||||
size -= rsize;
|
||||
bufp += rsize;
|
||||
}
|
||||
|
||||
sprintf(buf2, " Hat %d Angriff%s", at_count, (at_count>1)?"e":"");
|
||||
sprintf(buf2, " %d %s", at_count, LOC(f->locale, (at_count==1)?"stat_attack":"stat_attacks"));
|
||||
rsize = strlcpy(bufp, buf2, size);
|
||||
if (rsize>size) rsize = size-1;
|
||||
size -= rsize;
|
||||
|
@ -2229,19 +2230,19 @@ display_race(faction *f, unit *u, const race * rc)
|
|||
}
|
||||
switch(rc->attack[a].type) {
|
||||
case AT_STANDARD:
|
||||
sprintf(buf2, "ein Angriff mit der Waffe oder macht unbewaffnet %s Schaden", rc->def_damage);
|
||||
sprintf(buf2, "%s (%s)", LOC(f->locale, "attack_standard"), rc->def_damage);
|
||||
break;
|
||||
case AT_NATURAL:
|
||||
sprintf(buf2, "ein Angriff mit Krallen, Zähnen oder Klauen, der %s Schaden macht", rc->attack[a].data.dice);
|
||||
sprintf(buf2, "%s (%s)", LOC(f->locale, "attack_natural"), rc->attack[a].data.dice);
|
||||
break;
|
||||
case AT_SPELL:
|
||||
case AT_COMBATSPELL:
|
||||
case AT_DRAIN_ST:
|
||||
case AT_DAZZLE:
|
||||
sprintf(buf2, "ein magischer Angriff");
|
||||
sprintf(buf2, "%s", LOC(f->locale, "attack_natural"));
|
||||
break;
|
||||
case AT_STRUCTURAL:
|
||||
sprintf(buf2, "ein Angriff, der %s Gebäudeschaden verursacht", rc->attack[a].data.dice);
|
||||
sprintf(buf2, "%s (%s)", LOC(f->locale, "attack_structural"), rc->attack[a].data.dice);
|
||||
}
|
||||
rsize = strlcpy(bufp, buf2, size);
|
||||
if (rsize>size) rsize = size-1;
|
||||
|
@ -2255,7 +2256,7 @@ display_race(faction *f, unit *u, const race * rc)
|
|||
--size;
|
||||
}
|
||||
|
||||
addmessage(0, f, buf, MSG_EVENT, ML_IMPORTANT);
|
||||
addmessage(0, f, (const xmlChar *)buf, MSG_EVENT, ML_IMPORTANT);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ report_region(report_context * ctx, seen_region * sr)
|
|||
xmlNewProp(node, BAD_CAST "plane", xml_s(r->planep->name));
|
||||
}
|
||||
if (r->land!=NULL) {
|
||||
xmlNewProp(node, BAD_CAST "name", xml_s(r->land->name));
|
||||
xmlNewProp(node, BAD_CAST "name", r->land->name);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
|
|
@ -109,7 +109,8 @@ extern void add_buildinglist(building_list **bl, struct building *b);
|
|||
|
||||
extern struct attrib_type at_building_generic_type;
|
||||
extern const char * buildingtype(const building_type * btype, const struct building * b, int bsize);
|
||||
extern const char * buildingname(const struct building * b);
|
||||
extern const xmlChar * buildingname(const struct building * b);
|
||||
extern const xmlChar * write_buildingname(const building * b, xmlChar * ibuf, size_t size);
|
||||
extern int buildingcapacity(const struct building * b);
|
||||
extern struct building *new_building(const struct building_type * typ, struct region * r, const struct locale * lang);
|
||||
void build_building(struct unit * u, const struct building_type * typ, int size, struct order * ord);
|
||||
|
|
|
@ -1556,50 +1556,65 @@ typedef char name[OBJECTIDSIZE+1];
|
|||
static name idbuf[8];
|
||||
static int nextbuf = 0;
|
||||
|
||||
char *
|
||||
estring_i(char *ibuf)
|
||||
{
|
||||
char *p = ibuf;
|
||||
|
||||
while (*p) {
|
||||
if (isspace(*(unsigned*)p) == ' ') {
|
||||
*p = '~';
|
||||
}
|
||||
++p;
|
||||
}
|
||||
return ibuf;
|
||||
}
|
||||
|
||||
char *
|
||||
estring(const char *s)
|
||||
{
|
||||
char *ibuf = idbuf[(++nextbuf) % 8];
|
||||
char *r;
|
||||
|
||||
strlcpy(ibuf, s, sizeof(name));
|
||||
r = ibuf;
|
||||
return estring_i(ibuf);
|
||||
}
|
||||
|
||||
while (*ibuf) {
|
||||
if(*ibuf == ' ') {
|
||||
*ibuf = '~';
|
||||
char *
|
||||
cstring_i(char *ibuf)
|
||||
{
|
||||
char *p = ibuf;
|
||||
|
||||
while (*p) {
|
||||
if (*p == '~') {
|
||||
*p = ' ';
|
||||
}
|
||||
ibuf++;
|
||||
++p;
|
||||
}
|
||||
return r;
|
||||
return ibuf;
|
||||
}
|
||||
|
||||
char *
|
||||
cstring(const char *s)
|
||||
{
|
||||
char *ibuf = idbuf[(++nextbuf) % 8];
|
||||
char *r;
|
||||
|
||||
strlcpy(ibuf,s, sizeof(name));
|
||||
r = ibuf;
|
||||
|
||||
while (*ibuf) {
|
||||
if (*ibuf == '~') {
|
||||
*ibuf = ' ';
|
||||
}
|
||||
ibuf++;
|
||||
}
|
||||
return r;
|
||||
return cstring_i(ibuf);
|
||||
}
|
||||
|
||||
const char *
|
||||
const xmlChar *
|
||||
write_buildingname(const building * b, xmlChar * ibuf, size_t size)
|
||||
{
|
||||
snprintf((char*)ibuf, sizeof(name), "%s (%s)", b->name, itoa36(b->no));
|
||||
ibuf[sizeof(name)-1] = 0;
|
||||
return ibuf;
|
||||
}
|
||||
|
||||
const xmlChar *
|
||||
buildingname(const building * b)
|
||||
{
|
||||
char *ibuf = idbuf[(++nextbuf) % 8];
|
||||
|
||||
snprintf(ibuf, sizeof(name), "%s (%s)", b->name, itoa36(b->no));
|
||||
ibuf[sizeof(name)-1] = 0;
|
||||
return ibuf;
|
||||
return write_buildingname(b, (xmlChar*)ibuf, sizeof(name));
|
||||
}
|
||||
|
||||
building *
|
||||
|
|
|
@ -43,7 +43,6 @@ extern "C" {
|
|||
#define INSECT_POTION /* Spezialtrank für Insekten */
|
||||
#define ORCIFICATION /* gioving snotlings to the peasants gets counted */
|
||||
#undef TROLLSAVE /* saving throw for dead trolls */
|
||||
#undef AFFECT_SALARY /* gibt es ein attribut at_salary (ist noch nicht fertig!) */
|
||||
|
||||
#include <settings.h>
|
||||
|
||||
|
@ -256,8 +255,10 @@ struct unit *findunit(int n);
|
|||
struct unit *findunitr(const struct region * r, int n);
|
||||
struct region *findunitregion(const struct unit * su);
|
||||
|
||||
char *estring(const char *s);
|
||||
char *cstring(const char *s);
|
||||
extern char *estring(const char *s);
|
||||
extern char *estring_i(char *s);
|
||||
extern char *cstring(const char *s);
|
||||
extern char *cstring_i(char *s);
|
||||
extern const xmlChar *unitname(const struct unit * u);
|
||||
extern xmlChar * write_unitname(const struct unit * u, xmlChar * buffer, size_t size);
|
||||
|
||||
|
|
|
@ -409,6 +409,9 @@
|
|||
<File
|
||||
RelativePath=".\unit.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\version.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\xmlkernel.h">
|
||||
</File>
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "terrain.h"
|
||||
#include "terrainid.h"
|
||||
#include "unit.h"
|
||||
#include "version.h"
|
||||
|
||||
/* util includes */
|
||||
#include <util/attrib.h>
|
||||
|
@ -102,29 +103,30 @@ dir_invert(direction_t dir)
|
|||
}
|
||||
|
||||
const xmlChar *
|
||||
regionname(const region * r, const faction * f)
|
||||
write_regionname(const region * r, const faction * f, xmlChar * buffer, size_t size)
|
||||
{
|
||||
static char buf[65];
|
||||
char * buf = (char *)buffer;
|
||||
const struct locale * lang = f ? f->locale : 0;
|
||||
if (r==NULL) {
|
||||
strcpy(buf, "(null)");
|
||||
} else {
|
||||
plane *pl = r->planep;
|
||||
if (pl && fval(pl, PFL_NOCOORDS)) {
|
||||
strncpy(buf, rname(r, lang), 65);
|
||||
strncpy(buf, (const char *)rname(r, lang), size);
|
||||
} else {
|
||||
#ifdef HAVE_SNPRINTF
|
||||
snprintf(buf, 65, "%s (%d,%d)", rname(r, lang),
|
||||
snprintf(buf, size, "%s (%d,%d)", rname(r, lang),
|
||||
region_x(r, f), region_y(r, f));
|
||||
#else
|
||||
strncpy(buf, rname(r, lang), 50);
|
||||
buf[50]=0;
|
||||
sprintf(buf+strlen(buf), " (%d,%d)", region_x(r, f), region_y(r, f));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
buf[64] = 0;
|
||||
return buf;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
const xmlChar *
|
||||
regionname(const region * r, const faction * f)
|
||||
{
|
||||
static xmlChar buf[65];
|
||||
return write_regionname(r, f, buf, sizeof(buf));
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -207,9 +209,15 @@ a_readdirection(attrib *a, FILE *f)
|
|||
spec_direction *d = (spec_direction *)(a->data.v);
|
||||
fscanf(f, "%hd %hd %d", &d->x, &d->y, &d->duration);
|
||||
fscanf(f, "%15s ", lbuf);
|
||||
d->desc = strdup(cstring(lbuf));
|
||||
d->desc = strdup(lbuf);
|
||||
fscanf(f, "%15s ", lbuf);
|
||||
d->keyword = strdup(cstring(lbuf));
|
||||
d->keyword = strdup(lbuf);
|
||||
if (global.data_version<UNICODE_VERSION) {
|
||||
cstring_i(d->desc);
|
||||
cstring_i(d->keyword);
|
||||
/* TODO: reverse lookup of desc and keyword or something? */
|
||||
assert(!"not implemented");
|
||||
}
|
||||
d->active = true;
|
||||
return AT_READ_OK;
|
||||
}
|
||||
|
@ -220,7 +228,7 @@ a_writedirection(const attrib *a, FILE *f)
|
|||
spec_direction *d = (spec_direction *)(a->data.v);
|
||||
|
||||
fprintf(f, "%d %d %d %s %s ", d->x, d->y, d->duration,
|
||||
estring(d->desc), estring(d->keyword));
|
||||
(const char *)d->desc, (const char *)d->keyword);
|
||||
}
|
||||
|
||||
attrib_type at_direction = {
|
||||
|
@ -686,11 +694,12 @@ r_demand(const region * r, const luxury_type * ltype)
|
|||
return d->value;
|
||||
}
|
||||
|
||||
const char *
|
||||
const xmlChar *
|
||||
rname(const region * r, const struct locale * lang) {
|
||||
if (r->land)
|
||||
if (r->land) {
|
||||
return r->land->name;
|
||||
return locale_string(lang, terrain_name(r));
|
||||
}
|
||||
return LOC(lang, terrain_name(r));
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -789,7 +798,10 @@ free_region(region * r)
|
|||
free(r);
|
||||
}
|
||||
|
||||
static char *
|
||||
/** creates a name for a region
|
||||
* TODO: Make this XML-configurable and allow non-ascii characters again.
|
||||
*/
|
||||
static xmlChar *
|
||||
makename(void)
|
||||
{
|
||||
int s, v, k, e, p = 0, x = 0;
|
||||
|
@ -797,12 +809,16 @@ makename(void)
|
|||
static char name[16];
|
||||
const char *kons = "bcdfghklmnprstvwz",
|
||||
*end = "nlrdst",
|
||||
*vokal = "aaaaaaaaaàâeeeeeeeeeéèêiiiiiiiiiíîoooooooooóòôuuuuuuuuuúyy",
|
||||
#if 0
|
||||
*vowels = "aaaaaaaaaàâeeeeeeeeeéèêiiiiiiiiiíîoooooooooóòôuuuuuuuuuúyy",
|
||||
#else
|
||||
*vowels = "aaaaaaaaaaaeeeeeeeeeeeeiiiiiiiiiiioooooooooooouuuuuuuuuuyy",
|
||||
#endif
|
||||
*start = "bcdgtskpvfr";
|
||||
|
||||
nk = strlen(kons);
|
||||
ne = strlen(end);
|
||||
nv = strlen(vokal);
|
||||
nv = strlen(vowels);
|
||||
ns = strlen(start);
|
||||
|
||||
for (s = rng_int() % 3 + 2; s > 0; s--) {
|
||||
|
@ -816,7 +832,7 @@ makename(void)
|
|||
p++;
|
||||
}
|
||||
v = rng_int() % (int)nv;
|
||||
name[p] = vokal[v];
|
||||
name[p] = vowels[v];
|
||||
p++;
|
||||
if (rng_int() % 3 == 2 || s == 1) {
|
||||
e = rng_int() % (int)ne;
|
||||
|
@ -828,7 +844,7 @@ makename(void)
|
|||
}
|
||||
name[p] = '\0';
|
||||
name[0] = (char) toupper(name[0]);
|
||||
return name;
|
||||
return (xmlChar*)name;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -131,8 +131,8 @@ typedef struct spec_direction {
|
|||
short x, y;
|
||||
int duration;
|
||||
boolean active;
|
||||
xmlChar *desc;
|
||||
xmlChar *keyword;
|
||||
char *desc;
|
||||
char *keyword;
|
||||
} spec_direction;
|
||||
|
||||
typedef struct {
|
||||
|
@ -209,7 +209,7 @@ extern boolean r_isforest(const struct region * r);
|
|||
#define rterrain(r) (oldterrain((r)->terrain))
|
||||
#define rsetterrain(r, t) ((r)->terrain = newterrain(t))
|
||||
|
||||
extern const char * rname(const struct region * r, const struct locale * lang);
|
||||
extern const xmlChar * rname(const struct region * r, const struct locale * lang);
|
||||
#define rsetname(r, str) (set_string(&(r)->land->name, str))
|
||||
|
||||
#define rplane(r) getplane(r)
|
||||
|
@ -218,6 +218,8 @@ extern void r_setdemand(struct region * r, const struct luxury_type * ltype, int
|
|||
extern int r_demand(const struct region * r, const struct luxury_type * ltype);
|
||||
|
||||
extern const xmlChar * regionname(const struct region * r, const struct faction * f);
|
||||
extern const xmlChar * write_regionname(const struct region * r, const struct faction * f, xmlChar * buffer, size_t size);
|
||||
|
||||
extern void * resolve_region(variant data);
|
||||
extern struct region * new_region(short x, short y);
|
||||
extern void terraform(struct region * r, terrain_t terrain);
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
#define REGIONITEMS_VERSION 323 /* regions have items */
|
||||
#define ATTRIBREAD_VERSION 324 /* remove a_readint */
|
||||
#define CURSEFLAGS_VERSION 325 /* remove a_readint */
|
||||
#define UNICODE_VERSION 326 /* everything is stored as UTF8 */
|
||||
|
||||
#define MIN_VERSION CURSETYPE_VERSION
|
||||
#define REGIONOWNERS_VERSION 400
|
||||
|
|
|
@ -1625,7 +1625,7 @@ parse_terrains(xmlDocPtr doc)
|
|||
|
||||
xpath = xmlXPathNewContext(doc);
|
||||
|
||||
/* reading eressea/strings/string */
|
||||
/* reading eressea/terrains/terrain */
|
||||
terrains = xmlXPathEvalExpression(BAD_CAST "/eressea/terrains/terrain", xpath);
|
||||
nodes = terrains->nodesetval;
|
||||
for (i=0;i!=nodes->nodeNr;++i) {
|
||||
|
@ -1740,7 +1740,7 @@ parse_messages(xmlDocPtr doc)
|
|||
|
||||
xpath = xmlXPathNewContext(doc);
|
||||
|
||||
/* reading eressea/strings/string */
|
||||
/* reading eressea/messages/message */
|
||||
messages = xmlXPathEvalExpression(BAD_CAST "/eressea/messages/message", xpath);
|
||||
nodes = messages->nodesetval;
|
||||
for (i=0;i!=nodes->nodeNr;++i) {
|
||||
|
@ -1806,7 +1806,7 @@ parse_messages(xmlDocPtr doc)
|
|||
|
||||
xml_readtext(node, &lang, &text);
|
||||
xml_cleanup_string(text);
|
||||
nrt_register(mtype, lang, xml_to_locale(text), 0, (const char*)section);
|
||||
nrt_register(mtype, lang, (const char *)text, 0, (const char*)section);
|
||||
xmlFree(text);
|
||||
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ sp_kampfzauber(fighter * fi, int level, double power, spell * sp)
|
|||
|
||||
/* Versteinern */
|
||||
int
|
||||
sp_versteinern(fighter * fi, int level, double power, spell * sp)
|
||||
sp_petrify(fighter * fi, int level, double power, spell * sp)
|
||||
{
|
||||
battle *b = fi->side->battle;
|
||||
unit *mage = fi->unit;
|
||||
|
@ -194,9 +194,7 @@ sp_versteinern(fighter * fi, int level, double power, spell * sp)
|
|||
--force;
|
||||
}
|
||||
|
||||
sprintf(buf, "%d Personen %s versteinert",
|
||||
stoned, stoned == 1 ? "wurde" : "wurden");
|
||||
m = msg_message("cast_spell_effect", "mage spell effect", mage, sp, buf);
|
||||
m = msg_message("cast_petrify_effect", "mage spell amount", fi->unit, sp, stoned);
|
||||
message_all(b, m);
|
||||
msg_release(m);
|
||||
return level;
|
||||
|
@ -247,9 +245,7 @@ sp_stun(fighter * fi, int level, double power, spell * sp)
|
|||
}
|
||||
}
|
||||
|
||||
sprintf(buf, "%d Krieger %s für einen Moment benommen",
|
||||
stunned, stunned == 1 ? "ist" : "sind");
|
||||
m = msg_message("cast_spell_effect", "mage spell effect", mage, sp, buf);
|
||||
m = msg_message("cast_stun_effect", "mage spell amount", fi->unit, sp, stunned);
|
||||
message_all(b, m);
|
||||
msg_release(m);
|
||||
return level;
|
||||
|
@ -381,9 +377,7 @@ sp_sleep(fighter * fi, int level, double power, spell * sp)
|
|||
--force;
|
||||
}
|
||||
|
||||
sprintf(buf, "%d Krieger %s in Schlaf versetzt",
|
||||
k, k == 1 ? "wurde" : "wurden");
|
||||
m = msg_message("cast_spell_effect", "mage spell effect", mage, sp, buf);
|
||||
m = msg_message("cast_sleep_effect", "mage spell amount", fi->unit, sp, k);
|
||||
message_all(b, m);
|
||||
msg_release(m);
|
||||
return level;
|
||||
|
@ -455,9 +449,7 @@ sp_speed(fighter * fi, int level, double power, spell * sp)
|
|||
}
|
||||
}
|
||||
|
||||
sprintf(buf, "%d Krieger %s magisch beschleunigt",
|
||||
targets, targets == 1 ? "wurde" : "wurden");
|
||||
m = msg_message("cast_spell_effect", "mage spell effect", fi->unit, sp, buf);
|
||||
m = msg_message("cast_speed_effect", "mage spell amount", fi->unit, sp, targets);
|
||||
message_all(b, m);
|
||||
msg_release(m);
|
||||
return 1;
|
||||
|
@ -687,10 +679,7 @@ sp_drainodem(fighter * fi, int level, double power, spell * sp)
|
|||
--force;
|
||||
}
|
||||
|
||||
sprintf(buf, "%d Person%s wurde ihre Lebenskraft entzogen",
|
||||
drained, drained == 1 ? " wurde" : "en wurden");
|
||||
|
||||
m = msg_message("cast_spell_effect", "mage spell effect", fi->unit, sp, buf);
|
||||
m = msg_message("cast_drainlife_effect", "mage spell amount", fi->unit, sp, drained);
|
||||
message_all(b, m);
|
||||
msg_release(m);
|
||||
return level;
|
||||
|
@ -1030,9 +1019,7 @@ sp_hero(fighter * fi, int level, double power, spell * sp)
|
|||
}
|
||||
}
|
||||
|
||||
sprintf(buf, "%d Krieger %s moralisch gestärkt",
|
||||
targets, targets == 1 ? "wurde" : "wurden");
|
||||
m = msg_message("cast_spell_effect", "mage spell effect", mage, sp, buf);
|
||||
m = msg_message("cast_hero_effect", "mage spell amount", fi->unit, sp, targets);
|
||||
message_all(b, m);
|
||||
msg_release(m);
|
||||
|
||||
|
@ -1086,9 +1073,7 @@ sp_berserk(fighter * fi, int level, double power, spell * sp)
|
|||
}
|
||||
}
|
||||
|
||||
sprintf(buf, "%d Krieger %s in Blutrausch versetzt",
|
||||
targets, targets == 1 ? "wurde" : "wurden");
|
||||
m = msg_message("cast_spell_effect", "mage spell effect", mage, sp, buf);
|
||||
m = msg_message("cast_berserk_effect", "mage spell amount", fi->unit, sp, targets);
|
||||
message_all(b, m);
|
||||
msg_release(m);
|
||||
return level;
|
||||
|
@ -1139,9 +1124,7 @@ sp_frighten(fighter * fi, int level, double power, spell * sp)
|
|||
--force;
|
||||
}
|
||||
|
||||
sprintf(buf, "%d Krieger %s eingeschüchtert",
|
||||
targets, targets == 1 ? "wurde" : "wurden");
|
||||
m = msg_message("cast_spell_effect", "mage spell effect", fi->unit, sp, buf);
|
||||
m = msg_message("cast_frighten_effect", "mage spell amount", fi->unit, sp, targets);
|
||||
message_all(b, m);
|
||||
msg_release(m);
|
||||
return level;
|
||||
|
@ -1183,15 +1166,7 @@ sp_tiredsoldiers(fighter * fi, int level, double power, spell * sp)
|
|||
--force;
|
||||
}
|
||||
|
||||
if (n == 0) {
|
||||
effect = "Der Zauber konnte keinen Krieger ermüden";
|
||||
} else if (n == 1) {
|
||||
effect = "Ein Krieger schleppt sich müde in den Kampf";
|
||||
} else {
|
||||
sprintf(buf, "%d Krieger schleppen sich müde in den Kampf", n);
|
||||
effect = buf;
|
||||
}
|
||||
m = msg_message("cast_spell_effect", "mage spell effect", fi->unit, sp, effect);
|
||||
m = msg_message("cast_tired_effect", "mage spell amount", fi->unit, sp, n);
|
||||
message_all(b, m);
|
||||
msg_release(m);
|
||||
return level;
|
||||
|
@ -1240,8 +1215,7 @@ sp_windshield(fighter * fi, int level, double power, spell * sp)
|
|||
}
|
||||
}
|
||||
|
||||
m = msg_message("cast_spell_effect", "mage spell effect", mage, sp,
|
||||
"Ein Sturm kommt auf und die Schützen können kaum noch zielen");
|
||||
m = msg_message("cast_storm_effect", "mage spell", fi->unit, sp);
|
||||
message_all(b, m);
|
||||
msg_release(m);
|
||||
return level;
|
||||
|
@ -1256,8 +1230,7 @@ sp_reeling_arrows(fighter * fi, int level, double power, spell * sp)
|
|||
unused(power);
|
||||
|
||||
b->reelarrow = true;
|
||||
m = msg_message("cast_spell_effect", "mage spell effect", fi->unit, sp,
|
||||
"Ein Sturm kommt auf und die Schützen können kaum noch zielen");
|
||||
m = msg_message("cast_tired_effect", "mage spell amount", fi->unit, sp, n);
|
||||
message_all(b, m);
|
||||
msg_release(m);
|
||||
return level;
|
||||
|
@ -1310,8 +1283,7 @@ sp_denyattack(fighter * fi, int level, double power, spell * sp)
|
|||
/* fighter leeren */
|
||||
rmfighter(fi, mage->number);
|
||||
|
||||
m = msg_message("cast_spell_effect", "mage spell effect", fi->unit, sp,
|
||||
"Das Kampfgetümmel erstirbt und er kann unbehelligt seines Weges ziehen");
|
||||
m = msg_message("cast_escape_effect", "mage spell", fi->unit, sp);
|
||||
message_all(b, m);
|
||||
msg_release(m);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ extern "C" {
|
|||
extern int sp_sleep(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_windshield(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_strong_wall(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_versteinern(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_petrify(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_hero(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_frighten(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_mindblast(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
|
|
|
@ -580,7 +580,7 @@ sp_summon_familiar(castorder *co)
|
|||
}
|
||||
|
||||
msg = msg_message("familiar_name", "unit", mage);
|
||||
nr_render(msg, mage->faction->locale, zText, sizeof(zText), mage->faction);
|
||||
nr_render(msg, mage->faction->locale, (char *)zText, sizeof(zText), mage->faction);
|
||||
msg_release(msg);
|
||||
familiar = create_unit(target_region, mage->faction, 1, rc, 0, zText, mage);
|
||||
setstatus(familiar, ST_FLEE);
|
||||
|
@ -635,7 +635,7 @@ sp_destroy_magic(castorder *co)
|
|||
double force = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
curse * c = NULL;
|
||||
char ts[80];
|
||||
xmlChar ts[80];
|
||||
attrib **ap;
|
||||
int obj;
|
||||
int succ;
|
||||
|
@ -653,7 +653,7 @@ sp_destroy_magic(castorder *co)
|
|||
/* region *tr = pa->param[0]->data.r; -- farcasting! */
|
||||
region *tr = co->rt;
|
||||
ap = &tr->attribs;
|
||||
strcpy(ts, regionname(tr, mage->faction));
|
||||
write_regionname(tr, mage->faction, ts, sizeof(ts));
|
||||
break;
|
||||
}
|
||||
case SPP_TEMP:
|
||||
|
@ -662,7 +662,7 @@ sp_destroy_magic(castorder *co)
|
|||
unit *u;
|
||||
u = pa->param[0]->data.u;
|
||||
ap = &u->attribs;
|
||||
strcpy(ts, unitname(u));
|
||||
write_unitname(u, ts, sizeof(ts));
|
||||
break;
|
||||
}
|
||||
case SPP_BUILDING:
|
||||
|
@ -4450,9 +4450,7 @@ sp_pump(castorder *co)
|
|||
target = pa->param[0]->data.u; /* Zieleinheit */
|
||||
|
||||
if (fval(target->race, RCF_UNDEAD)) {
|
||||
sprintf(buf, "%s kann nicht auf Untote gezaubert werden.",
|
||||
spell_name(sp, mage->faction->locale));
|
||||
addmessage(0, mage->faction, buf, MSG_EVENT, ML_WARN);
|
||||
ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order, "error_not_on_undead", ""));
|
||||
return 0;
|
||||
}
|
||||
if (is_magic_resistant(mage, target, 0) || target->faction->no == MONSTER_FACTION) {
|
||||
|
@ -7357,7 +7355,7 @@ static spelldata spelldaten[] =
|
|||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 }
|
||||
},
|
||||
(spell_f)sp_versteinern, NULL
|
||||
(spell_f)sp_petrify, NULL
|
||||
},
|
||||
{
|
||||
SPL_STRONG_WALL, "strongwall", NULL, NULL, NULL,
|
||||
|
|
|
@ -45,20 +45,16 @@
|
|||
static message *
|
||||
cinfo_auraboost(const void * obj, typ_t typ, const curse *c, int self)
|
||||
{
|
||||
struct unit *u;
|
||||
struct unit *u = (struct unit *)obj;
|
||||
unused(typ);
|
||||
assert(typ == TYP_UNIT);
|
||||
u = (struct unit *)obj;
|
||||
|
||||
if (self != 0){
|
||||
if (curse_geteffect(c) > 100){
|
||||
sprintf(buf, "%s fühlt sich von starken magischen Energien "
|
||||
"durchströmt", u->name);
|
||||
return msg_message("curseinfo::auraboost_0", "unit id", u, c->no);
|
||||
} else {
|
||||
sprintf(buf, "%s hat Schwierigkeiten seine magischen Energien "
|
||||
"zu sammeln", u->name);
|
||||
return msg_message("curseinfo::auraboost_1", "unit id", u, c->no);
|
||||
}
|
||||
return msg_message("curseinfo::info_str", "text id", buf, c->no);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ nrt_register(const struct message_type * mtype, const struct locale * lang, cons
|
|||
else nrt->section = NULL;
|
||||
messagetypes[hash] = nrt;
|
||||
assert(string && *string);
|
||||
nrt->string = strdup(string);
|
||||
nrt->string = xstrdup(string);
|
||||
*c = '\0';
|
||||
for (i=0;i!=mtype->nparameters;++i) {
|
||||
if (i!=0) *c++ = ' ';
|
||||
|
@ -131,7 +131,7 @@ nrt_register(const struct message_type * mtype, const struct locale * lang, cons
|
|||
}
|
||||
|
||||
size_t
|
||||
nr_render(const struct message * msg, const struct locale * lang, xmlChar * buffer, size_t size, const void * userdata)
|
||||
nr_render(const struct message * msg, const struct locale * lang, char * buffer, size_t size, const void * userdata)
|
||||
{
|
||||
struct nrmessage_type * nrt = nrt_find(lang, msg->type);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ extern const char * nrt_string(const struct nrmessage_type *type);
|
|||
extern const char * nrt_section(const struct nrmessage_type * mt);
|
||||
|
||||
extern size_t nr_render(const struct message * msg, const struct locale * lang,
|
||||
xmlChar * buffer, size_t size, const void * userdata);
|
||||
char * buffer, size_t size, const void * userdata);
|
||||
extern int nr_level(const struct message *msg);
|
||||
extern const char * nr_section(const struct message *msg);
|
||||
|
||||
|
|
Loading…
Reference in New Issue