Show ctrl-click function of shared orders button in tooltip

This commit is contained in:
Jonathan G Rennison
2023-05-25 20:02:29 +01:00
parent 9f24895480
commit 23ab1cb3d0
3 changed files with 25 additions and 0 deletions

View File

@@ -1584,6 +1584,7 @@ STR_ORDERS_OCCUPANCY_LIST_TOOLTIP :{BLACK}Order oc
STR_ORDERS_OCCUPANCY_PERCENT :{NUM}%
STR_ORDERS_NEW_GROUP_TOOLTIP :{BLACK}Create group from single vehicle
STR_ORDERS_VEH_WITH_SHARED_ORDERS_LIST_TOOLTIP_EXTRA :{STRING}{}{BLACK}Ctrl+Click to create group from single vehicle
STR_ORDER_GO_TO_WAYPOINT_REVERSE :Go via and reverse at {WAYPOINT}
STR_ORDER_GO_NON_STOP_TO_WAYPOINT_REVERSE :Go non-stop via and reverse at {WAYPOINT}

View File

@@ -3517,6 +3517,22 @@ public:
}
}
bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override
{
switch (widget) {
case WID_O_SHARED_ORDER_LIST: {
if (this->vehicle->owner == _local_company) {
uint64 args[] = { STR_ORDERS_VEH_WITH_SHARED_ORDERS_LIST_TOOLTIP };
GuiShowTooltips(this, STR_ORDERS_VEH_WITH_SHARED_ORDERS_LIST_TOOLTIP_EXTRA, lengthof(args), args, close_cond);
return true;
}
return false;
}
default:
return false;
}
}
const Vehicle *GetVehicle()
{
return this->vehicle;

View File

@@ -641,6 +641,14 @@ struct TimetableWindow : GeneralVehicleWindow {
GuiShowTooltips(this, STR_TIMETABLE_CLEAR_SPEED_TOOLTIP, 0, nullptr, close_cond);
return true;
}
case WID_VT_SHARED_ORDER_LIST: {
if (this->vehicle->owner == _local_company) {
uint64 args[] = { STR_ORDERS_VEH_WITH_SHARED_ORDERS_LIST_TOOLTIP };
GuiShowTooltips(this, STR_ORDERS_VEH_WITH_SHARED_ORDERS_LIST_TOOLTIP_EXTRA, lengthof(args), args, close_cond);
return true;
}
return false;
}
default:
return false;
}