summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/autoreplace_gui.cpp2
-rw-r--r--src/build_vehicle_gui.cpp2
-rw-r--r--src/company_gui.cpp8
-rw-r--r--src/depot_gui.cpp2
-rw-r--r--src/group_gui.cpp2
-rw-r--r--src/order_gui.cpp2
-rw-r--r--src/station_gui.cpp4
-rw-r--r--src/timetable_gui.cpp2
-rw-r--r--src/vehicle_gui.cpp13
-rw-r--r--src/waypoint_gui.cpp2
-rw-r--r--src/widget.cpp6
-rw-r--r--src/window.cpp8
-rw-r--r--src/window_gui.h4
13 files changed, 28 insertions, 29 deletions
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index 6e40abe9a..4c6ace490 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -236,7 +236,7 @@ public:
this->resize.width = this->width;
this->resize.height = this->height;
- this->caption_color = _local_company;
+ this->owner = _local_company;
this->sel_group = id_g;
this->vscroll2.cap = this->vscroll.cap; // these two are always the same
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 3f9118966..9164d95b4 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -803,7 +803,7 @@ struct BuildVehicleWindow : Window {
this->resize.width = this->width;
this->resize.height = this->height;
- this->caption_color = (tile != INVALID_TILE) ? GetTileOwner(tile) : _local_company;
+ this->owner = (tile != INVALID_TILE) ? GetTileOwner(tile) : _local_company;
this->sel_engine = INVALID_ENGINE;
this->regenerate_list = false;
diff --git a/src/company_gui.cpp b/src/company_gui.cpp
index 26a0485a6..97c65776e 100644
--- a/src/company_gui.cpp
+++ b/src/company_gui.cpp
@@ -228,7 +228,7 @@ struct CompanyFinancesWindow : Window {
Window(desc, company),
small(show_small)
{
- this->caption_color = this->window_number;
+ this->owner = (Owner)this->window_number;
if (show_stickied) this->flags4 |= WF_STICKY;
@@ -458,7 +458,7 @@ private:
public:
SelectCompanyLiveryWindow(const WindowDesc *desc, CompanyID company) : Window(desc, company)
{
- this->caption_color = company;
+ this->owner = company;
this->livery_class = LC_OTHER;
this->sel = 1;
this->LowerWidget(SCLW_WIDGET_CLASS_GENERAL);
@@ -848,7 +848,7 @@ public:
SelectCompanyManagerFaceWindow(const WindowDesc *desc, Window *parent, bool advanced, int top, int left) : Window(desc, parent->window_number)
{
this->parent = parent;
- this->caption_color = this->window_number;
+ this->owner = (Owner)this->window_number;
this->face = GetCompany((CompanyID)this->window_number)->face;
this->advanced = advanced;
@@ -1254,7 +1254,7 @@ struct CompanyWindow : Window
CompanyWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
{
- this->caption_color = this->window_number;
+ this->owner = (Owner)this->window_number;
this->FindWindowPlacementAndResize(desc);
}
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index c964d4298..6188aa173 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -243,7 +243,7 @@ struct DepotWindow : Window {
this->sel = INVALID_VEHICLE;
this->generate_list = true;
- this->caption_color = GetTileOwner(tile);
+ this->owner = GetTileOwner(tile);
this->CreateDepotListWindow(type);
this->FindWindowPlacementAndResize(desc);
diff --git a/src/group_gui.cpp b/src/group_gui.cpp
index b8cc53377..4dd14a866 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -173,7 +173,7 @@ public:
const Owner owner = (Owner)GB(this->window_number, 0, 8);
this->vehicle_type = (VehicleType)GB(this->window_number, 11, 5);
- this->caption_color = owner;
+ this->owner = owner;
this->resize.step_width = 1;
switch (this->vehicle_type) {
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index df28670c3..e229e84d4 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -623,7 +623,7 @@ private:
public:
OrdersWindow(const WindowDesc *desc, const Vehicle *v) : Window(desc, v->index)
{
- this->caption_color = v->owner;
+ this->owner = v->owner;
this->vscroll.cap = 6;
this->resize.step_height = 10;
this->selected_order = -1;
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 6e2f6a87b..4275e1243 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -233,7 +233,7 @@ protected:
public:
CompanyStationsWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
{
- this->caption_color = (byte)this->window_number;
+ this->owner = (Owner)this->window_number;
this->vscroll.cap = 12;
this->resize.step_height = 10;
this->resize.height = this->height - 10 * 7; // minimum if 5 in the list
@@ -711,7 +711,7 @@ struct StationViewWindow : public Window {
StationViewWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
{
Owner owner = GetStation(window_number)->owner;
- if (owner != OWNER_NONE) this->caption_color = owner;
+ if (owner != OWNER_NONE) this->owner = owner;
this->vscroll.cap = 5;
this->resize.step_height = 10;
diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp
index f9bed59ed..72cec36aa 100644
--- a/src/timetable_gui.cpp
+++ b/src/timetable_gui.cpp
@@ -51,7 +51,7 @@ struct TimetableWindow : Window {
TimetableWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
{
this->vehicle = GetVehicle(window_number);
- this->caption_color = this->vehicle->owner;
+ this->owner = this->vehicle->owner;
this->vscroll.cap = 8;
this->resize.step_height = 10;
this->sel_index = -1;
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 4a6b7d9c8..375df086d 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -271,7 +271,7 @@ struct RefitWindow : public Window {
RefitWindow(const WindowDesc *desc, const Vehicle *v, VehicleOrderID order) : Window(desc, v->index)
{
- this->caption_color = v->owner;
+ this->owner = v->owner;
this->vscroll.cap = 8;
this->resize.step_height = 14;
@@ -801,7 +801,7 @@ struct VehicleListWindow : public BaseVehicleListWindow {
CompanyID company = (CompanyID)GB(this->window_number, 0, 8);
this->vehicle_type = (VehicleType)GB(this->window_number, 11, 5);
- this->caption_color = company;
+ this->owner = company;
/* Hide the widgets that we will not use in this window
* Some windows contains actions only fit for the owner */
@@ -930,7 +930,7 @@ struct VehicleListWindow : public BaseVehicleListWindow {
virtual void OnPaint()
{
int x = 2;
- const Owner owner = (Owner)this->caption_color;
+ const Owner owner = this->owner;
const uint16 window_type = this->window_number & VLW_MASK;
const uint16 index = GB(this->window_number, 16, 16);
@@ -1094,9 +1094,8 @@ struct VehicleListWindow : public BaseVehicleListWindow {
if (_pause_game != 0) return;
if (this->vehicles.NeedResort()) {
StationID station = ((this->window_number & VLW_MASK) == VLW_STATION_LIST) ? GB(this->window_number, 16, 16) : INVALID_STATION;
- Owner owner = (Owner)this->caption_color;
- DEBUG(misc, 3, "Periodic resort %d list company %d at station %d", this->vehicle_type, owner, station);
+ DEBUG(misc, 3, "Periodic resort %d list company %d at station %d", this->vehicle_type, this->owner, station);
this->SetDirty();
}
}
@@ -1327,7 +1326,7 @@ struct VehicleDetailsWindow : Window {
}
this->widget[VLD_WIDGET_MIDDLE_DETAILS].data = (this->vscroll.cap << 8) + 1;
- this->caption_color = v->owner;
+ this->owner = v->owner;
this->tab = 0;
@@ -1671,7 +1670,7 @@ struct VehicleViewWindow : Window {
{
const Vehicle *v = GetVehicle(this->window_number);
- this->caption_color = v->owner;
+ this->owner = v->owner;
InitializeWindowViewport(this, VV_VIEWPORT_X, VV_VIEWPORT_Y, VV_INITIAL_VIEWPORT_WIDTH,
(v->type == VEH_TRAIN) ? VV_INITIAL_VIEWPORT_HEIGHT_TRAIN : VV_INITIAL_VIEWPORT_HEIGHT,
this->window_number | (1 << 31), _vehicle_view_zoom_levels[v->type]);
diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp
index 576d614aa..f9cb86a00 100644
--- a/src/waypoint_gui.cpp
+++ b/src/waypoint_gui.cpp
@@ -36,7 +36,7 @@ public:
WaypointWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
{
this->wp = GetWaypoint(this->window_number);
- this->caption_color = this->wp->owner;
+ this->owner = this->wp->owner;
this->flags4 |= WF_DISABLE_VP_SCROLL;
InitializeWindowViewport(this, 3, 17, 254, 86, this->wp->xy, ZOOM_LVL_MIN);
diff --git a/src/widget.cpp b/src/widget.cpp
index 45c928c8f..7684e0cef 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -468,10 +468,10 @@ void Window::DrawWidgets() const
case WWT_CAPTION:
assert(r.bottom - r.top == 13); // To ensure the same sizes are used everywhere!
DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->colour, FR_BORDERONLY);
- DrawFrameRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, wi->colour, (this->caption_color == 0xFF) ? FR_LOWERED | FR_DARKENED : FR_LOWERED | FR_DARKENED | FR_BORDERONLY);
+ DrawFrameRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, wi->colour, (this->owner == INVALID_OWNER) ? FR_LOWERED | FR_DARKENED : FR_LOWERED | FR_DARKENED | FR_BORDERONLY);
- if (this->caption_color != 0xFF) {
- GfxFillRect(r.left + 2, r.top + 2, r.right - 2, r.bottom - 2, _colour_gradient[_company_colours[this->caption_color]][4]);
+ if (this->owner != INVALID_OWNER) {
+ GfxFillRect(r.left + 2, r.top + 2, r.right - 2, r.bottom - 2, _colour_gradient[_company_colours[this->owner]][4]);
}
DrawStringCenteredTruncated(r.left + 2, r.right - 2, r.top + 2, wi->data, TC_FROMSTRING);
diff --git a/src/window.cpp b/src/window.cpp
index 1e950fcfc..59df698ce 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -608,7 +608,7 @@ restart_search:
* as deleting this window could cascade in deleting (many) others
* anywhere in the z-array */
FOR_ALL_WINDOWS_FROM_BACK(w) {
- if (w->caption_color == id) {
+ if (w->owner == id) {
delete w;
goto restart_search;
}
@@ -627,7 +627,7 @@ void ChangeWindowOwner(Owner old_owner, Owner new_owner)
{
Window *w;
FOR_ALL_WINDOWS_FROM_BACK(w) {
- if (w->caption_color != old_owner) continue;
+ if (w->owner != old_owner) continue;
switch (w->window_class) {
case WC_COMPANY_COLOR:
@@ -642,7 +642,7 @@ void ChangeWindowOwner(Owner old_owner, Owner new_owner)
continue;
default:
- w->caption_color = new_owner;
+ w->owner = new_owner;
break;
}
}
@@ -768,7 +768,7 @@ void Window::Initialize(int x, int y, int min_width, int min_height,
/* Set up window properties */
this->window_class = cls;
this->flags4 = WF_WHITE_BORDER_MASK; // just opened windows have a white border
- this->caption_color = 0xFF;
+ this->owner = INVALID_OWNER;
this->left = x;
this->top = y;
this->width = min_width;
diff --git a/src/window_gui.h b/src/window_gui.h
index 7f7b3aad1..b072cec2e 100644
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -150,9 +150,9 @@ public:
Scrollbar vscroll2; ///< Second vertical scroll bar
ResizeInfo resize; ///< Resize information
- byte caption_color; ///< Background color of the window caption, contains CompanyID
+ Owner owner; ///< The owner of the content shown in this window. Company colour is acquired from this variable.
- ViewportData *viewport; ///< Pointer to viewport data, if present
+ ViewportData *viewport;///< Pointer to viewport data, if present
Widget *widget; ///< Widgets of the window
uint widget_count; ///< Number of widgets of the window
uint32 desc_flags; ///< Window/widgets default flags setting, @see WindowDefaultFlag