diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 821706b04..c0960c1b0 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -1119,8 +1119,8 @@ quit(void) break; } else { cmistake(u, S->s, 86, MSG_EVENT); - printf(" Warnung: STIRB mit falschem Passwort für Partei %s: %s\n", - factionid(u->faction), S->s); + log_warning(("STIRB mit falschem Passwort für Partei %s: %s\n", + factionid(u->faction), S->s)); } } else if(igetkeyword(S->s, u->faction->locale) == K_RESTART && u->number > 0) { const char *s_race, *s_pass; @@ -1155,8 +1155,8 @@ quit(void) if (!checkpasswd(u->faction, s_pass, false)) { cmistake(u, S->s, 86, MSG_EVENT); - printf(" Warnung: NEUSTART mit falschem Passwort für Partei %s: %s\n", - factionid(u->faction), S->s); + log_warning(("NEUSTART mit falschem Passwort für Partei %s: %s\n", + factionid(u->faction), S->s)); continue; } restart(u, frace); diff --git a/src/common/kernel/build.c b/src/common/kernel/build.c index d4da451d5..6cc66b475 100644 --- a/src/common/kernel/build.c +++ b/src/common/kernel/build.c @@ -421,11 +421,10 @@ destroy(region * r, unit * u, const char * cmd) add_message(&u->faction->msgs, new_message( u->faction, "shipdestroy_partial%u:unit%r:region%h:ship", u, r, sh)); } - } else - printf("* Fehler im Program! Die Einheit %s von %s\n" - " (Spieler: %s) war owner eines objects,\n" - " war aber weder in einer Burg noch in einem Schiff.\n", - unitname(u), u->faction->name, u->faction->email); + } else { + log_error(("Die Einheit %s von %s war owner eines objects, war aber weder in einer Burg noch in einem Schiff.\n", + unitname(u), u->faction->name, u->faction->email)); + } #if 0 /* Achtung: Nicht an ZERSTÖRE mit Punktangabe angepaßt! */ diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index 43fb720b1..54193ef2a 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -2842,11 +2842,11 @@ movewhere(region * r, const unit *u) #endif if (!rconnect(r, d)) { -#if USE_CREATION +#ifdef USE_CREATION makeblock(r->x + delta_x[d], r->y + delta_y[d], 1); - printf("* Fehler! Region (%d,%d) hatte seine Nachbarn " + log_error((("Region (%d,%d) hatte seine Nachbarn " "(%d,%d) noch nicht generiert!\n", r->x, r->y, - r->x + delta_x[d], r->y + delta_y[d]); + r->x + delta_x[d], r->y + delta_y[d])); #else add_message(&u->faction->msgs, msg_message("moveblocked", "unit direction", u, d)); @@ -2856,9 +2856,9 @@ movewhere(region * r, const unit *u) r2 = rconnect(r, d); if (!r2) { - printf("* Fehler! Region (%d,%d) hatte seine Nachbarn " + log_error(("Region (%d,%d) hatte seine Nachbarn " "(%d,%d) nicht gefunden!", r->x, r->y, - r->x + delta_x[d], r->y + delta_y[d]); + r->x + delta_x[d], r->y + delta_y[d])); return 0; } @@ -2872,7 +2872,7 @@ movewhere(region * r, const unit *u) * auch schon alle existieren. Dies erleichtert das Umherschauen bei * den Reports! */ -#if USE_CREATION +#ifdef USE_CREATION for (d = 0; d != MAXDIRECTIONS; d++) if (!rconnect(r2, d)) makeblock(r2->x + delta_x[d], r2->y + delta_y[d], 1); diff --git a/src/common/kernel/movement.c b/src/common/kernel/movement.c index 79b115394..4f3b0fa52 100644 --- a/src/common/kernel/movement.c +++ b/src/common/kernel/movement.c @@ -676,9 +676,6 @@ ship_in_storm(unit *cap, region *next_point) if(i) fset(cap, UFL_STORM); } -#define USE_CREATION 0 -/* ------------------------------------------------------------- */ - static boolean present(region * r, unit * u) { diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index 011bc8958..54698b6da 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -253,7 +253,7 @@ rds(FILE * F, char **ds) if (s - buffer > DISPLAYSIZE) { assert(s <= buffer + DISPLAYSIZE + 1); *s = 0; - printf("\nDer String %s wurde nicht terminiert.\n", s); + log_error(("\nDer String %s wurde nicht terminiert.\n", s)); exit(1); } rc(F); @@ -665,7 +665,7 @@ readorders(const char *filename) fclose(F); puts("\n"); - printf(" %d Befehlsdateien gelesen\n", nfactions); + log_printf(" %d Befehlsdateien gelesen\n", nfactions); return 0; } /* ------------------------------------------------------------- */ @@ -1237,12 +1237,7 @@ writeunit(FILE * F, const unit * u) wnl(F); assert(u->number >= 0); -#ifdef MONEY_BUG - if (get_money(u) < 0) - printf("Einheit %s hat %d silber", unitname(u), get_money(u)); -#else assert(u->race); -#endif for (i=0;i!=u->skill_size;++i) { skill * sv = u->skills+i; @@ -1741,16 +1736,8 @@ readgame(const char * filename, int backup) if (backup) create_backup(buf); F = cfopen(buf, "r"); if (F==NULL) { - printf("Keine Spieldaten gefunden.\n"); -#if 0 - printf("Neues Spiel (j/n)? "); - if (tolower(getchar()) != 'j') { - exit(0); - } - return creategame(); -#else + log_error(("Keine Spieldaten gefunden.\n")); return -1; -#endif } rc(F); @@ -1774,9 +1761,7 @@ readgame(const char * filename, int backup) ++basearg; } if (strcmp(basearg, basefile)!=0) { - printf("WARNING: xmlfile mismatch:\n"); - printf("WARNING: datafile contains %s\n", basefile); - printf("WARNING: argument/default is %s\n", basearg); + log_warning(("xmlfile mismatch: datafile contains %s, argument/default is %s\n", basefile, basearg)); printf("WARNING: any key to continue, Ctrl-C to stop\n"); getchar(); } diff --git a/src/common/kernel/spell.c b/src/common/kernel/spell.c index 24bacb941..b62ee6813 100644 --- a/src/common/kernel/spell.c +++ b/src/common/kernel/spell.c @@ -1798,90 +1798,73 @@ sp_great_drought(castorder *co) static int sp_treewalkenter(castorder *co) { - region *r = co->rt; - unit *mage = (unit *)co->magician; - spellparameter *pa = co->par; - double power = co->force; - int cast_level = co->level; - region *rt; - unit *u, *u2; - int remaining_cap; - int n; - int erfolg = 0 ; + region *r = co->rt; + unit *mage = (unit *)co->magician; + spellparameter *pa = co->par; + double power = co->force; + int cast_level = co->level; + region *rt; + int remaining_cap; + int n; + int erfolg = 0; - if (getplane(r) != 0) { - cmistake(mage, strdup(co->order), 190, MSG_MAGIC); - return 0; - } + if (getplane(r) != 0) { + cmistake(mage, strdup(co->order), 190, MSG_MAGIC); + return 0; + } - if (!r_isforest(r)) { - cmistake(mage, strdup(co->order), 191, MSG_MAGIC); - return 0; - } + if (!r_isforest(r)) { + cmistake(mage, strdup(co->order), 191, MSG_MAGIC); + return 0; + } - rt = r_standard_to_astral(r); - if(!rt || is_cursed(rt->attribs, C_ASTRALBLOCK, 0)) { - cmistake(mage, strdup(co->order), 192, MSG_MAGIC); - return 0; - } + rt = r_standard_to_astral(r); + if(!rt || is_cursed(rt->attribs, C_ASTRALBLOCK, 0)) { + cmistake(mage, strdup(co->order), 192, MSG_MAGIC); + return 0; + } - assert(rt != NULL); + assert(rt != NULL); - remaining_cap = (int)(power * 500); + remaining_cap = (int)(power * 500); - /* fuer jede Einheit */ - for (n = 0; n < pa->length; n++) { - if(pa->param[n]->flag == TARGET_RESISTS - || pa->param[n]->flag == TARGET_NOTFOUND) - continue; + /* fuer jede Einheit */ + for (n = 0; n < pa->length; n++) { + unit * u = pa->param[n]->data.u; + spllprm * param = pa->param[n]; - u = pa->param[n]->data.u; + if (param->flag & (TARGET_RESISTS|TARGET_NOTFOUND)) { + continue; + } - if(!ucontact(u, mage)) { - cmistake(mage, strdup(co->order), 73, MSG_MAGIC); - } else { - int w = weight(u); - if(!can_survive(u, rt)) { - cmistake(mage, strdup(co->order), 231, MSG_MAGIC); - } else if(remaining_cap - w < 0) { - sprintf(buf, "%s ist zu schwer.", unitname(u)); - addmessage(r, mage->faction, buf, MSG_MAGIC, ML_WARN); - } else { - remaining_cap = remaining_cap - w; - move_unit(u, rt, NULL); - erfolg = cast_level; + if (!ucontact(u, mage)) { + cmistake(mage, strdup(co->order), 73, MSG_MAGIC); + } else { + int w; + + if (!can_survive(u, rt)) { + cmistake(mage, strdup(co->order), 231, MSG_MAGIC); + continue; + } - /* Meldungen in der Ausgangsregion */ + w = weight(u); + if (remaining_cap - w < 0) { + ADDMSG(&mage->faction->msgs, msg_message("fail_tooheavy", + "command region unit target", co->order, r, mage, u)); + continue; + } + remaining_cap = remaining_cap - w; + move_unit(u, rt, NULL); + erfolg = cast_level; - for (u2 = r->units; u2; u2 = u2->next) freset(u2->faction, FL_DH); + /* Meldungen in der Ausgangsregion */ + ADDMSG(&r->msgs, msg_message("astral_disappear", "unit", u)); - for(u2 = r->units; u2; u2 = u2->next ) { - if(!fval(u2->faction, FL_DH)) { - fset(u2->faction, FL_DH); - if(cansee(u2->faction, r, u, 0)) { - sprintf(buf, "%s wird durchscheinend und verschwindet.", - unitname(u)); - addmessage(r, u2->faction, buf, MSG_EVENT, ML_INFO); - } - } - } - - /* Meldungen in der Zielregion */ - - for (u2 = r->units; u2; u2 = u2->next) freset(u2->faction, FL_DH); - for(u2 = rt->units; u2; u2 = u2->next ) { - if(!fval(u2->faction, FL_DH)) { - fset(u2->faction, FL_DH); - if(cansee(u2->faction, rt, u, 0)) { - sprintf(buf, "%s erscheint plötzlich.", unitname(u)); - addmessage(rt, u2->faction, buf, MSG_EVENT, ML_INFO); - } - } - } - } - } - } - return erfolg; + /* Meldungen in der Zielregion */ + ADDMSG(&rt->msgs, msg_message("astral_appear", "unit", u)); + } + } + return erfolg; } /* ------------------------------------------------------------- */ @@ -3601,7 +3584,7 @@ sp_chaossuction(castorder *co) unit *mage = (unit *)co->magician; int cast_level = co->level; - if(getplane(r)) { + if (getplane(r)!=get_normalplane()) { /* Der Zauber funktioniert nur in der materiellen Welt. */ cmistake(mage, strdup(co->order), 190, MSG_MAGIC); return 0; @@ -3609,7 +3592,7 @@ sp_chaossuction(castorder *co) rt = r_standard_to_astral(r); - if(!rt || is_cursed(rt->attribs, C_ASTRALBLOCK, 0)) { + if (rt==NULL || is_cursed(rt->attribs, C_ASTRALBLOCK, 0)) { /* Hier gibt es keine Verbindung zur astralen Welt.*/ cmistake(mage, strdup(co->order), 216, MSG_MAGIC); return 0; @@ -5795,8 +5778,7 @@ sp_resist_magic_bonus(castorder *co) } /* ------------------------------------------------------------- */ -/* "ZAUBERE [STUFE n] \"Astraler Weg\" [ ] - * [ ...]", +/* "ZAUBERE [STUFE n] \"Astraler Weg\" [ ...]", * * Parameter: * pa->param[0]->data.s @@ -6165,115 +6147,101 @@ sp_leaveastral(castorder *co) int sp_fetchastral(castorder *co) { - region *rt, *ro; - unit *u, *u2; - int remaining_cap; - int n, w; - region *r = co->rt; - unit *mage = (unit *)co->magician; - int cast_level = co->level; - double power = co->force; - spellparameter *pa = co->par; + int n; + unit *mage = (unit *)co->magician; + int cast_level = co->level; + spellparameter *pa = co->par; + double power = co->force; + int remaining_cap = (int)((power-3) * 1500); + region_list * rtl = NULL; + region * rt = co->rt; + region * ro = NULL; - switch(getplaneid(r)) { - case 0: - rt = r; - ro = r_standard_to_astral(r); - if(!ro) { - cmistake(mage, strdup(co->order), 216, MSG_MAGIC); - return 0; - } - break; - default: - sprintf(buf, "Der Zauber funktioniert nur in der materiellen Welt."); - addmessage(r, mage->faction, buf, MSG_MAGIC, ML_MISTAKE); - return 0; - } + if (rplane(rt)!=get_normalplane()) { + ADDMSG(&mage->faction->msgs, msg_message("error190", + "command region unit", co->order, rt, mage)); + return 0; + } - if(!ro - || is_cursed(ro->attribs, C_ASTRALBLOCK, 0) - || is_cursed(rt->attribs, C_ASTRALBLOCK, 0)) { - sprintf(buf, "Die Wege aus dieser astralen Region sind blockiert."); - addmessage(r, mage->faction, buf, MSG_MAGIC, ML_MISTAKE); - return 0; - } + if (is_cursed(rt->attribs, C_ASTRALBLOCK, 0)) { + ADDMSG(&mage->faction->msgs, msg_message("spellfail_distance", + "command region unit", co->order, rt, mage)); + return 0; + } - remaining_cap = (int)((power-3) * 1500); + /* für jede Einheit in der Kommandozeile */ + for (n=0; n!=pa->length; ++n) { + unit * u = pa->param[n]->data.u; + int w; - /* für jede Einheit in der Kommandozeile */ - for (n = 0; n < pa->length; n++) { + if (pa->param[n]->flag & TARGET_NOTFOUND) continue; - if(pa->param[n]->flag == TARGET_NOTFOUND) continue; + if (u->region!=ro) { + /* this can happen several times if the units are from different astral + * regions. Only possible on the intersections of schemes */ + region_list * rfind; + rt = u->region; + if (rtl!=NULL) free_regionlist(rtl); + rtl = astralregions(rt, NULL); + for (rfind=rtl;rfind!=NULL;rfind=rfind->next) { + if (rfind->data==ro) break; + } + if (rfind==NULL) { + /* the region r is not in the schemes of rt */ + ADDMSG(&mage->faction->msgs, msg_message("spellfail_distance", + "command region unit target", co->order, ro, mage, u)); + continue; + } + } - u = pa->param[n]->data.u; - - if (ro != u->region) { - sprintf(buf, "%s ist zu weit von %s entfernt.", - unitname(u), unitname(mage)); - addmessage(r, mage->faction, buf, MSG_EVENT, ML_MISTAKE); + if (is_cursed(rt->attribs, C_ASTRALBLOCK, 0)) { + ADDMSG(&mage->faction->msgs, msg_message("spellfail_distance", + "command region unit", co->order, ro, mage)); continue; } - if (!ucontact(u, mage)) { - if (power > 12 && !pa->param[n]->flag == TARGET_RESISTS && can_survive(u, rt)) { - sprintf(buf, "%s hat uns nicht kontaktiert, widersteht dem " - "Zauber jedoch nicht.", unitname(u)); - addmessage(r, mage->faction, buf, MSG_MAGIC, ML_INFO); - sprintf(buf, "%s wird von %s in eine andere Welt geschleudert.", - unitname(u), - cansee(u->faction, r, mage, 0)?unitname(mage):"jemandem"); - addmessage(r, u->faction, buf, MSG_EVENT, ML_WARN); - } else { - sprintf(buf, "%s hat uns nicht kontaktiert und widersteht dem " - "Zauber.", unitname(u)); - addmessage(r, mage->faction, buf, MSG_MAGIC, ML_WARN); - sprintf(buf, "%s versucht, %s in eine andere Welt zu schleudern.", - cansee(u->faction, r, mage, 0)?unitname(mage):"Jemand", - unitname(u)); - addmessage(r, u->faction, buf, MSG_EVENT, ML_WARN); - continue; - } - } + if (!can_survive(u, rt)) { + cmistake(mage, strdup(co->order), 231, MSG_MAGIC); + continue; + } - w = weight(u); - if(!can_survive(u, rt)) { - cmistake(mage, strdup(co->order), 231, MSG_MAGIC); - } else if(remaining_cap - w < 0) { - addmessage(r, mage->faction, "Die Einheit ist zu schwer.", - MSG_MAGIC, ML_MISTAKE); - } else { - remaining_cap = remaining_cap - w; - move_unit(u, rt, NULL); + w = weight(u); + if (remaining_cap - w < 0) { + ADDMSG(&mage->faction->msgs, msg_message("fail_tooheavy", + "command region unit target", co->order, ro, mage, u)); + continue; + } - /* Meldungen in der Ausgangsregion */ + if (!ucontact(u, mage)) { + if (power>12 && !(pa->param[n]->flag & TARGET_RESISTS)) { + sprintf(buf, "%s hat uns nicht kontaktiert, widersteht dem " + "Zauber jedoch nicht.", unitname(u)); + addmessage(rt, mage->faction, buf, MSG_MAGIC, ML_INFO); + sprintf(buf, "%s wird von %s in eine andere Welt geschleudert.", + unitname(u), unitname(mage)); + addmessage(rt, u->faction, buf, MSG_EVENT, ML_WARN); + } else { + sprintf(buf, "%s hat uns nicht kontaktiert und widersteht dem " + "Zauber.", unitname(u)); + addmessage(rt, mage->faction, buf, MSG_MAGIC, ML_WARN); + sprintf(buf, "%s versucht, %s in eine andere Welt zu schleudern.", + unitname(mage), unitname(u)); + addmessage(ro, u->faction, buf, MSG_EVENT, ML_WARN); + continue; + } + } - for (u2 = ro->units; u2; u2 = u2->next) freset(u2->faction, FL_DH); - for(u2 = ro->units; u2; u2 = u2->next ) { - if(!fval(u2->faction, FL_DH)) { - fset(u2->faction, FL_DH); - if(cansee(u2->faction, ro, u, 0)) { - sprintf(buf, "%s wird durchscheinend und verschwindet.", - unitname(u)); - addmessage(ro, u2->faction, buf, MSG_EVENT, ML_INFO); - } - } - } + remaining_cap -= w; + move_unit(u, rt, NULL); - /* Meldungen in der Zielregion */ + /* Meldungen in der Ausgangsregion */ + ADDMSG(&ro->msgs, msg_message("astral_disappear", "unit", u)); - for (u2 = rt->units; u2; u2 = u2->next) freset(u2->faction, FL_DH); - for (u2 = rt->units; u2; u2 = u2->next ) { - if(!fval(u2->faction, FL_DH)) { - fset(u2->faction, FL_DH); - if(cansee(u2->faction, rt, u, 0)) { - sprintf(buf, "%s erscheint plötzlich.", unitname(u)); - addmessage(rt, u2->faction, buf, MSG_EVENT, ML_INFO); - } - } - } - } - } - return cast_level; + /* Meldungen in der Zielregion */ + ADDMSG(&rt->msgs, msg_message("astral_appear", "unit", u)); + } + if (rtl!=NULL) free_regionlist(rtl); + return cast_level; } #ifdef SHOWASTRAL_NOT_BORKED diff --git a/src/eressea/korrektur.c b/src/eressea/korrektur.c index b77e75d9e..1eb294a3f 100644 --- a/src/eressea/korrektur.c +++ b/src/eressea/korrektur.c @@ -951,16 +951,16 @@ fix_gates(void) static int fix_astralplane(void) { - plane * astralplane = getplanebyname("Astralraum"); + plane * astralplane = get_astralplane(); region * r; region_list * rlist = NULL; - if (astralplane) { - freset(astralplane, PFL_NOCOORDS); - freset(astralplane, PFL_NOFEED); - set_ursprung(findfaction(MONSTER_FACTION), astralplane->id, 0, 0); - } - for (r=regions;r;r=r->next) { + if (astralplane) { + freset(astralplane, PFL_NOCOORDS); + freset(astralplane, PFL_NOFEED); + set_ursprung(findfaction(MONSTER_FACTION), astralplane->id, 0, 0); + } + for (r=regions;r;r=r->next) if (rplane(r)==astralplane) { region * ra = r_standard_to_astral(r); if (ra==NULL) continue; if (r->terrain!=T_FIREWALL) continue; @@ -968,9 +968,10 @@ fix_astralplane(void) if (ra->units!=NULL) { add_regionlist(&rlist, ra); } + log_printf("protecting firewall in %s by blocking astral space in %s.\n", regionname(r), regionname(ra)); terraform(ra, T_ASTRALB); } - while (rlist) { + while (rlist!=NULL) { region_list * rnew = rlist; region * r = rnew->data; direction_t dir; @@ -999,7 +1000,7 @@ fix_astralplane(void) } free(rnew); } - return 0; + return 0; } static int diff --git a/src/res/messages.xml b/src/res/messages.xml index 7d274d435..2c5b3d067 100644 --- a/src/res/messages.xml +++ b/src/res/messages.xml @@ -5560,9 +5560,9 @@ - "$unit($unit) benutzt einen $resource($potion,1)." - "$unit($unit) uses a $resource($potion,1)." - "$unit($unit) uses a $resource($potion,1)." + "$unit($unit) benutzt $resource($potion,1)." + "$unit($unit) uses $resource($potion,1)." + "$unit($unit) uses $resource($potion,1)." @@ -5912,7 +5912,7 @@ "$unit($unit) spielt einen Dudelsack. Ausser sich vor Furcht geben die Bauern $int($money) Silber." "$unit($unit) plays the bagpipe. Stricken with fear the peasants give $int($money) silver." - + @@ -5930,6 +5930,54 @@ "$unit($unit) in $region($region) erschafft eine Skulptur." "$unit($unit) in $region($region) creates a sculpture." - + + + + + + + + + "$unit($unit) in $region($region): '$order($command)' - $unit($target) ist zu weit entfernt." + "$unit($unit) in $region($region): '$order($command)' - $unit($target) is too far away." + + + + + + + + + "$unit($unit) in $region($region): '$order($command)' - Die Wege aus dieser Region sind blockiert." + "$unit($unit) in $region($region): '$order($command)' - The connections from to this regions are blocked." + + + + + + + "$unit($unit) erscheint plötzlich." + "$unit($unit) appears." + + + + + + + "$unit($unit) wird durchscheinend und verschwindet." + "$unit($unit) disappears." + + + + + + + + + + "$unit($unit) in $region($region): '$order($command)' - $unit($target) ist zu schwer." + "$unit($unit) in $region($region): '$order($command)' - $unit($target) is too heavy." + +