bug 2673: cannot attack sea serpents

https://bugs.eressea.de/view.php?id=2763
visibility rules must be in cansee()
This commit is contained in:
Enno Rehling 2021-06-20 19:23:37 +02:00
parent 0f9cbf8079
commit c1220f1843
2 changed files with 11 additions and 10 deletions

View File

@ -4078,7 +4078,15 @@ bool cansee(const faction * f, const region * r, const unit * u, int modifier)
}
}
return (rings <= 0 && stealth <= 0);
if (rings <= 0 && stealth <= 0) {
return true;
}
/* bug 2763 and 2754: sea serpents are visible on oceans */
if ((u->region->terrain->flags & SEA_REGION) && (u_race(u)->weight >= 5000)) {
return true;
}
return false;
}
bool cansee_unit(const unit * u, const unit * target, int modifier)

View File

@ -2379,15 +2379,8 @@ bool visible_unit(const unit *u, const faction *f, int stealthmod, seen_mode mod
if (u->faction == f) {
return true;
}
else if (mode >= seen_lighthouse) {
if (stealthmod > INT_MIN) {
if ((u->region->terrain->flags & SEA_REGION) && (u_race(u)->weight >= 5000)) {
return true;
}
if (mode >= seen_travel || u->building || u->ship || is_guard(u)) {
return cansee(f, u->region, u, stealthmod);
}
}
else if (mode >= seen_lighthouse && stealthmod > INT_MIN) {
return cansee(f, u->region, u, stealthmod);
}
return false;
}