From f23dc4b585f68395afcad6ef680526c9511a2a78 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 11 Apr 2018 18:01:39 +0200 Subject: [PATCH] fixed the Yendorian sky colors when scrolling --- graph.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/graph.cpp b/graph.cpp index 4a9eeac6..df4cf67c 100644 --- a/graph.cpp +++ b/graph.cpp @@ -2809,14 +2809,19 @@ void setcolors(cell *c, int& wcol, int &fcol) { } case laEndorian: { - int clev = cwt.c->land == laEndorian ? edgeDepth(cwt.c) : 0; + int clev = pd_from->land == laEndorian ? edgeDepth(pd_from) : 0; // xcol = (c->landparam&1) ? 0xD00000 : 0x00D000; fcol = 0x10101 * (32 + (c->landparam&1) * 32) - 0x000010; int ed = edgeDepth(c); int sr = get_sightrange_ambush(); - while(ed > clev + sr) ed -= 2; - while(ed < clev - sr) ed += 2; - fcol = gradient(fcol, 0x0000D0, clev-sr, edgeDepth(c), clev+sr); + + if(clev == UNKNOWN || ed == UNKNOWN) + fcol = 0x0000D0; + else { + while(ed > clev + sr) ed -= 2; + while(ed < clev - sr) ed += 2; + fcol = gradient(fcol, 0x0000D0, clev-sr, edgeDepth(c), clev+sr); + } if(c->wall == waTrunk) fcol = winf[waTrunk].color; if(c->wall == waCanopy || c->wall == waSolidBranch || c->wall == waWeakBranch) {