Codechange: Remove direct access to _colour_gradient.

Access is now through GetColourGradient, which ensures parameters are in range.
This commit is contained in:
Peter Nelson
2023-12-24 22:51:55 +00:00
committed by Peter Nelson
parent 56cf89d189
commit 0463d4c198
23 changed files with 98 additions and 65 deletions

View File

@@ -312,7 +312,7 @@ void LinkGraphOverlay::DrawContent(Point pta, Point ptb, const LinkProperties &c
GfxDrawLine(pta.x, pta.y + offset_y, ptb.x, ptb.y + offset_y, colour, width, dash);
}
GfxDrawLine(pta.x, pta.y, ptb.x, ptb.y, _colour_gradient[COLOUR_GREY][1], width);
GfxDrawLine(pta.x, pta.y, ptb.x, ptb.y, GetColourGradient(COLOUR_GREY, 1), width);
}
/**
@@ -331,9 +331,9 @@ void LinkGraphOverlay::DrawStationDots(const DrawPixelInfo *dpi) const
uint r = width * 2 + width * 2 * std::min(200U, i.second) / 200;
LinkGraphOverlay::DrawVertex(pt.x, pt.y, r,
_colour_gradient[st->owner != OWNER_NONE ?
Company::Get(st->owner)->colour : COLOUR_GREY][5],
_colour_gradient[COLOUR_GREY][1]);
GetColourGradient(st->owner != OWNER_NONE ?
Company::Get(st->owner)->colour : COLOUR_GREY, 5),
GetColourGradient(COLOUR_GREY, 1));
}
}