From c1220f18433cbd06caa3c7affb0aa4789d298bd1 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 20 Jun 2021 19:23:37 +0200 Subject: [PATCH] bug 2673: cannot attack sea serpents https://bugs.eressea.de/view.php?id=2763 visibility rules must be in cansee() --- src/laws.c | 10 +++++++++- src/reports.c | 11 ++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/laws.c b/src/laws.c index 12bcb3168..a81941217 100644 --- a/src/laws.c +++ b/src/laws.c @@ -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) diff --git a/src/reports.c b/src/reports.c index 8928cb33a..40066b08f 100644 --- a/src/reports.c +++ b/src/reports.c @@ -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; }