Changeset - r11084:003adceca07c
[Not reviewed]
master
0 13 0
rubidium - 15 years ago 2009-02-09 02:33:10
rubidium@openttd.org
(svn r15427) -Codechange: give w->caption_color a more sensible name as it holds the owner of whatever is shown in the window
13 files changed with 28 insertions and 29 deletions:
0 comments (0 inline, 0 general)
src/autoreplace_gui.cpp
Show inline comments
 
@@ -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
 

	
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -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;
src/company_gui.cpp
Show inline comments
 
@@ -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);
 
	}
 

	
src/depot_gui.cpp
Show inline comments
 
@@ -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);
src/group_gui.cpp
Show inline comments
 
@@ -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) {
src/order_gui.cpp
Show inline comments
 
@@ -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;
src/station_gui.cpp
Show inline comments
 
@@ -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;
 

	
src/timetable_gui.cpp
Show inline comments
 
@@ -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;
src/vehicle_gui.cpp
Show inline comments
 
@@ -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 BaseVe
 
		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 BaseVe
 
	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 BaseVe
 
		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]);
src/waypoint_gui.cpp
Show inline comments
 
@@ -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);
src/widget.cpp
Show inline comments
 
@@ -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);
src/window.cpp
Show inline comments
 
@@ -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, 
 
{
 
	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, 
 
				continue;
 

	
 
			default:
 
				w->caption_color = new_owner;
 
				w->owner = new_owner;
 
				break;
 
		}
 
	}
 
@@ -768,7 +768,7 @@ void Window::Initialize(int x, int y, in
 
	/* 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;
src/window_gui.h
Show inline comments
 
@@ -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
0 comments (0 inline, 0 general)