bugfix: water of life

initialization of potion text
removing #if 0 code.
This commit is contained in:
Enno Rehling 2005-10-30 09:51:02 +00:00
parent 1113d3d7e9
commit ada8c3a52d
13 changed files with 27 additions and 164 deletions

View File

@ -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) { for (a=a_find(f->attribs, &at_showitem);a;a=a->nexttype) {
const potion_type * ptype = resource2potion(((const item_type*)a->data.v)->rtype); const potion_type * ptype = resource2potion(((const item_type*)a->data.v)->rtype);
requirement * m; requirement * m;
const char * ch, * description; const char * ch, * description = NULL;
if (ptype==NULL) continue; if (ptype==NULL) continue;
m = ptype->itype->construction->materials; 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, "\"%s\";Name\n", add_translation(ch, locale_string(f->locale, ch)));
fprintf(F, "%d;Stufe\n", ptype->level); fprintf(F, "%d;Stufe\n", ptype->level);
description = ptype->text; if (description==NULL) {
if (description==NULL || f->locale!=find_locale("de")) {
const char * pname = resourcename(ptype->itype->rtype, 0); const char * pname = resourcename(ptype->itype->rtype, 0);
const char * potiontext = mkname("potion", pname); const char * potiontext = mkname("potion", pname);
description = LOC(f->locale, potiontext); description = LOC(f->locale, potiontext);
if (strcmp(description, potiontext)==0) {
/* string not found */
description = ptype->text;
}
} }
fprintf(F, "\"%s\";Beschr\n", description); fprintf(F, "\"%s\";Beschr\n", description);

View File

@ -2331,7 +2331,10 @@ plant(region *r, unit *u, int raw)
{ {
int n, i, skill, planted = 0; 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)) { if (!fval(r->terrain, LAND_REGION)) {
return; return;
} }
@ -2350,10 +2353,9 @@ plant(region *r, unit *u, int raw)
return; return;
} }
/* Wasser des Lebens prüfen */ /* 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, add_message(&u->faction->msgs,
msg_feedback(u, u->thisorder, "resource_missing", "missing", msg_feedback(u, u->thisorder, "resource_missing", "missing", rt_water));
oldresourcetype[R_TREES]));
return; return;
} }
n = new_get_pooled(u, itype->rtype, GET_DEFAULT); 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); produceexp(u, SK_HERBALISM, u->number);
/* Alles ok. Abziehen. */ /* 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); new_use_pooled(u, itype->rtype, GET_DEFAULT, n);
rsetherbs(r, rherbs(r)+planted); rsetherbs(r, rherbs(r)+planted);
add_message(&u->faction->msgs, new_message(u->faction, ADDMSG(&u->faction->msgs, msg_message("plant", "unit region amount herb",
"plant%u:unit%r:region%i:amount%X:herb", u, r, planted, itype->rtype)); u, r, planted, itype->rtype));
} }
static void static void

View File

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

View File

@ -113,26 +113,6 @@ extern weapon_type * oldweapontype[];
static int missile_range[2] = {FIGHT_ROW, BEHIND_ROW}; static int missile_range[2] = {FIGHT_ROW, BEHIND_ROW};
static int melee_range[2] = {FIGHT_ROW, FIGHT_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}; const troop no_troop = {0, 0};
region * region *
@ -2379,7 +2359,6 @@ aftermath(battle * b)
#endif #endif
} }
/* validate_sides(b); */
/* POSTCOMBAT */ /* POSTCOMBAT */
do_combatmagic(b, DO_POSTCOMBATSPELL); do_combatmagic(b, DO_POSTCOMBATSPELL);

View File

@ -723,16 +723,6 @@ build(unit * u, const construction * ctype, int completed, int want)
int canuse = have; int canuse = have;
if (inside_building(u)) { if (inside_building(u)) {
canuse = matmod(u->building->type->attribs, u, rtype, canuse); 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 */ if (canuse<0) return canuse; /* pass errors to caller */
canuse = matmod(type->attribs, u, rtype, canuse); 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; const construction * construction = sh->type->construction;
int size = (sh->size * DAMAGE_SCALE - sh->damage) / DAMAGE_SCALE; int size = (sh->size * DAMAGE_SCALE - sh->damage) / DAMAGE_SCALE;
int n; 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); int can = build(u, construction, size, want);
if ((n=construction->maxsize - sh->size)>0 && can>0) { if ((n=construction->maxsize - sh->size)>0 && can>0) {

View File

@ -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); removelist(&b->region->buildings, b);
#endif #endif
/* Stattdessen nur aus Liste entfernen, aber im Speicher halten. */ /* Stattdessen nur aus Liste entfernen, aber im Speicher halten. */

View File

@ -669,59 +669,6 @@ enum {
#define FL_ITEM_ANIMAL (1<<3) /* ist ein Tier */ #define FL_ITEM_ANIMAL (1<<3) /* ist ein Tier */
#define FL_ITEM_MOUNT ((1<<4) | FL_ITEM_ANIMAL) /* ist ein Reittier */ #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 /* Kann auch von Nichtmagier benutzt werden, modifiziert Taktik für diese
* Runde um -1 - 4 Punkte. */ * Runde um -1 - 4 Punkte. */
@ -1184,11 +1131,7 @@ init_olditems(void)
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 " NULL,
"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 " "Das 'Wasser des Lebens' ist in der Lage, aus gefällten Baumstämmen "
@ -1450,7 +1393,9 @@ init_oldpotions(void)
for (p=0;p!=MAXPOTIONS;++p) { for (p=0;p!=MAXPOTIONS;++p) {
item_type * itype = it_find(potionnames[p]); item_type * itype = it_find(potionnames[p]);
itype->rtype->ptype->text = potiontext[p]; if (potiontext[p]) {
locale_setstring(default_locale, mkname("potion", potionnames[p]), potiontext[p]);
}
oldpotiontype[p] = itype->rtype->ptype; oldpotiontype[p] = itype->rtype->ptype;
} }
} }

View File

@ -136,7 +136,6 @@ typedef struct potion_type {
struct potion_type * next; struct potion_type * next;
const item_type * itype; const item_type * itype;
int level; int level;
const char * text;
} potion_type; } potion_type;
extern potion_type * potiontypes; extern potion_type * potiontypes;
@ -347,9 +346,6 @@ enum {
R_SACK_OF_CONSERVATION, R_SACK_OF_CONSERVATION,
R_TACTICCRYSTAL, R_TACTICCRYSTAL,
/* POTIONS: */
R_TREES,
/* SONSTIGE */ /* SONSTIGE */
R_SILVER, R_SILVER,
R_AURA, /* Aura */ R_AURA, /* Aura */

View File

@ -1082,12 +1082,8 @@ readunit(FILE * F)
} }
if (u->faction == NULL) { if (u->faction == NULL) {
log_error(("unit %s has faction == NULL\n", unitname(u))); log_error(("unit %s has faction == NULL\n", unitname(u)));
#if 0
abort();
#else
u_setfaction(u, findfaction(MONSTER_FACTION)); u_setfaction(u, findfaction(MONSTER_FACTION));
set_number(u, 0); set_number(u, 0);
#endif
} }
if (playerrace(u->race)) { if (playerrace(u->race)) {
u->faction->no_units++; u->faction->no_units++;

View File

@ -307,17 +307,6 @@ game_done(void)
free(used_faction_ids); free(used_faction_ids);
for (r = regions; r; r = r2) { 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) { for (u = r->units; u; u = u2) {
u2 = u->next; u2 = u->next;
stripunit(u); stripunit(u);

View File

@ -456,34 +456,6 @@ ParteiListe(void)
addstr("generiere Liste..."); addstr("generiere Liste...");
refresh(); 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) { for (f = factions; f; f = f->next) {
if (SX > 104) if (SX > 104)
sprintf(buf, "%4s: %-30.30s %-12.12s %-24.24s", factionid(f), sprintf(buf, "%4s: %-30.30s %-12.12s %-24.24s", factionid(f),

View File

@ -3782,6 +3782,13 @@
</string> </string>
</namespace> </namespace>
<namespace name="potion"> <namespace name="potion">
<string name="p0">
<text locale="de">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.</text>
</string>
<string name="truthpotion"> <string name="truthpotion">
<text locale="de">Dieses wirkungsvolle einfache Gebräu <text locale="de">Dieses wirkungsvolle einfache Gebräu
schärft die Sinne des Trinkenden derart, daß er in der schärft die Sinne des Trinkenden derart, daß er in der
@ -6924,5 +6931,6 @@

View File

@ -22,6 +22,7 @@ Larger Features:
- eressea (b/g)zip reports? - eressea (b/g)zip reports?
- mailit-format ändern? - mailit-format ändern?
- NO_RUNNING - NO_RUNNING
- ZERSTÖRE - Man sollte alle Materialien zurückkriegen können:
Scripts, etc: Scripts, etc:
- format=flowed annahme, eressea - format=flowed annahme, eressea