- Rassenprefix als xml-include

- is_familiar() gab false zurück, wenn Magier nicht vorhanden war (partielles laden)
- verschiedene typecasts, die eigentlich unnötig sind
- windir nur benutzen, wenn MSCVER gesetzt
This commit is contained in:
Enno Rehling 2004-08-07 07:42:22 +00:00
parent 0ab6aedec9
commit 2367ea70ca
31 changed files with 306 additions and 338 deletions

View File

@ -41,7 +41,15 @@ set_prefix(attrib ** ap, const char * str)
const char * const char *
get_prefix(const attrib * a) get_prefix(const attrib * a)
{ {
char * str;
a = a_findc(a, &at_raceprefix); a = a_findc(a, &at_raceprefix);
if (a==NULL) return NULL; if (a==NULL) return NULL;
return (const char *)a->data.v; str = (char *)a->data.v;
/* conversion of old prefixes */
if (strncmp(str, "prefix_", 7)==0) {
((attrib*)a)->data.v = strdup(str+7);
free(str);
str = (char *)a->data.v;
}
return str;
} }

View File

@ -668,6 +668,7 @@ cr_output_unit(FILE * F, const region * r,
} }
} }
if (prefix) { if (prefix) {
prefix = mkname("prefix", prefix);
fprintf(F, "\"%s\";typprefix\n", add_translation(prefix, LOC(f->locale, prefix))); fprintf(F, "\"%s\";typprefix\n", add_translation(prefix, LOC(f->locale, prefix)));
} }
} }
@ -1131,7 +1132,9 @@ report_computer(FILE * F, faction * f, const faction_list * addresses,
} }
prefix = get_prefix(f->attribs); prefix = get_prefix(f->attribs);
if (prefix!=NULL) { if (prefix!=NULL) {
fprintf(F, "\"%s\";typprefix\n", add_translation(prefix, LOC(f->locale, prefix))); prefix = mkname("prefix", prefix);
fprintf(F, "\"%s\";typprefix\n",
add_translation(prefix, LOC(f->locale, prefix)));
} }
fprintf(F, "%d;Rekrutierungskosten\n", f->race->recruitcost); fprintf(F, "%d;Rekrutierungskosten\n", f->race->recruitcost);
fprintf(F, "%d;Anzahl Personen\n", count_all(f)); fprintf(F, "%d;Anzahl Personen\n", count_all(f));
@ -1160,7 +1163,9 @@ report_computer(FILE * F, faction * f, const faction_list * addresses,
fprintf(F, "\"%s\";name\n", g->name); fprintf(F, "\"%s\";name\n", g->name);
prefix = get_prefix(g->attribs); prefix = get_prefix(g->attribs);
if (prefix!=NULL) { if (prefix!=NULL) {
fprintf(F, "\"%s\";typprefix\n", add_translation(prefix, LOC(f->locale, prefix))); prefix = mkname("prefix", prefix);
fprintf(F, "\"%s\";typprefix\n",
add_translation(prefix, LOC(f->locale, prefix)));
} }
show_allies(F, f, g->allies); show_allies(F, f, g->allies);
} }

View File

@ -1487,12 +1487,13 @@ prefix_cmd(unit * u, struct order * ord)
} }
for(i=0; race_prefixes[i] != NULL; i++) { for(i=0; race_prefixes[i] != NULL; i++) {
if(strncasecmp(s, LOC(u->faction->locale, race_prefixes[i]), strlen(s)) == 0) { const char * tag = mkname("prefix", race_prefixes[i]);
if (strncasecmp(s, LOC(u->faction->locale, tag), strlen(s)) == 0) {
break; break;
} }
} }
if(race_prefixes[i] == NULL) { if (race_prefixes[i] == NULL) {
cmistake(u, ord, 299, MSG_EVENT); cmistake(u, ord, 299, MSG_EVENT);
return 0; return 0;
} }

View File

@ -2158,11 +2158,14 @@ report(FILE *F, faction * f, const faction_list * addresses,
} }
centre(F, buf, true); centre(F, buf, true);
rnl(F); rnl(F);
description = LOC(f->locale, potiontext); description = ptype->text;
if (strcmp(description, potiontext)==0) { if (description==NULL || f->locale!=find_locale("de")) {
/* string not found */ description = LOC(f->locale, potiontext);
description = ptype->text; if (strcmp(description, potiontext)==0) {
} /* string not found */
description = ptype->text;
}
}
centre(F, description, true); centre(F, description, true);
} }
} }

View File

@ -3163,7 +3163,21 @@ teure_talente (const struct unit * u)
void void
attrib_init(void) attrib_init(void)
{ {
/* Alle speicherbaren Attribute müssen hier registriert werden */ /* these are non-persistent attributes !
at_register(&at_showitem);
at_register(&at_reportspell);
at_register(&at_horseluck);
at_register(&at_peasantluck);
at_register(&at_alias);
at_register(&at_target);
at_register(&at_potionuser);
at_register(&at_contact);
at_register(&at_lighthouse);
at_register(&at_prayer_effect);
at_register(&at_skillmod);
*/
/* Alle speicherbaren Attribute müssen hier registriert werden */
at_register(&at_unitdissolve); at_register(&at_unitdissolve);
at_register(&at_shiptrail); at_register(&at_shiptrail);
at_register(&at_familiar); at_register(&at_familiar);
@ -3174,12 +3188,10 @@ attrib_init(void)
at_register(&at_stealth); at_register(&at_stealth);
at_register(&at_mage); at_register(&at_mage);
at_register(&at_countdown); at_register(&at_countdown);
at_register(&at_showitem);
at_register(&at_curse); at_register(&at_curse);
at_register(&at_cursewall); at_register(&at_cursewall);
at_register(&at_seenspell); at_register(&at_seenspell);
at_register(&at_reportspell);
at_register(&at_deathcloud); at_register(&at_deathcloud);
/* neue REGION-Attribute */ /* neue REGION-Attribute */
@ -3188,29 +3200,21 @@ attrib_init(void)
#if AT_SALARY #if AT_SALARY
at_register(&at_salary); at_register(&at_salary);
#endif #endif
at_register(&at_horseluck);
at_register(&at_peasantluck);
at_register(&at_deathcount); at_register(&at_deathcount);
at_register(&at_chaoscount); at_register(&at_chaoscount);
at_register(&at_woodcount); at_register(&at_woodcount);
at_register(&at_road); at_register(&at_road);
/* neue UNIT-Attribute */ /* neue UNIT-Attribute */
at_register(&at_alias);
at_register(&at_siege); at_register(&at_siege);
at_register(&at_target);
at_register(&at_potionuser);
at_register(&at_contact);
at_register(&at_effect); at_register(&at_effect);
at_register(&at_private); at_register(&at_private);
at_register(&at_icastle); at_register(&at_icastle);
at_register(&at_guard); at_register(&at_guard);
at_register(&at_lighthouse);
at_register(&at_group); at_register(&at_group);
at_register(&at_faction_special); at_register(&at_faction_special);
at_register(&at_prayer_timeout); at_register(&at_prayer_timeout);
at_register(&at_prayer_effect);
at_register(&at_wyrm); at_register(&at_wyrm);
at_register(&at_building_generic_type); at_register(&at_building_generic_type);
@ -3225,7 +3229,6 @@ attrib_init(void)
register_bordertype(&bt_questportal); register_bordertype(&bt_questportal);
at_register(&at_jihad); at_register(&at_jihad);
at_register(&at_skillmod);
#if GROWING_TREES #if GROWING_TREES
at_register(&at_germs); at_register(&at_germs);
#endif #endif

View File

@ -1807,17 +1807,12 @@ herb_t potionherbs[MAXPOTIONS][MAXHERBSPERPOTION] =
static const char *potiontext[MAXPOTIONS] = static const char *potiontext[MAXPOTIONS] =
{ {
/* Stufe 1: */ /* Stufe 1: */
"Für den Siebenmeilentee koche man einen Blauen Baumringel auf und " "Für den Siebenmeilentee koche man einen Blauen Baumringel auf und "
"gieße dieses Gebräu in einen Windbeutel. Das heraustropfende Wasser " "gieße dieses Gebräu in einen Windbeutel. Das heraustropfende Wasser "
"fange man auf, filtere es und verabreiche es alsdann. Durch diesen " "fange man auf, filtere es und verabreiche es alsdann. Durch diesen "
"Tee können bis zu zehn Menschen schnell wie ein Pferd laufen.", "Tee können bis zu zehn Menschen schnell wie ein Pferd laufen.",
"Zuerst brate man das Gurgelkraut leicht an und würze das Zeug mit " NULL,
"ein wenig Fjordwuchs. Man lasse alles so lange kochen, bis fast alle "
"Flüssigkeit verdampft ist. Diesen Brei stelle man über Nacht raus. "
"Am nächsten Morgen presse man den Brei aus. Die so gewonnene "
"Flüssigkeit, Goliathwasser genannt, verleiht bis zu zehn Männern die "
"Tragkraft eines Pferdes.",
"Das 'Wasser des Lebens' ist in der Lage, aus gefällten Baumstämmen " "Das 'Wasser des Lebens' ist in der Lage, aus gefällten Baumstämmen "
"wieder lebende Bäume zu machen. Dazu wird ein knotiger Saugwurz zusammen mit einem " "wieder lebende Bäume zu machen. Dazu wird ein knotiger Saugwurz zusammen mit einem "
@ -1904,10 +1899,7 @@ static const char *potiontext[MAXPOTIONS] =
"der Trank das Glück von Zwillinge zu bescheren.", "der Trank das Glück von Zwillinge zu bescheren.",
/* Stufe 1, Trank der Wahrheit */ /* Stufe 1, Trank der Wahrheit */
"Dieses wirkungsvolle einfache Gebräu schärft die Sinne des Trinkers " NULL,
"derart, daß er in der Lage ist, eine Woche lang auch die komplexesten "
"Illusionen zu durchschauen. Zur Herstellung benötigt ein Alchemist "
"einen Flachwurz und einen Fjordwuchs.",
"Eines der seltensten und wertvollsten alchemistischen Elixiere, verleiht " "Eines der seltensten und wertvollsten alchemistischen Elixiere, verleiht "
"dieser Trank dem Anwender für einige Wochen die Kraft eines Drachen. " "dieser Trank dem Anwender für einige Wochen die Kraft eines Drachen. "

View File

@ -138,35 +138,21 @@ allowed_dragon(const region * src, const region * target)
return allowed_fly(src, target); return allowed_fly(src, target);
} }
const char *race_prefixes[] = { char ** race_prefixes = NULL;
"prefix_Dunkel",
"prefix_Licht", extern void
"prefix_Klein", add_raceprefix(const char * prefix)
"prefix_Hoch", {
"prefix_Huegel", static size_t size = 4;
"prefix_Berg", static unsigned int next = 0;
"prefix_Wald", if (race_prefixes==NULL) race_prefixes = malloc(size * sizeof(char*));
"prefix_Sumpf", if (next+1==size) {
"prefix_Schnee", size *= 2;
"prefix_Sonnen", race_prefixes = realloc(race_prefixes, size * sizeof(char*));
"prefix_Mond", }
"prefix_See", race_prefixes[next++] = strdup(prefix);
"prefix_Tal", race_prefixes[next] = NULL;
"prefix_Schatten", }
"prefix_Hoehlen",
"prefix_Blut",
"prefix_Wild",
"prefix_Chaos",
"prefix_Nacht",
"prefix_Nebel",
"prefix_Grau",
"prefix_Frost",
"prefix_Finster",
"prefix_Duester",
"prefix_flame",
"prefix_ice",
NULL
};
/* Die Bezeichnungen dürfen wegen der Art des Speicherns keine /* Die Bezeichnungen dürfen wegen der Art des Speicherns keine
* Leerzeichen enthalten! */ * Leerzeichen enthalten! */
@ -363,7 +349,7 @@ racename(const struct locale *loc, const unit *u, const race * rc)
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, prefix)); strcpy(lbuf, locale_string(loc, mkname("prefix", prefix)));
s += strlen(lbuf); s += strlen(lbuf);
if (asyn!=NULL) { if (asyn!=NULL) {
strcpy(s, locale_string(loc, strcpy(s, locale_string(loc,

View File

@ -170,7 +170,8 @@ extern boolean r_insectstalled(const struct region *r);
extern spell_list * familiarspells(const struct race * rc); extern spell_list * familiarspells(const struct race * rc);
extern const char *race_prefixes[]; extern void add_raceprefix(const char *);
extern char ** race_prefixes;
extern const struct race_syn race_synonyms[]; 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);

View File

@ -558,7 +558,8 @@ select_familiar(const race * magerace, magic_t magiegebiet)
boolean boolean
is_familiar(const unit *u) is_familiar(const unit *u)
{ {
return i2b(get_familiar_mage(u)!=NULL); attrib * a = a_find(u->attribs, &at_familiarmage);
return i2b(a!=NULL);
} }
static void static void

View File

@ -1082,6 +1082,37 @@ parse_strings(xmlDocPtr doc)
return 0; return 0;
} }
static void
xml_readprefixes(xmlXPathContextPtr xpath, xmlNodePtr * nodeTab, int nodeNr, boolean names)
{
int i;
for (i=0;i!=nodeNr;++i) {
xmlNodePtr node = nodeTab[i];
xmlChar * text = xmlNodeListGetString(node->doc, node->children, 1);
if (text!=NULL) {
add_raceprefix((const char*)text);
xmlFree(text);
}
}
}
static int
parse_prefixes(xmlDocPtr doc)
{
xmlXPathContextPtr xpath = xmlXPathNewContext(doc);
xmlXPathObjectPtr strings;
/* reading eressea/strings/string */
strings = xmlXPathEvalExpression(BAD_CAST "/eressea/prefixes/prefix", xpath);
xml_readprefixes(xpath, strings->nodesetval->nodeTab, strings->nodesetval->nodeNr, false);
xmlXPathFreeObject(strings);
xmlXPathFreeContext(xpath);
return 0;
}
static int static int
parse_main(xmlDocPtr doc) parse_main(xmlDocPtr doc)
{ {
@ -1163,6 +1194,7 @@ register_xmlreader(void)
xml_register_callback(parse_main); xml_register_callback(parse_main);
xml_register_callback(parse_strings); xml_register_callback(parse_strings);
xml_register_callback(parse_prefixes);
xml_register_callback(parse_messages); xml_register_callback(parse_messages);
xml_register_callback(parse_races); xml_register_callback(parse_races);

View File

@ -30,98 +30,11 @@
/* libc includes */ /* libc includes */
#include <stdlib.h> #include <stdlib.h>
void
santa_comes_to_town(region * r, unit * santa, void (*action)(unit*))
{
faction * f;
const item_type * roi = it_find("roi");
assert(roi);
for (f = factions;f;f=f->next) {
unit * u;
unit * senior = f->units;
if (!playerrace(f->race)) continue;
for (u = f->units; u; u=u->nextF) {
if (senior->age < u->age || effstealth(senior) > effstealth(u) || i_get(senior->items, roi)) senior = u;
}
if (!senior) continue;
sprintf(buf, "von %s: 'Ho ho ho. Frohe Weihnachten, und alles Gute für dein Volk, %s.'", unitname(santa), unitname(senior));
addmessage(senior->region, 0, buf, MSG_MESSAGE, ML_IMPORTANT);
travelthru(santa, senior->region);
if (action) action(senior);
}
}
unit *
make_santa(region * r)
{
unit * santa = ufindhash(atoi36("xmas"));
while (santa && santa->race!=new_race[RC_ILLUSION]) {
uunhash(santa);
santa->no = newunitid();
uhash(santa);
santa = ufindhash(atoi36("xmas"));
}
if (!santa) {
faction * f = findfaction(atoi36("rr"));
if (f==NULL) f = findfaction(MONSTER_FACTION);
if (f==NULL) return NULL;
f->alive = true;
santa = createunit(r, f, 1, new_race[RC_ILLUSION]);
uunhash(santa);
santa->no = atoi36("xmas");
uhash(santa);
fset(santa, UFL_PARTEITARNUNG);
santa->irace = new_race[RC_GNOME];
set_string(&santa->name, "Ein dicker Gnom mit einem Rentierschlitten");
set_string(&santa->display, "hat: 12 Rentiere, Schlitten, Sack mit Geschenken, Kekse für Khorne");
}
return santa;
}
static int static int
xmasgate_handle(trigger * t, void * data) xmasgate_handle(trigger * t, void * data)
{ {
/* call an event handler on xmasgate. return -1;
* data.v -> ( variant event, int timer )
*/
unit * santa = ufindhash(atoi36("xmas"));
building *b = (building *)t->data.v;
if (santa && b) {
unit ** up = &b->region->units;
if (santa->region!=b->region) santa = NULL;
while (*up) {
unit * u = *up;
if (u->building==b) {
region * r = u->region;
faction * f = u->faction;
unit * home = f->units;
unit * u2 = r->units;
while (u2) {
if (u2->faction==f && u2!=u && u2->number) break;
u2 = u2->next;
}
while (home && (home->region==b->region || home->region->land==NULL)) home = home->nextF;
if (home==NULL) continue;
if (santa!=NULL && u2==NULL) {
char zText[256];
item_type * itype = olditemtype[(rand() % 4) + I_KEKS];
i_change(&u->items, itype, 1);
sprintf(zText, "%s gibt %d %s an %s.", unitname(santa), 1, locale_string(f->locale, resourcename(itype->rtype, GR_PLURAL)), unitname(u));
i_change(&u->items, itype, 1);
addmessage(home->region, u->faction, zText, MSG_COMMERCE, ML_INFO);
}
move_unit(u, home->region, NULL);
}
if (*up==u) up = &u->next;
}
} else
log_error(("could not perform xmasgate::handle()\n"));
unused(data);
return 0;
} }
static void static void

View File

@ -19,8 +19,6 @@ extern "C" {
struct region; struct region;
struct unit; struct unit;
extern void santa_comes_to_town(struct region * r, struct unit * santa, void (*action)(struct unit*));
extern struct unit * make_santa(struct region * r);
extern struct trigger *trigger_xmasgate(struct building * b); extern struct trigger *trigger_xmasgate(struct building * b);
extern void init_xmas(void); extern void init_xmas(void);

View File

@ -62,7 +62,7 @@ removecurse_handle(trigger * t, void * data)
if (a) { if (a) {
a_remove(&td->target->attribs, a); a_remove(&td->target->attribs, a);
} }
else log_error(("ERROR: could not perform removecurse::handle()\n")); else log_error(("could not perform removecurse::handle()\n"));
} else { } else {
log_error(("could not perform removecurse::handle()\n")); log_error(("could not perform removecurse::handle()\n"));
} }

View File

@ -174,7 +174,7 @@ a_removeall(attrib **p, const attrib_type * at)
attrib * attrib *
a_new(const attrib_type * at) { a_new(const attrib_type * at) {
attrib * a = calloc(1, sizeof(attrib)); attrib * a = (attrib*)calloc(1, sizeof(attrib));
assert(at!=NULL); assert(at!=NULL);
a->type = at; a->type = at;
if (at->initialize) at->initialize(a); if (at->initialize) at->initialize(a);

View File

@ -58,8 +58,8 @@ itoab(int i, int base)
if (!as) { if (!as) {
int j; int j;
char * x = calloc(sizeof(char), 8*4); char * x = (char*)calloc(sizeof(char), 8*4);
as = calloc(sizeof(char*), 4); as = (char **)calloc(sizeof(char*), 4);
for (j=0;j!=4;++j) as[j] = x+j*8; for (j=0;j!=4;++j) as[j] = x+j*8;
} }
s = as[index]; s = as[index];

View File

@ -43,7 +43,7 @@ stree_create(void)
syntaxtree * sroot = NULL; syntaxtree * sroot = NULL;
const struct locale * lang = locales; const struct locale * lang = locales;
while (lang) { while (lang) {
syntaxtree * stree = malloc(sizeof(syntaxtree)); syntaxtree * stree = (syntaxtree *)malloc(sizeof(syntaxtree));
stree->lang = lang; stree->lang = lang;
stree->next = sroot; stree->next = sroot;
sroot=stree; sroot=stree;
@ -56,7 +56,7 @@ void
add_command(struct tnode * keys, struct tnode * tnext, add_command(struct tnode * keys, struct tnode * tnext,
const char * str, parser fun) const char * str, parser fun)
{ {
command * cmd = malloc(sizeof(command)); command * cmd = (command *)malloc(sizeof(command));
cmd->fun = fun; cmd->fun = fun;
cmd->nodes = tnext; cmd->nodes = tnext;
addtoken(keys, str, (void*)cmd); addtoken(keys, str, (void*)cmd);

View File

@ -48,7 +48,7 @@ locale *
make_locale(const char * name) make_locale(const char * name)
{ {
unsigned int hkey = hashstring(name); unsigned int hkey = hashstring(name);
locale * l = calloc(sizeof(locale), 1); locale * l = (locale *)calloc(sizeof(locale), 1);
#ifndef NDEBUG #ifndef NDEBUG
locale * lp = locales; locale * lp = locales;
while (lp && lp->hashkey!=hkey) lp=lp->next; while (lp && lp->hashkey!=hkey) lp=lp->next;
@ -75,7 +75,7 @@ locale_getstring(const locale * lang, const char * key)
{ {
unsigned int hkey = hashstring(key); unsigned int hkey = hashstring(key);
unsigned int id = hkey % SMAXHASH; unsigned int id = hkey % SMAXHASH;
struct locale_string * find; const struct locale_str * find;
assert(lang); assert(lang);
if (key==NULL || *key==0) return NULL; if (key==NULL || *key==0) return NULL;
@ -94,8 +94,8 @@ locale_string(const locale * lang, const char * key)
else { else {
unsigned int hkey = hashstring(key); unsigned int hkey = hashstring(key);
unsigned int id = hkey % SMAXHASH; unsigned int id = hkey % SMAXHASH;
struct locale_string * find; struct locale_str * find;
if (key == NULL || *key==0) return NULL; if (key == NULL || *key==0) return NULL;
if (lang == NULL) return key; if (lang == NULL) return key;
find = lang->strings[id]; find = lang->strings[id];
@ -126,7 +126,7 @@ locale_setstring(locale * lang, const char * key, const char * value)
int nval = atoi(key); int nval = atoi(key);
unsigned int hkey = nval?nval:hashstring(key); unsigned int hkey = nval?nval:hashstring(key);
unsigned int id = hkey % SMAXHASH; unsigned int id = hkey % SMAXHASH;
struct locale_string * find; struct locale_str * find;
if (lang==NULL) lang=default_locale; if (lang==NULL) lang=default_locale;
find = lang->strings[id]; find = lang->strings[id];
@ -135,7 +135,7 @@ locale_setstring(locale * lang, const char * key, const char * value)
find=find->nexthash; find=find->nexthash;
} }
if (!find) { if (!find) {
find = calloc(1, sizeof(struct locale_string)); find = calloc(1, sizeof(struct locale_str));
find->nexthash = lang->strings[id]; find->nexthash = lang->strings[id];
lang->strings[id] = find; lang->strings[id] = find;
find->hashkey = hkey; find->hashkey = hkey;
@ -165,7 +165,7 @@ reverse_lookup(const locale * lang, const char * str)
if (strlen(str)) { if (strlen(str)) {
if (lang!=NULL) { if (lang!=NULL) {
for (i=0;i!=SMAXHASH;++i) { for (i=0;i!=SMAXHASH;++i) {
struct locale_string * ls; struct locale_str * ls;
for (ls=lang->strings[i];ls;ls=ls->nexthash) { for (ls=lang->strings[i];ls;ls=ls->nexthash) {
if (strcasecmp(ls->key, str)==0) return ls->key; if (strcasecmp(ls->key, str)==0) return ls->key;
if (strcasecmp(ls->str, str)==0) return ls->key; if (strcasecmp(ls->str, str)==0) return ls->key;

View File

@ -7,16 +7,18 @@
#define SMAXHASH 512 #define SMAXHASH 512
typedef struct locale_str {
unsigned int hashkey;
struct locale_str * nexthash;
char * str;
char * key;
} locale_str;
typedef struct locale { typedef struct locale {
struct locale * next; struct locale * next;
unsigned int hashkey; unsigned int hashkey;
const char * name; const char * name;
struct locale_string { struct locale_str * strings[SMAXHASH];
unsigned int hashkey;
struct locale_string * nexthash;
char * str;
char * key;
} * strings[SMAXHASH];
} locale; } locale;
extern locale * default_locale; extern locale * default_locale;

View File

@ -35,8 +35,8 @@ addlist(void *l1, void *p1)
void_list **l; void_list **l;
void_list *p, *q; void_list *p, *q;
l = l1; l = (void_list **)l1;
p = p1; p = (void_list *)p1;
assert(p->next == 0); assert(p->next == 0);
if (*l) { if (*l) {
@ -94,7 +94,7 @@ promotelist(void *l, void *p)
/* remove entry p from list l; insert p again at the beginning of l */ /* remove entry p from list l; insert p again at the beginning of l */
choplist(l, p); choplist(l, p);
insertlist(l, p); insertlist((void_list **)l, (void_list *)p);
} }
#ifndef MALLOCDBG #ifndef MALLOCDBG
@ -116,7 +116,7 @@ freelist(void *p1)
void_list *p, *p2; void_list *p, *p2;
p = p1; p = (void_list *)p1;
while (p) { while (p) {
p2 = p->next; p2 = p->next;
@ -150,7 +150,7 @@ listlen(void *l)
size_t i; size_t i;
void_list *p; void_list *p;
for (p = l, i = 0; p; p = p->next, i++); for (p = (void_list *)l, i = 0; p; p = p->next, i++);
return i; return i;
} }

View File

@ -59,7 +59,7 @@ mt_new(const char * name, const char * args[])
mtype->pnames[i] = strdup(x); mtype->pnames[i] = strdup(x);
mtype->types[i] = NULL; mtype->types[i] = NULL;
} else { } else {
char * cp = strncpy(malloc(spos-x+1), x, spos-x); char * cp = strncpy((char*)malloc(spos-x+1), x, spos-x);
cp[spos-x] = '\0'; cp[spos-x] = '\0';
mtype->pnames[i] = cp; mtype->pnames[i] = cp;
/* optimierung: Typ-Strings zentral verwalten. */ /* optimierung: Typ-Strings zentral verwalten. */
@ -98,7 +98,7 @@ arg_type * argtypes = NULL;
void void
register_argtype(const char * name, void(*free_arg)(void*), void*(*copy_arg)(void*)) register_argtype(const char * name, void(*free_arg)(void*), void*(*copy_arg)(void*))
{ {
arg_type * atype = malloc(sizeof(arg_type)); arg_type * atype = (arg_type *)malloc(sizeof(arg_type));
atype->name = name; atype->name = name;
atype->next = argtypes; atype->next = argtypes;
atype->free = free_arg; atype->free = free_arg;
@ -145,7 +145,7 @@ msg_create(const struct message_type * type, void * args[])
return NULL; return NULL;
} }
msg->type = type; msg->type = type;
msg->parameters = calloc(sizeof(void*), type->nparameters); msg->parameters = (void**)calloc(sizeof(void*), type->nparameters);
msg->refcount=1; msg->refcount=1;
for (i=0;i!=type->nparameters;++i) { for (i=0;i!=type->nparameters;++i) {
msg->parameters[i] = copy_arg(type->types[i], args[i]); msg->parameters[i] = copy_arg(type->types[i], args[i]);
@ -200,7 +200,7 @@ mt_register(const message_type * type)
messagetype_list * mtl = messagetypes[hash]; messagetype_list * mtl = messagetypes[hash];
while (mtl && mtl->data!=type) mtl=mtl->next; while (mtl && mtl->data!=type) mtl=mtl->next;
if (mtl==NULL) { if (mtl==NULL) {
mtl = malloc(sizeof(messagetype_list)); mtl = (messagetype_list*)malloc(sizeof(messagetype_list));
mtl->data = type; mtl->data = type;
mtl->next = messagetypes[hash]; mtl->next = messagetypes[hash];
messagetypes[hash] = mtl; messagetypes[hash] = mtl;

View File

@ -12,7 +12,7 @@
* prior permission by the authors of Eressea. * prior permission by the authors of Eressea.
*/ */
#ifdef WIN32 #ifdef _MSC_VER
#include <config.h> #include <config.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -14,6 +14,8 @@
#ifndef WINDIR_H #ifndef WINDIR_H
#define WINDIR_H #define WINDIR_H
#ifdef _MSC_VER
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -41,3 +43,4 @@ struct dirent *readdir(DIR * thedir);
} }
#endif #endif
#endif #endif
#endif

View File

@ -79,7 +79,7 @@ static xml_reader * xmlReaders;
void void
xml_register_callback(xml_callback callback) xml_register_callback(xml_callback callback)
{ {
xml_reader * reader = malloc(sizeof(xml_reader)); xml_reader * reader = (xml_reader *)malloc(sizeof(xml_reader));
xml_reader ** insert = &xmlReaders; xml_reader ** insert = &xmlReaders;
reader->callback = callback; reader->callback = callback;
reader->next = NULL; reader->next = NULL;

View File

@ -73,6 +73,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eressea-lua", "eressea\eres
{4C837BEC-A428-4287-84B3-8F8F9DE7FA00} = {4C837BEC-A428-4287-84B3-8F8F9DE7FA00} {4C837BEC-A428-4287-84B3-8F8F9DE7FA00} = {4C837BEC-A428-4287-84B3-8F8F9DE7FA00}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxmapper", "wxmapper\wxmapper.vcproj", "{552164AD-D42D-4088-A59E-CB5CF77BA528}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfiguration) = preSolution GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug Debug = Debug
@ -125,6 +129,10 @@ Global
{749A2F7C-B9C3-4CEB-B1B2-1D4587E68719}.Debug.Build.0 = Debug|Win32 {749A2F7C-B9C3-4CEB-B1B2-1D4587E68719}.Debug.Build.0 = Debug|Win32
{749A2F7C-B9C3-4CEB-B1B2-1D4587E68719}.Release.ActiveCfg = Release|Win32 {749A2F7C-B9C3-4CEB-B1B2-1D4587E68719}.Release.ActiveCfg = Release|Win32
{749A2F7C-B9C3-4CEB-B1B2-1D4587E68719}.Release.Build.0 = Release|Win32 {749A2F7C-B9C3-4CEB-B1B2-1D4587E68719}.Release.Build.0 = Release|Win32
{552164AD-D42D-4088-A59E-CB5CF77BA528}.Debug.ActiveCfg = Debug|Win32
{552164AD-D42D-4088-A59E-CB5CF77BA528}.Debug.Build.0 = Debug|Win32
{552164AD-D42D-4088-A59E-CB5CF77BA528}.Release.ActiveCfg = Release|Win32
{552164AD-D42D-4088-A59E-CB5CF77BA528}.Release.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection EndGlobalSection

View File

@ -636,7 +636,7 @@ stats(void)
for (u=r->units;u;u=u->next) { for (u=r->units;u;u=u->next) {
for (itm=u->items;itm;itm=itm->next) { for (itm=u->items;itm;itm=itm->next) {
if (itm->number>10000000) { if (itm->number>50000000) {
log_error(("unit %s has %d %s\n", unitname(u), itm->number, resourcename(itm->type->rtype, 0))); log_error(("unit %s has %d %s\n", unitname(u), itm->number, resourcename(itm->type->rtype, 0)));
/* itm->number=1; */ /* itm->number=1; */
} }
@ -977,7 +977,7 @@ warn_password(void)
boolean pwok = true; boolean pwok = true;
const char * c = f->passw; const char * c = f->passw;
while (*c) { while (*c) {
if (!isalnum(*c)) pwok = false; if (!isalnum((unsigned char)*c)) pwok = false;
c++; c++;
} }
if (pwok == false) { if (pwok == false) {

View File

@ -301,7 +301,7 @@ update_subscriptions(void)
strcat(strcpy(zText, basepath()), "/subscriptions"); strcat(strcpy(zText, basepath()), "/subscriptions");
F = fopen(zText, "r"); F = fopen(zText, "r");
if (F==NULL) { if (F==NULL) {
log_error(("could not open %s.\n", zText)); log_info((0, "could not open %s.\n", zText));
return; return;
} }
for (;;) { for (;;) {

View File

@ -288,14 +288,6 @@ mkisland(int nsize)
region * r; region * r;
region_list * rlist = NULL; region_list * rlist = NULL;
int rsize, isize=0; int rsize, isize=0;
#ifdef RANDOM_LOCATION
do {
x = (rand() % 2001) - 1000;
y = (rand() % 2001) - 1000;
r = findregion(x, y);
} while (r!=NULL);
#else
region * rmin = NULL; region * rmin = NULL;
direction_t d; direction_t d;
int dist; int dist;
@ -323,8 +315,8 @@ mkisland(int nsize)
} }
} }
} }
#endif
if (listlen(newfactions)<MINFACTIONS) return 0; if (listlen(newfactions)<MINFACTIONS) return 0;
r = new_region(x, y); r = new_region(x, y);
terraform(r, T_OCEAN); terraform(r, T_OCEAN);
add_regionlist(&rlist, r); add_regionlist(&rlist, r);

View File

@ -1245,9 +1245,9 @@ movearound(int rx, int ry) {
} }
} }
break; break;
case 'E': case 'E':
editmode = !editmode; editmode = !editmode;
break; break;
case 'i': case 'i':
case 'r': case 'r':
showregion(r, 1); showregion(r, 1);

View File

@ -64,21 +64,6 @@
<text locale="en">a great many </text> <text locale="en">a great many </text>
</string> </string>
<string name="prefix_Dunkel">
<text locale="de">Dunkel</text>
<text locale="en">dark </text>
</string>
<string name="prefix_Licht">
<text locale="de">Licht</text>
<text locale="en">light </text>
</string>
<string name="prefix_flame">
<text locale="de">Flammen</text>
<text locale="en">flame</text>
</string>
<string name="nr_trade_intro"> <string name="nr_trade_intro">
<text locale="de">Geboten wird für</text> <text locale="de">Geboten wird für</text>
<text locale="en">Traders can sell</text> <text locale="en">Traders can sell</text>
@ -117,121 +102,6 @@
<text locale="en">insert_your_password_here</text> <text locale="en">insert_your_password_here</text>
</string> </string>
<string name="prefix_ice">
<text locale="de">Eis</text>
<text locale="en">ice</text>
</string>
<string name="prefix_Klein">
<text locale="de">Klein</text>
<text locale="en">gully </text>
</string>
<string name="prefix_Hoch">
<text locale="de">Hoch</text>
<text locale="en">high </text>
</string>
<string name="prefix_Huegel">
<text locale="de">Hügel</text>
<text locale="en">hill </text>
</string>
<string name="prefix_Berg">
<text locale="de">Berg</text>
<text locale="en">mountain </text>
</string>
<string name="prefix_Wald">
<text locale="de">Wald</text>
<text locale="en">wood </text>
</string>
<string name="prefix_Sumpf">
<text locale="de">Sumpf</text>
<text locale="en">swamp </text>
</string>
<string name="prefix_Schnee">
<text locale="de">Schnee</text>
<text locale="en">snow </text>
</string>
<string name="prefix_Sonnen">
<text locale="de">Sonnen</text>
<text locale="en">sun </text>
</string>
<string name="prefix_Mond">
<text locale="de">Mond</text>
<text locale="en">moon </text>
</string>
<string name="prefix_See">
<text locale="de">See</text>
<text locale="en">sea </text>
</string>
<string name="prefix_Tal">
<text locale="de">Tal</text>
<text locale="en">valley </text>
</string>
<string name="prefix_Schatten">
<text locale="de">Schatten</text>
<text locale="en">shadow </text>
</string>
<string name="prefix_Hoehlen">
<text locale="de">Höhlen</text>
<text locale="en">cave </text>
</string>
<string name="prefix_Blut">
<text locale="de">Blut</text>
<text locale="en">blood </text>
</string>
<string name="prefix_Wild">
<text locale="de">Wild</text>
<text locale="en">wild </text>
</string>
<string name="prefix_Chaos">
<text locale="de">Chaos</text>
<text locale="en">chaos </text>
</string>
<string name="prefix_Nacht">
<text locale="de">Nacht</text>
<text locale="en">night </text>
</string>
<string name="prefix_Nebel">
<text locale="de">Nebel</text>
<text locale="en">mist </text>
</string>
<string name="prefix_Grau">
<text locale="de">Grau</text>
<text locale="en">grey </text>
</string>
<string name="prefix_Frost">
<text locale="de">Frost</text>
<text locale="en">cold </text>
</string>
<string name="prefix_Finster">
<text locale="de">Finster</text>
<text locale="en">gloom </text>
</string>
<string name="prefix_Duester">
<text locale="de">Düster</text>
<text locale="en">black </text>
</string>
<string name="tree"> <string name="tree">
<text locale="de">Baum</text> <text locale="de">Baum</text>
<text locale="en">tree</text> <text locale="en">tree</text>
@ -3578,12 +3448,23 @@
</namespace> </namespace>
<namespace name="potion"> <namespace name="potion">
<string name="truthpotion"> <string name="truthpotion">
<text locale="en"> This simple but very potent brew <text locale="de">Dieses wirkungsvolle einfache Gebräu
schärft die Sinne des Trinkenden derart, daß er in der
Lage ist, eine Woche lang auch die komplexesten
Illusionen zu durchschauen.</text>
<text locale="en">This simple but very potent brew
sharpens the senses of anyone that drinks of it and sharpens the senses of anyone that drinks of it and
makes him able to see through even the most complex makes him able to see through even the most complex
illusions for one week. </text> illusions for one week. </text>
</string> </string>
<string name="goliathwater"> <string name="goliathwater">
<text locale="de">Zuerst brate man das Gurgelkraut
leicht an und würze das Zeug mit ein wenig Fjordwuchs.
Man lasse alles so lange kochen, bis fast alle Flüssigkeit
verdampft ist. Diesen Brei stelle man über Nacht raus.
Am nächsten Morgen presse man den Brei aus. Die so
gewonnene Flüssigkeit, Goliathwasser genannt, verleiht
bis zu zehn Männern die Tragkraft eines Pferdes.</text>
<text locale="en"> 'First roast the Gurgelkraut quickly <text locale="en"> 'First roast the Gurgelkraut quickly
and add some Fjordwuchs to spice it up. Let it all boil and add some Fjordwuchs to spice it up. Let it all boil
slowly until almost all liquid has evaporated. Leave the slowly until almost all liquid has evaporated. Leave the
@ -5913,4 +5794,142 @@
<text locale="en">heroes</text> <text locale="en">heroes</text>
</string> </string>
<namespace name="prefix">
<string name="Dunkel">
<text locale="de">Dunkel</text>
<text locale="en">dark </text>
</string>
<string name="Licht">
<text locale="de">Licht</text>
<text locale="en">light </text>
</string>
<string name="flame">
<text locale="de">Flammen</text>
<text locale="en">flame</text>
</string>
<string name="ice">
<text locale="de">Eis</text>
<text locale="en">ice</text>
</string>
<string name="Klein">
<text locale="de">Klein</text>
<text locale="en">gully </text>
</string>
<string name="Hoch">
<text locale="de">Hoch</text>
<text locale="en">high </text>
</string>
<string name="Huegel">
<text locale="de">Hügel</text>
<text locale="en">hill </text>
</string>
<string name="Berg">
<text locale="de">Berg</text>
<text locale="en">mountain </text>
</string>
<string name="Wald">
<text locale="de">Wald</text>
<text locale="en">wood </text>
</string>
<string name="Sumpf">
<text locale="de">Sumpf</text>
<text locale="en">swamp </text>
</string>
<string name="Schnee">
<text locale="de">Schnee</text>
<text locale="en">snow </text>
</string>
<string name="Sonnen">
<text locale="de">Sonnen</text>
<text locale="en">sun </text>
</string>
<string name="Mond">
<text locale="de">Mond</text>
<text locale="en">moon </text>
</string>
<string name="See">
<text locale="de">See</text>
<text locale="en">sea </text>
</string>
<string name="Tal">
<text locale="de">Tal</text>
<text locale="en">valley </text>
</string>
<string name="Schatten">
<text locale="de">Schatten</text>
<text locale="en">shadow </text>
</string>
<string name="Hoehlen">
<text locale="de">Höhlen</text>
<text locale="en">cave </text>
</string>
<string name="Blut">
<text locale="de">Blut</text>
<text locale="en">blood </text>
</string>
<string name="Wild">
<text locale="de">Wild</text>
<text locale="en">wild </text>
</string>
<string name="Chaos">
<text locale="de">Chaos</text>
<text locale="en">chaos </text>
</string>
<string name="Nacht">
<text locale="de">Nacht</text>
<text locale="en">night </text>
</string>
<string name="Nebel">
<text locale="de">Nebel</text>
<text locale="en">mist </text>
</string>
<string name="Grau">
<text locale="de">Grau</text>
<text locale="en">grey </text>
</string>
<string name="Frost">
<text locale="de">Frost</text>
<text locale="en">cold </text>
</string>
<string name="Finster">
<text locale="de">Finster</text>
<text locale="en">gloom </text>
</string>
<string name="Duester">
<text locale="de">Düster</text>
<text locale="en">black </text>
</string>
<string name="star">
<text locale="de">Sternen</text>
<text locale="en">star </text>
</string>
</namespace>
</strings> </strings>

View File

@ -8,6 +8,7 @@
<xi:include href="resources.xml"/> <xi:include href="resources.xml"/>
<xi:include href="races.xml"/> <xi:include href="races.xml"/>
<xi:include href="prefixes.xml"/>
<xi:include href="ships.xml"/> <xi:include href="ships.xml"/>
<xi:include href="buildings.xml"/> <xi:include href="buildings.xml"/>
<xi:include file="terrains.xml"/> <xi:include file="terrains.xml"/>

View File

@ -1408,7 +1408,7 @@
<attack type="2" damage="1d30"/> <attack type="2" damage="1d30"/>
<attack type="2" damage="1d30"/> <attack type="2" damage="1d30"/>
</race> </race>
<!--
<race name="skeletal_wyrm" magres="0.900000" maxaura="1.000000" regaura="3.000000" recruitcost="250000" maintenance="0" weight="180000" capacity="100000" speed="1.000000" hp="2700" ac="8" damage="2d60" unarmedattack="0" unarmeddefense="0" attackmodifier="10" defensemodifier="10" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes" canguard="yes" resistbash="yes"> <race name="skeletal_wyrm" magres="0.900000" maxaura="1.000000" regaura="3.000000" recruitcost="250000" maintenance="0" weight="180000" capacity="100000" speed="1.000000" hp="2700" ac="8" damage="2d60" unarmedattack="0" unarmeddefense="0" attackmodifier="10" defensemodifier="10" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes" canguard="yes" resistbash="yes">
<ai splitsize="1" killpeasants="yes" attackrandom="yes" learn="yes"/> <ai splitsize="1" killpeasants="yes" attackrandom="yes" learn="yes"/>
<function name="name" value="namedragon"/> <function name="name" value="namedragon"/>
@ -1426,5 +1426,5 @@
<attack type="6" spell="83"/> <attack type="6" spell="83"/>
<attack type="6" spell="83"/> <attack type="6" spell="83"/>
</race> </race>
-->
</races> </races>