diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 9c2b5a3ff0..0b4f4e2cd8 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -1123,6 +1123,21 @@ public: this->group_sel = INVALID_GROUP; this->group_over = INVALID_GROUP; this->SetWidgetDirty(WID_GL_LIST_VEHICLE); + this->SetVehicleDraggedOverCreateGroupButton(false); + } + + void SetVehicleDraggedOverCreateGroupButton(bool dragged) + { + NWidgetCore *create_group = this->GetWidget(WID_GL_CREATE_GROUP); + if (dragged && (create_group->type & WWB_PUSHBUTTON)) { + create_group->type = static_cast(create_group->type & ~WWB_PUSHBUTTON); + create_group->SetLowered(true); + create_group->SetDirty(this); + } else if (!dragged && !(create_group->type & WWB_PUSHBUTTON)) { + create_group->type = static_cast(create_group->type | WWB_PUSHBUTTON); + create_group->SetLowered(false); + create_group->SetDirty(this); + } } void OnMouseDrag(Point pt, int widget) override @@ -1131,6 +1146,8 @@ public: /* A vehicle is dragged over... */ GroupID new_group_over = INVALID_GROUP; + + bool create_group_drag_over = false; switch (widget) { case WID_GL_DEFAULT_VEHICLES: // ... the 'default' group. new_group_over = DEFAULT_GROUP; @@ -1141,8 +1158,15 @@ public: new_group_over = id_g >= this->groups.size() ? NEW_GROUP : this->groups[id_g]->index; break; } + + case WID_GL_CREATE_GROUP: { + if (this->vehicle_sel != INVALID_VEHICLE) create_group_drag_over = true; + break; + } } + this->SetVehicleDraggedOverCreateGroupButton(create_group_drag_over); + /* Do not highlight when dragging over the current group */ if (this->vehicle_sel != INVALID_VEHICLE) { if (Vehicle::Get(vehicle_sel)->group_id == new_group_over) new_group_over = INVALID_GROUP;