From ada8c3a52dfccb885c5f26be54569e65b3d21ad8 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 30 Oct 2005 09:51:02 +0000 Subject: [PATCH] bugfix: water of life initialization of potion text removing #if 0 code. --- src/common/gamecode/creport.c | 9 ++--- src/common/gamecode/economy.c | 16 +++++---- src/common/gamecode/report.c | 7 +--- src/common/kernel/battle.c | 21 ----------- src/common/kernel/build.c | 15 -------- src/common/kernel/building.c | 2 +- src/common/kernel/item.c | 65 +++-------------------------------- src/common/kernel/item.h | 4 --- src/common/kernel/save.c | 4 --- src/eressea/main.c | 11 ------ src/mapper/map_partei.c | 28 --------------- src/res/de/strings.xml | 8 +++++ src/todo.txt | 1 + 13 files changed, 27 insertions(+), 164 deletions(-) diff --git a/src/common/gamecode/creport.c b/src/common/gamecode/creport.c index 5b2c39efc..e672db64c 100644 --- a/src/common/gamecode/creport.c +++ b/src/common/gamecode/creport.c @@ -1205,7 +1205,7 @@ report_computer(FILE * F, faction * f, struct seen_region ** seen, const faction for (a=a_find(f->attribs, &at_showitem);a;a=a->nexttype) { const potion_type * ptype = resource2potion(((const item_type*)a->data.v)->rtype); requirement * m; - const char * ch, * description; + const char * ch, * description = NULL; if (ptype==NULL) continue; m = ptype->itype->construction->materials; @@ -1214,15 +1214,10 @@ report_computer(FILE * F, faction * f, struct seen_region ** seen, const faction fprintf(F, "\"%s\";Name\n", add_translation(ch, locale_string(f->locale, ch))); fprintf(F, "%d;Stufe\n", ptype->level); - description = ptype->text; - if (description==NULL || f->locale!=find_locale("de")) { + if (description==NULL) { const char * pname = resourcename(ptype->itype->rtype, 0); const char * potiontext = mkname("potion", pname); description = LOC(f->locale, potiontext); - if (strcmp(description, potiontext)==0) { - /* string not found */ - description = ptype->text; - } } fprintf(F, "\"%s\";Beschr\n", description); diff --git a/src/common/gamecode/economy.c b/src/common/gamecode/economy.c index b7c10c212..aff8ed8f8 100644 --- a/src/common/gamecode/economy.c +++ b/src/common/gamecode/economy.c @@ -2330,8 +2330,11 @@ static void plant(region *r, unit *u, int raw) { int n, i, skill, planted = 0; - const item_type * itype; + const item_type * itype; + static const resource_type * rt_water = NULL; + if (rt_water==NULL) rt_water = rt_find("p2"); + assert(rt_water!=NULL); if (!fval(r->terrain, LAND_REGION)) { return; } @@ -2350,10 +2353,9 @@ plant(region *r, unit *u, int raw) return; } /* Wasser des Lebens prüfen */ - if (new_get_pooled(u, oldresourcetype[R_TREES], GET_DEFAULT) == 0) { + if (new_get_pooled(u, rt_water, GET_DEFAULT) == 0) { add_message(&u->faction->msgs, - msg_feedback(u, u->thisorder, "resource_missing", "missing", - oldresourcetype[R_TREES])); + msg_feedback(u, u->thisorder, "resource_missing", "missing", rt_water)); return; } n = new_get_pooled(u, itype->rtype, GET_DEFAULT); @@ -2374,11 +2376,11 @@ plant(region *r, unit *u, int raw) produceexp(u, SK_HERBALISM, u->number); /* Alles ok. Abziehen. */ - new_use_pooled(u, oldresourcetype[R_TREES], GET_DEFAULT, 1); + new_use_pooled(u, rt_water, GET_DEFAULT, 1); new_use_pooled(u, itype->rtype, GET_DEFAULT, n); rsetherbs(r, rherbs(r)+planted); - add_message(&u->faction->msgs, new_message(u->faction, - "plant%u:unit%r:region%i:amount%X:herb", u, r, planted, itype->rtype)); + ADDMSG(&u->faction->msgs, msg_message("plant", "unit region amount herb", + u, r, planted, itype->rtype)); } static void diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index 344b97b2f..2acb73a8b 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -2158,14 +2158,9 @@ report(FILE *F, faction * f, struct seen_region ** seen, const faction_list * ad } centre(F, buf, true); rnl(F); - description = ptype->text; - if (description==NULL || f->locale!=find_locale("de")) { + if (description==NULL) { const char * potiontext = mkname("potion", pname); description = LOC(f->locale, potiontext); - if (strcmp(description, potiontext)==0) { - /* string not found */ - description = ptype->text; - } } centre(F, description, true); } diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index d3fa012fd..10e8b28db 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -113,26 +113,6 @@ extern weapon_type * oldweapontype[]; static int missile_range[2] = {FIGHT_ROW, BEHIND_ROW}; static int melee_range[2] = {FIGHT_ROW, FIGHT_ROW}; -#if 0 -/* not in use */ -static void -validate_sides(battle * b) -{ - side* s; - cv_foreach(s, b->sides) { - int snumber = 0; - fighter *df; - cv_foreach(df, s->fighters) { - unit *du = df->unit; - snumber += du->number; - } cv_next(df); - assert(snumber==s->flee+s->healed+s->alive+s->dead); - } cv_next(s); -} -#else -#define validate_sides(b) /**/ -#endif - const troop no_troop = {0, 0}; region * @@ -2379,7 +2359,6 @@ aftermath(battle * b) #endif } - /* validate_sides(b); */ /* POSTCOMBAT */ do_combatmagic(b, DO_POSTCOMBATSPELL); diff --git a/src/common/kernel/build.c b/src/common/kernel/build.c index 80f64266c..f6bbac16e 100644 --- a/src/common/kernel/build.c +++ b/src/common/kernel/build.c @@ -723,16 +723,6 @@ build(unit * u, const construction * ctype, int completed, int want) int canuse = have; if (inside_building(u)) { canuse = matmod(u->building->type->attribs, u, rtype, canuse); -#if 0 - /* exploit-check */ - } else if (u->building) { - int abuse = matmod(u->building->type->attribs, u, rtype, canuse); - if (abuse>canuse) { - log_printf("ABUSE: %s saves %u %s through exploit\n", - itoa36(u->faction->no), abuse-canuse, - oldresourcetype[rtype]->_name[0]); - } -#endif } if (canuse<0) return canuse; /* pass errors to caller */ canuse = matmod(type->attribs, u, rtype, canuse); @@ -976,11 +966,6 @@ build_ship(unit * u, ship * sh, int want) const construction * construction = sh->type->construction; int size = (sh->size * DAMAGE_SCALE - sh->damage) / DAMAGE_SCALE; int n; -#if 0 - int can = u->number * effskill(u, SK_SHIPBUILDING) / construction->minskill; - if (want > 0) can = min(want, can); - can = min(can, construction->maxsize+sh->damage); /* 100% bauen + 100% reparieren */ -#endif int can = build(u, construction, size, want); if ((n=construction->maxsize - sh->size)>0 && can>0) { diff --git a/src/common/kernel/building.c b/src/common/kernel/building.c index 0c29076d6..c08e45f06 100644 --- a/src/common/kernel/building.c +++ b/src/common/kernel/building.c @@ -509,7 +509,7 @@ destroy_building(building * b) } } -#if 0 /* Memoryleak. Aber ohne klappt das Rendern nicht! */ +#if 0 /* TODO: Memoryleak. Aber ohne klappt das Rendern nicht! */ removelist(&b->region->buildings, b); #endif /* Stattdessen nur aus Liste entfernen, aber im Speicher halten. */ diff --git a/src/common/kernel/item.c b/src/common/kernel/item.c index ef6fe2b20..f09973cfa 100644 --- a/src/common/kernel/item.c +++ b/src/common/kernel/item.c @@ -669,59 +669,6 @@ enum { #define FL_ITEM_ANIMAL (1<<3) /* ist ein Tier */ #define FL_ITEM_MOUNT ((1<<4) | FL_ITEM_ANIMAL) /* ist ein Reittier */ -#if 0 -/* ------------------------------------------------------------- */ -/* Sprüche auf Artefakten */ -/* Benutzung magischer Gegenstände */ -/* ------------------------------------------------------------- */ - -/* ------------------------------------------------------------- */ -/* Antimagie - curse auflösen - für Kristall */ -/* ------------------------------------------------------------- */ -static int -destroy_curse_crystal(attrib **alist, int cast_level, int force) -{ - attrib ** ap = alist; - - while (*ap && force > 0) { - curse * c; - attrib * a = *ap; - if (!fval(a->type, ATF_CURSE)) { - do { ap = &(*ap)->next; } while (*ap && a->type==(*ap)->type); - continue; - } - c = (curse*)a->data.v; - - /* Immunität prüfen */ - if (c->flag & CURSE_IMMUN); - - if (cast_level < c->vigour) { /* Zauber ist nicht stark genug */ - /* pro Stufe Unterschied -20% */ - double probability = 1 + (cast_level - c->vigour) * 0.2; - if (chance(probability)) { - if (c->type->change_vigour) - c->type->change_vigour(c, -2); - force -= c->vigour; - c->vigour -= 2; - if(c->vigour <= 0) { - a_remove(alist, a); - } - } - } else { /* Zauber ist stärker als curse */ - if (force >= c->vigour){ /* reicht die Kraft noch aus? */ - force -= c->vigour; - if (c->type->change_vigour) - c->type->change_vigour(c, -c->vigour); - a_remove(alist, a); - } - } - if(*ap) ap = &(*ap)->next; - } - - return force; -} -#endif - /* ------------------------------------------------------------- */ /* Kann auch von Nichtmagier benutzt werden, modifiziert Taktik für diese * Runde um -1 - 4 Punkte. */ @@ -1184,11 +1131,7 @@ init_olditems(void) static const char *potiontext[MAXPOTIONS] = { /* Stufe 1: */ - "Für den Siebenmeilentee koche man einen Blauen Baumringel auf und " - "gieße dieses Gebräu in einen Windbeutel. Das heraustropfende Wasser " - "fange man auf, filtere es und verabreiche es alsdann. Durch diesen " - "Tee können bis zu zehn Menschen schnell wie ein Pferd laufen.", - + NULL, NULL, "Das 'Wasser des Lebens' ist in der Lage, aus gefällten Baumstämmen " @@ -1449,8 +1392,10 @@ init_oldpotions(void) potion_t p; for (p=0;p!=MAXPOTIONS;++p) { - item_type * itype = it_find(potionnames[p]); - itype->rtype->ptype->text = potiontext[p]; + item_type * itype = it_find(potionnames[p]); + if (potiontext[p]) { + locale_setstring(default_locale, mkname("potion", potionnames[p]), potiontext[p]); + } oldpotiontype[p] = itype->rtype->ptype; } } diff --git a/src/common/kernel/item.h b/src/common/kernel/item.h index 4e265273c..511500fdd 100644 --- a/src/common/kernel/item.h +++ b/src/common/kernel/item.h @@ -136,7 +136,6 @@ typedef struct potion_type { struct potion_type * next; const item_type * itype; int level; - const char * text; } potion_type; extern potion_type * potiontypes; @@ -347,9 +346,6 @@ enum { R_SACK_OF_CONSERVATION, R_TACTICCRYSTAL, - /* POTIONS: */ - R_TREES, - /* SONSTIGE */ R_SILVER, R_AURA, /* Aura */ diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index 0d90e3238..570fdc894 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -1082,12 +1082,8 @@ readunit(FILE * F) } if (u->faction == NULL) { log_error(("unit %s has faction == NULL\n", unitname(u))); -#if 0 - abort(); -#else u_setfaction(u, findfaction(MONSTER_FACTION)); set_number(u, 0); -#endif } if (playerrace(u->race)) { u->faction->no_units++; diff --git a/src/eressea/main.c b/src/eressea/main.c index d2a1f7206..72560d57d 100644 --- a/src/eressea/main.c +++ b/src/eressea/main.c @@ -307,17 +307,6 @@ game_done(void) free(used_faction_ids); for (r = regions; r; r = r2) { -#if 0 - msg * m = r->msgs; - while (m) { - msg * x = m; - m = m->next; - if (x->type->finalize) x->type->finalize(x); - free(x); - } - rm = rm->next; - } -#endif for (u = r->units; u; u = u2) { u2 = u->next; stripunit(u); diff --git a/src/mapper/map_partei.c b/src/mapper/map_partei.c index d214381f6..16e4a1cdf 100644 --- a/src/mapper/map_partei.c +++ b/src/mapper/map_partei.c @@ -456,34 +456,6 @@ ParteiListe(void) addstr("generiere Liste..."); refresh(); - /* Momentan unnötig und zeitraubend */ -#if 0 - for (f = factions; f; f = f->next) { - f->num_people = f->nunits = f->nregions = f->money = 0; - } - - x=0; - for (r = regions; r; r = r->next) { - int q=0; char mark[]="_-¯-"; - for (f = factions; f; f = f->next) - freset(f, FL_DH); - if (++x & 256) { - x=0; move(20,1); q++; addch(mark[q&3]); - } - for (u = r->units; u; u = u->next) { - if (u->faction->no != MONSTER_FACTION) { /* Monster nicht */ - if (!fval(u->faction, FL_DH)) { - fset(u->faction, FL_DH); - u->faction->nregions++; - } - u->faction->nunits++; - u->faction->num_people += u->number; - u->faction->money += get_money(u); - } - } - } -#endif - for (f = factions; f; f = f->next) { if (SX > 104) sprintf(buf, "%4s: %-30.30s %-12.12s %-24.24s", factionid(f), diff --git a/src/res/de/strings.xml b/src/res/de/strings.xml index 2fdd31b5f..7e5c85d73 100644 --- a/src/res/de/strings.xml +++ b/src/res/de/strings.xml @@ -3782,6 +3782,13 @@ + + Für den Siebenmeilentee koche man einen Blauen + Baumringel auf und gieße dieses Gebräu in einen Windbeutel. Das + heraustropfende Wasser fange man auf, filtere es und verabreiche es + alsdann. Durch diesen Tee können bis zu zehn Menschen schnell wie ein + Pferd laufen. + Dieses wirkungsvolle einfache Gebräu schärft die Sinne des Trinkenden derart, daß er in der @@ -6924,5 +6931,6 @@ + diff --git a/src/todo.txt b/src/todo.txt index fd888ccd0..8ce172f4f 100644 --- a/src/todo.txt +++ b/src/todo.txt @@ -22,6 +22,7 @@ Larger Features: - eressea (b/g)zip reports? - mailit-format ändern? - NO_RUNNING +- ZERSTÖRE - Man sollte alle Materialien zurückkriegen können: Scripts, etc: - format=flowed annahme, eressea