mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
This commit is contained in:
parent
1dc2284e0c
commit
461556e2c0
|
@ -452,17 +452,16 @@ private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the click on the goto button.
|
* Handle the click on the goto button.
|
||||||
*
|
* @param i Dummy parameter.
|
||||||
* @param w current window
|
|
||||||
*/
|
*/
|
||||||
static void OrderClick_Goto(OrdersWindow *w, int i)
|
void OrderClick_Goto(int i)
|
||||||
{
|
{
|
||||||
w->InvalidateWidget(ORDER_WIDGET_GOTO);
|
this->InvalidateWidget(ORDER_WIDGET_GOTO);
|
||||||
w->ToggleWidgetLoweredState(ORDER_WIDGET_GOTO);
|
this->ToggleWidgetLoweredState(ORDER_WIDGET_GOTO);
|
||||||
if (w->IsWidgetLowered(ORDER_WIDGET_GOTO)) {
|
if (this->IsWidgetLowered(ORDER_WIDGET_GOTO)) {
|
||||||
_place_clicked_vehicle = NULL;
|
_place_clicked_vehicle = NULL;
|
||||||
SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, HT_RECT, w);
|
SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, HT_RECT, this);
|
||||||
w->goto_type = OPOS_GOTO;
|
this->goto_type = OPOS_GOTO;
|
||||||
} else {
|
} else {
|
||||||
ResetObjectToPlace();
|
ResetObjectToPlace();
|
||||||
}
|
}
|
||||||
|
@ -470,79 +469,71 @@ private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the click on the full load button.
|
* Handle the click on the full load button.
|
||||||
*
|
|
||||||
* @param w current window
|
|
||||||
* @param load_type the way to load.
|
* @param load_type the way to load.
|
||||||
*/
|
*/
|
||||||
static void OrderClick_FullLoad(OrdersWindow *w, int load_type)
|
void OrderClick_FullLoad(int load_type)
|
||||||
{
|
{
|
||||||
VehicleOrderID sel_ord = w->OrderGetSel();
|
VehicleOrderID sel_ord = this->OrderGetSel();
|
||||||
const Order *order = w->vehicle->GetOrder(sel_ord);
|
const Order *order = this->vehicle->GetOrder(sel_ord);
|
||||||
|
|
||||||
if (order == NULL || order->GetLoadType() == load_type) return;
|
if (order == NULL || order->GetLoadType() == load_type) return;
|
||||||
|
|
||||||
if (load_type < 0) {
|
if (load_type < 0) {
|
||||||
load_type = order->GetLoadType() == OLF_LOAD_IF_POSSIBLE ? OLF_FULL_LOAD_ANY : OLF_LOAD_IF_POSSIBLE;
|
load_type = order->GetLoadType() == OLF_LOAD_IF_POSSIBLE ? OLF_FULL_LOAD_ANY : OLF_LOAD_IF_POSSIBLE;
|
||||||
}
|
}
|
||||||
DoCommandP(w->vehicle->tile, w->vehicle->index + (sel_ord << 16), MOF_LOAD | (load_type << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
|
DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 16), MOF_LOAD | (load_type << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the click on the service.
|
* Handle the click on the service.
|
||||||
*
|
|
||||||
* @param w current window
|
|
||||||
*/
|
*/
|
||||||
static void OrderClick_Service(OrdersWindow *w, int i)
|
void OrderClick_Service(int i)
|
||||||
{
|
{
|
||||||
VehicleOrderID sel_ord = w->OrderGetSel();
|
VehicleOrderID sel_ord = this->OrderGetSel();
|
||||||
|
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
const Order *order = w->vehicle->GetOrder(sel_ord);
|
const Order *order = this->vehicle->GetOrder(sel_ord);
|
||||||
if (order == NULL) return;
|
if (order == NULL) return;
|
||||||
i = (order->GetDepotOrderType() & ODTFB_SERVICE) ? DA_ALWAYS_GO : DA_SERVICE;
|
i = (order->GetDepotOrderType() & ODTFB_SERVICE) ? DA_ALWAYS_GO : DA_SERVICE;
|
||||||
}
|
}
|
||||||
DoCommandP(w->vehicle->tile, w->vehicle->index + (sel_ord << 16), MOF_DEPOT_ACTION | (i << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
|
DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 16), MOF_DEPOT_ACTION | (i << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the click on the service in nearest depot button.
|
* Handle the click on the service in nearest depot button.
|
||||||
*
|
* @param i Dummy parameter.
|
||||||
* @param w current window
|
|
||||||
*/
|
*/
|
||||||
static void OrderClick_NearestDepot(OrdersWindow *w, int i)
|
void OrderClick_NearestDepot(int i)
|
||||||
{
|
{
|
||||||
Order order;
|
Order order;
|
||||||
order.next = NULL;
|
order.next = NULL;
|
||||||
order.index = 0;
|
order.index = 0;
|
||||||
order.MakeGoToDepot(0, ODTFB_PART_OF_ORDERS,
|
order.MakeGoToDepot(0, ODTFB_PART_OF_ORDERS,
|
||||||
_settings_client.gui.new_nonstop && (w->vehicle->type == VEH_TRAIN || w->vehicle->type == VEH_ROAD) ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE);
|
_settings_client.gui.new_nonstop && (this->vehicle->type == VEH_TRAIN || this->vehicle->type == VEH_ROAD) ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE);
|
||||||
order.SetDepotActionType(ODATFB_NEAREST_DEPOT);
|
order.SetDepotActionType(ODATFB_NEAREST_DEPOT);
|
||||||
|
|
||||||
DoCommandP(w->vehicle->tile, w->vehicle->index + (w->OrderGetSel() << 16), order.Pack(), CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER));
|
DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 16), order.Pack(), CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the click on the conditional order button.
|
* Handle the click on the conditional order button.
|
||||||
*
|
* @param i Dummy parameter.
|
||||||
* @param w current window
|
|
||||||
*/
|
*/
|
||||||
static void OrderClick_Conditional(OrdersWindow *w, int i)
|
void OrderClick_Conditional(int i)
|
||||||
{
|
{
|
||||||
w->InvalidateWidget(ORDER_WIDGET_GOTO);
|
this->InvalidateWidget(ORDER_WIDGET_GOTO);
|
||||||
w->LowerWidget(ORDER_WIDGET_GOTO);
|
this->LowerWidget(ORDER_WIDGET_GOTO);
|
||||||
SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, HT_RECT, w);
|
SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, HT_RECT, this);
|
||||||
w->goto_type = OPOS_CONDITIONAL;
|
this->goto_type = OPOS_CONDITIONAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the click on the unload button.
|
* Handle the click on the unload button.
|
||||||
*
|
|
||||||
* @param w current window
|
|
||||||
*/
|
*/
|
||||||
static void OrderClick_Unload(OrdersWindow *w, int unload_type)
|
void OrderClick_Unload(int unload_type)
|
||||||
{
|
{
|
||||||
VehicleOrderID sel_ord = w->OrderGetSel();
|
VehicleOrderID sel_ord = this->OrderGetSel();
|
||||||
const Order *order = w->vehicle->GetOrder(sel_ord);
|
const Order *order = this->vehicle->GetOrder(sel_ord);
|
||||||
|
|
||||||
if (order == NULL || order->GetUnloadType() == unload_type) return;
|
if (order == NULL || order->GetUnloadType() == unload_type) return;
|
||||||
|
|
||||||
|
@ -550,19 +541,17 @@ private:
|
||||||
unload_type = order->GetUnloadType() == OUF_UNLOAD_IF_POSSIBLE ? OUFB_UNLOAD : OUF_UNLOAD_IF_POSSIBLE;
|
unload_type = order->GetUnloadType() == OUF_UNLOAD_IF_POSSIBLE ? OUFB_UNLOAD : OUF_UNLOAD_IF_POSSIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DoCommandP(w->vehicle->tile, w->vehicle->index + (sel_ord << 16), MOF_UNLOAD | (unload_type << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
|
DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 16), MOF_UNLOAD | (unload_type << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the click on the nonstop button.
|
* Handle the click on the nonstop button.
|
||||||
*
|
|
||||||
* @param w current window
|
|
||||||
* @param non_stop what non-stop type to use; -1 to use the 'next' one.
|
* @param non_stop what non-stop type to use; -1 to use the 'next' one.
|
||||||
*/
|
*/
|
||||||
static void OrderClick_Nonstop(OrdersWindow *w, int non_stop)
|
void OrderClick_Nonstop(int non_stop)
|
||||||
{
|
{
|
||||||
VehicleOrderID sel_ord = w->OrderGetSel();
|
VehicleOrderID sel_ord = this->OrderGetSel();
|
||||||
const Order *order = w->vehicle->GetOrder(sel_ord);
|
const Order *order = this->vehicle->GetOrder(sel_ord);
|
||||||
|
|
||||||
if (order == NULL || order->GetNonStopType() == non_stop) return;
|
if (order == NULL || order->GetNonStopType() == non_stop) return;
|
||||||
|
|
||||||
|
@ -571,63 +560,58 @@ private:
|
||||||
non_stop = order->GetNonStopType() ^ ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS;
|
non_stop = order->GetNonStopType() ^ ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
w->InvalidateWidget(ORDER_WIDGET_NON_STOP);
|
this->InvalidateWidget(ORDER_WIDGET_NON_STOP);
|
||||||
DoCommandP(w->vehicle->tile, w->vehicle->index + (sel_ord << 16), MOF_NON_STOP | non_stop << 4, CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
|
DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 16), MOF_NON_STOP | non_stop << 4, CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the click on the skip button.
|
* Handle the click on the skip button.
|
||||||
* If ctrl is pressed skip to selected order.
|
* If ctrl is pressed, skip to selected order, else skip to current order + 1
|
||||||
* Else skip to current order + 1
|
* @param i Dummy parameter.
|
||||||
*
|
|
||||||
* @param w current window
|
|
||||||
*/
|
*/
|
||||||
static void OrderClick_Skip(OrdersWindow *w, int i)
|
void OrderClick_Skip(int i)
|
||||||
{
|
{
|
||||||
/* Don't skip when there's nothing to skip */
|
/* Don't skip when there's nothing to skip */
|
||||||
if (_ctrl_pressed && w->vehicle->cur_order_index == w->OrderGetSel()) return;
|
if (_ctrl_pressed && this->vehicle->cur_order_index == this->OrderGetSel()) return;
|
||||||
if (w->vehicle->GetNumOrders() <= 1) return;
|
if (this->vehicle->GetNumOrders() <= 1) return;
|
||||||
|
|
||||||
DoCommandP(w->vehicle->tile, w->vehicle->index, _ctrl_pressed ? w->OrderGetSel() : ((w->vehicle->cur_order_index + 1) % w->vehicle->GetNumOrders()),
|
DoCommandP(this->vehicle->tile, this->vehicle->index, _ctrl_pressed ? this->OrderGetSel() : ((this->vehicle->cur_order_index + 1) % this->vehicle->GetNumOrders()),
|
||||||
CMD_SKIP_TO_ORDER | CMD_MSG(_ctrl_pressed ? STR_ERROR_CAN_T_SKIP_TO_ORDER : STR_ERROR_CAN_T_SKIP_ORDER));
|
CMD_SKIP_TO_ORDER | CMD_MSG(_ctrl_pressed ? STR_ERROR_CAN_T_SKIP_TO_ORDER : STR_ERROR_CAN_T_SKIP_ORDER));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the click on the delete button.
|
* Handle the click on the delete button.
|
||||||
*
|
* @param i Dummy parameter.
|
||||||
* @param w current window
|
|
||||||
*/
|
*/
|
||||||
static void OrderClick_Delete(OrdersWindow *w, int i)
|
void OrderClick_Delete(int i)
|
||||||
{
|
{
|
||||||
/* When networking, move one order lower */
|
/* When networking, move one order lower */
|
||||||
int selected = w->selected_order + (int)_networking;
|
int selected = this->selected_order + (int)_networking;
|
||||||
|
|
||||||
if (DoCommandP(w->vehicle->tile, w->vehicle->index, w->OrderGetSel(), CMD_DELETE_ORDER | CMD_MSG(STR_ERROR_CAN_T_DELETE_THIS_ORDER))) {
|
if (DoCommandP(this->vehicle->tile, this->vehicle->index, this->OrderGetSel(), CMD_DELETE_ORDER | CMD_MSG(STR_ERROR_CAN_T_DELETE_THIS_ORDER))) {
|
||||||
w->selected_order = selected >= w->vehicle->GetNumOrders() ? -1 : selected;
|
this->selected_order = selected >= this->vehicle->GetNumOrders() ? -1 : selected;
|
||||||
w->UpdateButtonState();
|
this->UpdateButtonState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the click on the refit button.
|
* Handle the click on the refit button.
|
||||||
* If ctrl is pressed cancel refitting.
|
* If ctrl is pressed, cancel refitting, else show the refit window.
|
||||||
* Else show the refit window.
|
* @param i Dummy parameter.
|
||||||
*
|
|
||||||
* @param w current window
|
|
||||||
*/
|
*/
|
||||||
static void OrderClick_Refit(OrdersWindow *w, int i)
|
void OrderClick_Refit(int i)
|
||||||
{
|
{
|
||||||
if (_ctrl_pressed) {
|
if (_ctrl_pressed) {
|
||||||
/* Cancel refitting */
|
/* Cancel refitting */
|
||||||
DoCommandP(w->vehicle->tile, w->vehicle->index, (w->OrderGetSel() << 16) | (CT_NO_REFIT << 8) | CT_NO_REFIT, CMD_ORDER_REFIT);
|
DoCommandP(this->vehicle->tile, this->vehicle->index, (this->OrderGetSel() << 16) | (CT_NO_REFIT << 8) | CT_NO_REFIT, CMD_ORDER_REFIT);
|
||||||
} else {
|
} else {
|
||||||
ShowVehicleRefitWindow(w->vehicle, w->OrderGetSel(), w);
|
ShowVehicleRefitWindow(this->vehicle, this->OrderGetSel(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
typedef void Handler(OrdersWindow*, int);
|
typedef void (OrdersWindow::*Handler)(int);
|
||||||
struct KeyToEvent {
|
struct KeyToEvent {
|
||||||
uint16 keycode;
|
uint16 keycode;
|
||||||
Handler *proc;
|
Handler proc;
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -651,7 +635,7 @@ public:
|
||||||
if (order->IsType(OT_GOTO_STATION)) station_orders++;
|
if (order->IsType(OT_GOTO_STATION)) station_orders++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (station_orders < 2) OrderClick_Goto(this, 0);
|
if (station_orders < 2) this->OrderClick_Goto(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_settings_game.order.timetabling) {
|
if (_settings_game.order.timetabling) {
|
||||||
|
@ -933,15 +917,15 @@ public:
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case ORDER_WIDGET_SKIP:
|
case ORDER_WIDGET_SKIP:
|
||||||
OrderClick_Skip(this, 0);
|
this->OrderClick_Skip(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_WIDGET_DELETE:
|
case ORDER_WIDGET_DELETE:
|
||||||
OrderClick_Delete(this, 0);
|
this->OrderClick_Delete(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_WIDGET_NON_STOP:
|
case ORDER_WIDGET_NON_STOP:
|
||||||
OrderClick_Nonstop(this, -1);
|
this->OrderClick_Nonstop(-1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_WIDGET_NON_STOP_DROPDOWN: {
|
case ORDER_WIDGET_NON_STOP_DROPDOWN: {
|
||||||
|
@ -950,7 +934,7 @@ public:
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case ORDER_WIDGET_GOTO:
|
case ORDER_WIDGET_GOTO:
|
||||||
OrderClick_Goto(this, 0);
|
this->OrderClick_Goto(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_WIDGET_GOTO_DROPDOWN:
|
case ORDER_WIDGET_GOTO_DROPDOWN:
|
||||||
|
@ -958,7 +942,7 @@ public:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_WIDGET_FULL_LOAD:
|
case ORDER_WIDGET_FULL_LOAD:
|
||||||
OrderClick_FullLoad(this, -1);
|
this->OrderClick_FullLoad(-1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_WIDGET_FULL_LOAD_DROPDOWN:
|
case ORDER_WIDGET_FULL_LOAD_DROPDOWN:
|
||||||
|
@ -966,7 +950,7 @@ public:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_WIDGET_UNLOAD:
|
case ORDER_WIDGET_UNLOAD:
|
||||||
OrderClick_Unload(this, -1);
|
this->OrderClick_Unload(-1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_WIDGET_UNLOAD_DROPDOWN:
|
case ORDER_WIDGET_UNLOAD_DROPDOWN:
|
||||||
|
@ -974,11 +958,11 @@ public:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_WIDGET_REFIT:
|
case ORDER_WIDGET_REFIT:
|
||||||
OrderClick_Refit(this, 0);
|
this->OrderClick_Refit(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_WIDGET_SERVICE:
|
case ORDER_WIDGET_SERVICE:
|
||||||
OrderClick_Service(this, -1);
|
this->OrderClick_Service(-1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_WIDGET_SERVICE_DROPDOWN:
|
case ORDER_WIDGET_SERVICE_DROPDOWN:
|
||||||
|
@ -1038,28 +1022,28 @@ public:
|
||||||
{
|
{
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case ORDER_WIDGET_NON_STOP_DROPDOWN:
|
case ORDER_WIDGET_NON_STOP_DROPDOWN:
|
||||||
OrderClick_Nonstop(this, index);
|
this->OrderClick_Nonstop(index);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_WIDGET_FULL_LOAD_DROPDOWN:
|
case ORDER_WIDGET_FULL_LOAD_DROPDOWN:
|
||||||
OrderClick_FullLoad(this, index);
|
this->OrderClick_FullLoad(index);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_WIDGET_UNLOAD_DROPDOWN:
|
case ORDER_WIDGET_UNLOAD_DROPDOWN:
|
||||||
OrderClick_Unload(this, index);
|
this->OrderClick_Unload(index);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_WIDGET_GOTO_DROPDOWN:
|
case ORDER_WIDGET_GOTO_DROPDOWN:
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: OrderClick_Goto(this, 0); break;
|
case 0: this->OrderClick_Goto(0); break;
|
||||||
case 1: OrderClick_NearestDepot(this, 0); break;
|
case 1: this->OrderClick_NearestDepot(0); break;
|
||||||
case 2: OrderClick_Conditional(this, 0); break;
|
case 2: this->OrderClick_Conditional(0); break;
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_WIDGET_SERVICE_DROPDOWN:
|
case ORDER_WIDGET_SERVICE_DROPDOWN:
|
||||||
OrderClick_Service(this, index);
|
this->OrderClick_Service(index);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_WIDGET_COND_VARIABLE:
|
case ORDER_WIDGET_COND_VARIABLE:
|
||||||
|
@ -1087,7 +1071,7 @@ public:
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case ORDER_WIDGET_DELETE:
|
case ORDER_WIDGET_DELETE:
|
||||||
OrderClick_Delete(this, 0);
|
this->OrderClick_Delete(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1097,20 +1081,20 @@ public:
|
||||||
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
|
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
|
||||||
{
|
{
|
||||||
static const KeyToEvent keytoevent[] = {
|
static const KeyToEvent keytoevent[] = {
|
||||||
{'D', OrderClick_Skip},
|
{'D', &OrdersWindow::OrderClick_Skip},
|
||||||
{'F', OrderClick_Delete},
|
{'F', &OrdersWindow::OrderClick_Delete},
|
||||||
{'G', OrderClick_Goto},
|
{'G', &OrdersWindow::OrderClick_Goto},
|
||||||
{'H', OrderClick_Nonstop},
|
{'H', &OrdersWindow::OrderClick_Nonstop},
|
||||||
{'J', OrderClick_FullLoad},
|
{'J', &OrdersWindow::OrderClick_FullLoad},
|
||||||
{'K', OrderClick_Unload},
|
{'K', &OrdersWindow::OrderClick_Unload},
|
||||||
//('?', OrderClick_Service},
|
//('?', &OrdersWindow::OrderClick_Service},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this->vehicle->owner != _local_company) return ES_NOT_HANDLED;
|
if (this->vehicle->owner != _local_company) return ES_NOT_HANDLED;
|
||||||
|
|
||||||
for (uint i = 0; i < lengthof(keytoevent); i++) {
|
for (uint i = 0; i < lengthof(keytoevent); i++) {
|
||||||
if (keycode == keytoevent[i].keycode) {
|
if (keycode == keytoevent[i].keycode) {
|
||||||
keytoevent[i].proc(this, -1);
|
(this->*(keytoevent[i].proc))(-1);
|
||||||
return ES_HANDLED;
|
return ES_HANDLED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue