summaryrefslogtreecommitdiff
path: root/src/widget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widget.cpp')
-rw-r--r--src/widget.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/widget.cpp b/src/widget.cpp
index 0532142ae..471840a41 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -538,10 +538,12 @@ static inline void DrawCloseBox(const Rect &r, Colours colour)
*/
void DrawCaption(const Rect &r, Colours colour, Owner owner, StringID str)
{
+ bool company_owned = owner < MAX_COMPANIES;
+
DrawFrameRect(r.left, r.top, r.right, r.bottom, colour, FR_BORDERONLY);
- DrawFrameRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, colour, (owner == INVALID_OWNER) ? FR_LOWERED | FR_DARKENED : FR_LOWERED | FR_DARKENED | FR_BORDERONLY);
+ DrawFrameRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, colour, company_owned ? FR_LOWERED | FR_DARKENED | FR_BORDERONLY : FR_LOWERED | FR_DARKENED);
- if (owner != INVALID_OWNER) {
+ if (company_owned) {
GfxFillRect(r.left + 2, r.top + 2, r.right - 2, r.bottom - 2, _colour_gradient[_company_colours[owner]][4]);
}