ageing für das at_leftship attribut verhinder, dass Einheiten die ein Schiff verlassen haben in der Folgewoche immer noch im Report stehen.

Kosmetischer Fix an der Schock-Meldung.

Weniger Aufrufe von invisible() wenn Einheiten garkeinen Ring haben.
This commit is contained in:
Enno Rehling 2005-07-22 17:13:51 +00:00
parent c3b5c4d198
commit 3db6b2a9fd
4 changed files with 39 additions and 26 deletions

View File

@ -1032,9 +1032,8 @@ cansee(const faction * f, const region * r, const unit * u, int modifier)
/* und es muss niemand aus f in der region sein, wenn sie vom Turm /* und es muss niemand aus f in der region sein, wenn sie vom Turm
* erblickt wird */ * erblickt wird */
{ {
int n; int stealth, rings;
boolean cansee = false; unit *u2 = r->units;
unit *u2;
static const item_type * itype_grail; static const item_type * itype_grail;
static boolean init; static boolean init;
@ -1060,30 +1059,36 @@ cansee(const faction * f, const region * r, const unit * u, int modifier)
if (leftship(u)) return true; if (leftship(u)) return true;
if (itype_grail!=NULL && i_get(u->items, itype_grail)) return true; if (itype_grail!=NULL && i_get(u->items, itype_grail)) return true;
n = eff_stealth(u, r) - modifier; while (u2 && u2->faction != f) u2 = u2->next;
for (u2 = r->units; u2; u2 = u2->next) { if (u2==NULL) return false;
if (u2->faction == f) {
int o;
if (getguard(u) || usiege(u) || u->building || u->ship) { /* simple visibility, just gotta have a unit in the region to see 'em */
cansee = true; if (getguard(u) || usiege(u) || u->building || u->ship) {
break; return true;
} }
if (invisible(u, u2) >= u->number) continue; stealth = eff_stealth(u, r) - modifier;
rings = invisible(u, NULL);
while (u2) {
if (rings<u->number || invisible(u, u2) < u->number) {
int observation = eff_skill(u2, SK_OBSERVATION, r);
o = eff_skill(u2, SK_OBSERVATION, r);
#ifdef NIGHTEYES #ifdef NIGHTEYES
if (u2->enchanted == SP_NIGHT_EYES && o < NIGHT_EYE_TALENT) if (u2->enchanted == SP_NIGHT_EYES && o < NIGHT_EYE_TALENT)
o = NIGHT_EYE_TALENT; observation = NIGHT_EYE_TALENT;
#endif #endif
if (o >= n) { if (observation >= stealth) {
cansee = true; return true;
break; }
} }
}
/* find next unit in our faction */
do {
u2=u2->next;
} while (u2 && u2->faction != f);
} }
return cansee; return false;
} }

View File

@ -1646,7 +1646,7 @@ readfaction(FILE * F)
i = f->options = ri(F); i = f->options = ri(F);
if ((i & Pow(O_REPORT))==0 && (i & Pow(O_COMPUTER))==0) { if ((i & ((1<<O_REPORT)|(1<<O_COMPUTER)))==0 && f->no!=MONSTER_FACTION) {
/* Kein Report eingestellt, Fehler */ /* Kein Report eingestellt, Fehler */
f->options = f->options | Pow(O_REPORT) | Pow(O_ZUGVORLAGE); f->options = f->options | Pow(O_REPORT) | Pow(O_ZUGVORLAGE);
} }

View File

@ -547,8 +547,16 @@ set_level(unit * u, skill_t sk, int value)
sk_set(add_skill(u, sk), value); sk_set(add_skill(u, sk), value);
} }
static int
leftship_age(struct attrib * a)
{
/* must be aged, so it doesn't affect report generation (cansee) */
unused(a);
return 0; /* remove me */
}
static attrib_type at_leftship = { static attrib_type at_leftship = {
"leftship", "leftship", NULL, NULL, leftship_age
}; };
static attrib * static attrib *
@ -1115,12 +1123,12 @@ invisible(const unit *target, const unit * viewer)
#if NEWATSROI == 1 #if NEWATSROI == 1
return 0; return 0;
#else #else
if (viewer->faction==target->faction) return 0; if (viewer && viewer->faction==target->faction) return 0;
else { else {
int hidden = get_item(target, I_RING_OF_INVISIBILITY) + 100 * get_item(target, I_SPHERE_OF_INVISIBILITY); int hidden = get_item(target, I_RING_OF_INVISIBILITY) + 100 * get_item(target, I_SPHERE_OF_INVISIBILITY);
if (hidden) { if (hidden) {
hidden = min(hidden, target->number); hidden = min(hidden, target->number);
hidden -= get_item(viewer, I_AMULET_OF_TRUE_SEEING); if (viewer) hidden -= get_item(viewer, I_AMULET_OF_TRUE_SEEING);
} }
return hidden; return hidden;
} }

View File

@ -1340,7 +1340,7 @@
<arg name="mage" type="unit"/> <arg name="mage" type="unit"/>
<arg name="reason" type="string"/> <arg name="reason" type="string"/>
</type> </type>
<text locale="de">"$unit($mage) erleidet einen Schock ${reason}."</text> <text locale="de">"$unit($mage) erleidet durch den Tod seines Vertrauten einen Schock."</text>
</message> </message>
<message name="patzer" section="magic"> <message name="patzer" section="magic">
<type> <type>