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) {
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);

View File

@ -2331,7 +2331,10 @@ plant(region *r, unit *u, int raw)
{
int n, i, skill, planted = 0;
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

View File

@ -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);
}

View File

@ -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);

View File

@ -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) {

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);
#endif
/* 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_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 "
@ -1450,7 +1393,9 @@ init_oldpotions(void)
for (p=0;p!=MAXPOTIONS;++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;
}
}

View File

@ -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 */

View File

@ -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++;

View File

@ -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);

View File

@ -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),

View File

@ -3782,6 +3782,13 @@
</string>
</namespace>
<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">
<text locale="de">Dieses wirkungsvolle einfache Gebräu
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?
- mailit-format ändern?
- NO_RUNNING
- ZERSTÖRE - Man sollte alle Materialien zurückkriegen können:
Scripts, etc:
- format=flowed annahme, eressea