Index: src/depot_gui.cpp =================================================================== --- src/depot_gui.cpp (revision 27446) +++ src/depot_gui.cpp (working copy) @@ -229,7 +229,7 @@ VehicleID vehicle_over; ///< Rail vehicle over which another one is dragged, \c INVALID_VEHICLE if none. VehicleType type; bool generate_list; - bool sell_hovered; ///< A vehicle is being dragged/hovered over the sell button. + int current_hovered_widget; VehicleList vehicle_list; VehicleList wagon_list; uint unitnumber_digits; @@ -244,7 +244,7 @@ this->sel = INVALID_VEHICLE; this->vehicle_over = INVALID_VEHICLE; this->generate_list = true; - this->sell_hovered = false; + this->current_hovered_widget = -1; this->type = type; this->num_columns = 1; // for non-trains this gets set in FinishInitNested() this->unitnumber_digits = 2; @@ -870,10 +870,10 @@ this->vehicle_over = INVALID_VEHICLE; this->SetWidgetDirty(WID_D_MATRIX); - if (this->sell_hovered) { - this->SetWidgetLoweredState(WID_D_SELL, false); - this->SetWidgetDirty(WID_D_SELL); - this->sell_hovered = false; + if (this->current_hovered_widget != -1) { + this->SetWidgetLoweredState(this->current_hovered_widget, false); + this->SetWidgetDirty(this->current_hovered_widget); + this->current_hovered_widget = -1; } } @@ -880,11 +880,16 @@ virtual void OnMouseDrag(Point pt, int widget) { if (this->sel == INVALID_VEHICLE) return; - bool is_sell_widget = widget == WID_D_SELL; - if (is_sell_widget != this->sell_hovered) { - this->sell_hovered = is_sell_widget; - this->SetWidgetLoweredState(WID_D_SELL, is_sell_widget); - this->SetWidgetDirty(WID_D_SELL); + if (widget != this->current_hovered_widget) { + if (this->current_hovered_widget == WID_D_SELL || this->current_hovered_widget == WID_D_SELL_CHAIN) { + this->SetWidgetLoweredState(this->current_hovered_widget, false); + this->SetWidgetDirty(this->current_hovered_widget); + } + if (widget == WID_D_SELL || widget == WID_D_SELL_CHAIN) { + this->SetWidgetLoweredState(widget, true); + this->SetWidgetDirty(widget); + } + this->current_hovered_widget = widget; } if (this->type != VEH_TRAIN) return; @@ -975,7 +980,7 @@ this->SetDirty(); break; } - this->sell_hovered = false; + this->current_hovered_widget = -1; _cursor.vehchain = false; }