From 3449399eece4d0dbbfec14148183e83ee05345a2 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 7 Jul 2004 22:02:42 +0000 Subject: [PATCH] =?UTF-8?q?-=20http://eressea.upb.de/mantis/bug=5Fview=5Fp?= =?UTF-8?q?age.php=3Fbug=5Fid=3D0000147=20=20=20=20Forsche=20Kr=C3=A4uter?= =?UTF-8?q?=20Meldung=20steht=20nur=20in=20Regionsmeldung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - http://eressea.upb.de/mantis/bug_view_page.php?bug_id=0000165 Regionsmeldung "LERNEN Hiebwaffen" --- src/common/gamecode/creport.c | 15 ++++++++--- src/common/gamecode/economy.c | 45 +++++++++++++++++---------------- src/common/kernel/item.c | 11 +++++--- src/common/kernel/movement.c | 1 + src/common/spells/regioncurse.c | 40 +++++++++++++++++++---------- src/common/spells/unitcurse.c | 9 ++++--- src/res/messages.xml | 8 ++++++ 7 files changed, 83 insertions(+), 46 deletions(-) diff --git a/src/common/gamecode/creport.c b/src/common/gamecode/creport.c index c65e06115..3ff0af341 100644 --- a/src/common/gamecode/creport.c +++ b/src/common/gamecode/creport.c @@ -245,13 +245,20 @@ print_curses(FILE * F, const faction * viewer, const void * obj, typ_t typ) if (fval(a->type, ATF_CURSE)) { c = (curse *)a->data.v; - if (c->type->curseinfo){ - if (c->type->cansee){ + if (c->type->curseinfo) { + if (c->type->cansee) { self = c->type->cansee(viewer, obj, typ, c, self); } dh = c->type->curseinfo(viewer->locale, obj, typ, c, self); - } - if (dh == 1) { + } + if (dh==0) { + if (c->type->info_str!=NULL) { + strcpy(buf, c->type->info_str); + } else { + sprintf(buf, "an unknown curse lies on the region. (%s)", itoa36(c->no)); + } + } + if (dh==1) { if (!header) { header = 1; fputs("EFFECTS\n", F); diff --git a/src/common/gamecode/economy.c b/src/common/gamecode/economy.c index 27bcc1839..59cafff0c 100644 --- a/src/common/gamecode/economy.c +++ b/src/common/gamecode/economy.c @@ -2466,35 +2466,36 @@ static void research_cmd(unit *u, struct order * ord) { region *r = u->region; - const char *s = getstrtoken(); init_tokens(ord); skip_token(); - if (findparam(s, u->faction->locale) == P_HERBS) { + /* + const char *s = getstrtoken(); - if (eff_skill(u, SK_HERBALISM, r) < 7) { - cmistake(u, ord, 227, MSG_EVENT); - return; - } + if (findparam(s, u->faction->locale) == P_HERBS) { */ - produceexp(u, SK_HERBALISM, u->number); + if (eff_skill(u, SK_HERBALISM, r) < 7) { + cmistake(u, ord, 227, MSG_EVENT); + return; + } - if (rherbs(r) > 0) { - const herb_type *rht = rherbtype(r); + produceexp(u, SK_HERBALISM, u->number); - if (rht != NULL) { - add_message(&u->faction->msgs, new_message(u->faction, - "researchherb%u:unit%r:region%s:amount%X:herb", u, r, - rough_amount(rherbs(r), 100), rht->itype->rtype)); - } else { - add_message(&u->faction->msgs, new_message(u->faction, - "researchherb_none%u:unit%r:region", u, r)); - } - } else { - add_message(&u->faction->msgs, new_message(u->faction, - "researchherb_none%u:unit%r:region", u, r)); - } - } + if (rherbs(r) > 0) { + const herb_type *rht = rherbtype(r); + + if (rht != NULL) { + add_message(&u->faction->msgs, new_message(u->faction, + "researchherb%u:unit%r:region%s:amount%X:herb", u, r, + rough_amount(rherbs(r), 100), rht->itype->rtype)); + } else { + add_message(&u->faction->msgs, new_message(u->faction, + "researchherb_none%u:unit%r:region", u, r)); + } + } else { + add_message(&u->faction->msgs, new_message(u->faction, + "researchherb_none%u:unit%r:region", u, r)); + } } static int diff --git a/src/common/kernel/item.c b/src/common/kernel/item.c index 2bcdf21d7..3b62f5dda 100644 --- a/src/common/kernel/item.c +++ b/src/common/kernel/item.c @@ -33,10 +33,15 @@ #include "skill.h" #include "unit.h" +/* triggers includes */ +#include +#include + /* util includes */ -#include -#include -#include +#include +#include +#include +#include /* libc includes */ #include diff --git a/src/common/kernel/movement.c b/src/common/kernel/movement.c index 8b186e7ab..20daee85e 100644 --- a/src/common/kernel/movement.c +++ b/src/common/kernel/movement.c @@ -1290,6 +1290,7 @@ travel(unit * u, region * next, int flucht, region_list ** routep) if (can_survive(ut, current)) { travel_route(ut, ut->region, route); move_unit(ut, current, NULL); + // FOLGE! } else { cmistake(u, u->thisorder, 287, MSG_MOVE); cmistake(ut, ut->thisorder, 230, MSG_MOVE); diff --git a/src/common/spells/regioncurse.c b/src/common/spells/regioncurse.c index e22ba885b..b94159243 100644 --- a/src/common/spells/regioncurse.c +++ b/src/common/spells/regioncurse.c @@ -50,8 +50,10 @@ cinfo_region(const struct locale * lang, const void * obj, typ_t typ, struct cur if (msg) { nr_render(msg, lang, buf, sizeof(buf), NULL); msg_release(msg); - } - return 1; + return 1; + } + log_warning(("There is no curseinfo for %s.\n", c->type->cname)); + return 0; } @@ -78,11 +80,15 @@ cinfo_cursed_by_the_gods(const struct locale * lang, const void * obj, typ_t typ } else { msg = msg_message("curseinfo::godcurseocean", "id", c->no); } - nr_render(msg, lang, buf, sizeof(buf), NULL); - msg_release(msg); + if (msg!=NULL) { + nr_render(msg, lang, buf, sizeof(buf), NULL); + msg_release(msg); - return 1; + return 1; + } + return 0; } + static struct curse_type ct_godcursezone = { "godcursezone", CURSETYP_NORM, 0, (NO_MERGE), @@ -113,11 +119,14 @@ cinfo_dreamcurse(const struct locale * lang, const void * obj, typ_t typ, curse } else { msg = msg_message("curseinfo::baddream", "id", c->no); } - nr_render(msg, lang, buf, sizeof(buf), NULL); - msg_release(msg); - - return 1; + if (msg!=NULL) { + nr_render(msg, lang, buf, sizeof(buf), NULL); + msg_release(msg); + return 1; + } + return 0; } + static struct curse_type ct_gbdream = { "gbdream", CURSETYP_NORM, 0, (NO_MERGE), @@ -147,11 +156,14 @@ cinfo_magicstreet(const struct locale * lang, const void * obj, typ_t typ, curse } else { msg = msg_message("curseinfo::magicstreetwarn", "id", c->no); } - nr_render(msg, lang, buf, sizeof(buf), NULL); - msg_release(msg); - - return 1; + if (msg!=NULL) { + nr_render(msg, lang, buf, sizeof(buf), NULL); + msg_release(msg); + return 1; + } + return 0; } + static struct curse_type ct_magicstreet = { "magicstreet", CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR), @@ -351,7 +363,7 @@ static struct curse_type ct_goodmagicresistancezone = { static struct curse_type ct_riotzone = { "riotzone", CURSETYP_NORM, 0, (M_DURATION), - "Eine Wolke negativer Energie liegt über der Region.", + NULL, cinfo_region }; static struct curse_type ct_holyground = { diff --git a/src/common/spells/unitcurse.c b/src/common/spells/unitcurse.c index bec16b1d3..50240ef5d 100644 --- a/src/common/spells/unitcurse.c +++ b/src/common/spells/unitcurse.c @@ -49,9 +49,12 @@ cinfo_unit(const struct locale * lang, const void * obj, typ_t typ, struct curse assert(typ == TYP_UNIT); msg = msg_message(mkname("curseinfo", c->type->cname), "id", c->no); - nr_render(msg, lang, buf, sizeof(buf), NULL); - msg_release(msg); - return 1; + if (msg==NULL) { + nr_render(msg, lang, buf, sizeof(buf), NULL); + msg_release(msg); + return 1; + } + return 0; } static int diff --git a/src/res/messages.xml b/src/res/messages.xml index 3b12aef16..d13099913 100644 --- a/src/res/messages.xml +++ b/src/res/messages.xml @@ -17,6 +17,14 @@ "The power of $unit($mage) flows into the region and the trees which survived the spell appear stronger now." "The power of $unit($mage) flows into the region and the trees which survived the spell appear stronger now." + + + + + "Eine Wolke negativer Energie liegt über der Region. ($int36($id))" + "A fog of negative energy enshrouds the region. ($int36($id))" + "A fog of negative energy enshrouds the region. ($int36($id))" +