|
@@ -602,49 +602,49 @@ private:
|
|
|
* Handle the click on the refit button.
|
|
|
* If ctrl is pressed cancel refitting.
|
|
|
* Else show the refit window.
|
|
|
*
|
|
|
* @param w current window
|
|
|
*/
|
|
|
static void OrderClick_Refit(OrdersWindow *w, int i)
|
|
|
{
|
|
|
if (_ctrl_pressed) {
|
|
|
/* Cancel refitting */
|
|
|
DoCommandP(w->vehicle->tile, w->vehicle->index, (w->OrderGetSel() << 16) | (CT_NO_REFIT << 8) | CT_NO_REFIT, CMD_ORDER_REFIT);
|
|
|
} else {
|
|
|
ShowVehicleRefitWindow(w->vehicle, w->OrderGetSel(), w);
|
|
|
}
|
|
|
}
|
|
|
typedef void Handler(OrdersWindow*, int);
|
|
|
struct KeyToEvent {
|
|
|
uint16 keycode;
|
|
|
Handler *proc;
|
|
|
};
|
|
|
|
|
|
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;
|
|
|
this->vehicle = v;
|
|
|
|
|
|
if (_settings_client.gui.quick_goto && v->owner == _local_company) {
|
|
|
/* If there are less than 2 station, make Go To active. */
|
|
|
int station_orders = 0;
|
|
|
const Order *order;
|
|
|
FOR_VEHICLE_ORDERS(v, order) {
|
|
|
if (order->IsType(OT_GOTO_STATION)) station_orders++;
|
|
|
}
|
|
|
|
|
|
if (station_orders < 2) OrderClick_Goto(this, 0);
|
|
|
}
|
|
|
|
|
|
if (_settings_game.order.timetabling) {
|
|
|
this->widget[ORDER_WIDGET_CAPTION].right -= 61;
|
|
|
} else {
|
|
|
this->HideWidget(ORDER_WIDGET_TIMETABLE_VIEW);
|
|
|
}
|
|
|
this->FindWindowPlacementAndResize(desc);
|
|
|
}
|
|
|
|