Merge branch 'master' into jgrpp
# Conflicts: # src/company_cmd.cpp # src/core/geometry_func.cpp # src/date.cpp # src/genworld_gui.cpp # src/gfx.cpp # src/object_gui.cpp # src/openttd.cpp # src/settings_type.h # src/video/allegro_v.cpp # src/video/dedicated_v.cpp # src/video/null_v.cpp # src/video/sdl2_v.cpp # src/video/sdl_v.cpp # src/video/win32_v.cpp
This commit is contained in:
@@ -1360,17 +1360,18 @@ private:
|
||||
|
||||
/**
|
||||
* Handle the click on the full load button.
|
||||
* @param load_type the way to load.
|
||||
* @param load_type Load flag to apply. If matches existing load type, toggles to default of 'load if possible'.
|
||||
* @param toggle If we toggle or not (used for hotkey behavior)
|
||||
*/
|
||||
void OrderClick_FullLoad(int load_type)
|
||||
void OrderClick_FullLoad(OrderLoadFlags load_type, bool toggle = false)
|
||||
{
|
||||
VehicleOrderID sel_ord = this->OrderGetSel();
|
||||
const Order *order = this->vehicle->GetOrder(sel_ord);
|
||||
|
||||
if (order == nullptr || (order->GetLoadType() == load_type && load_type != OLFB_CARGO_TYPE_LOAD)) return;
|
||||
if (order == nullptr) return;
|
||||
|
||||
if (load_type < 0) {
|
||||
load_type = order->GetLoadType() == OLF_LOAD_IF_POSSIBLE ? OLF_FULL_LOAD_ANY : OLF_LOAD_IF_POSSIBLE;
|
||||
if (toggle && order->GetLoadType() == load_type) {
|
||||
load_type = OLF_LOAD_IF_POSSIBLE; // reset to 'default'
|
||||
}
|
||||
if (order->GetLoadType() != load_type) {
|
||||
this->ModifyOrder(sel_ord, MOF_LOAD | (load_type << 4));
|
||||
@@ -1379,14 +1380,6 @@ private:
|
||||
if (load_type == OLFB_CARGO_TYPE_LOAD) ShowCargoTypeOrdersWindow(this->vehicle, this, sel_ord, CTOWV_LOAD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the 'no loading' hotkey
|
||||
*/
|
||||
void OrderHotkey_NoLoad()
|
||||
{
|
||||
this->OrderClick_FullLoad(OLFB_NO_LOAD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the click on the service.
|
||||
*/
|
||||
@@ -1432,17 +1425,20 @@ private:
|
||||
|
||||
/**
|
||||
* Handle the click on the unload button.
|
||||
* @param unload_type Unload flag to apply. If matches existing unload type, toggles to default of 'unload if possible'.
|
||||
* @param toggle If we toggle or not (used for hotkey behavior)
|
||||
*/
|
||||
void OrderClick_Unload(int unload_type)
|
||||
void OrderClick_Unload(OrderUnloadFlags unload_type, bool toggle = false)
|
||||
{
|
||||
VehicleOrderID sel_ord = this->OrderGetSel();
|
||||
const Order *order = this->vehicle->GetOrder(sel_ord);
|
||||
|
||||
if (order == nullptr || (order->GetUnloadType() == unload_type && unload_type != OUFB_CARGO_TYPE_UNLOAD)) return;
|
||||
if (order == nullptr) return;
|
||||
|
||||
if (unload_type < 0) {
|
||||
unload_type = order->GetUnloadType() == OUF_UNLOAD_IF_POSSIBLE ? OUFB_UNLOAD : OUF_UNLOAD_IF_POSSIBLE;
|
||||
if (toggle && order->GetUnloadType() == unload_type) {
|
||||
unload_type = OUF_UNLOAD_IF_POSSIBLE;
|
||||
}
|
||||
if (order->GetUnloadType() == unload_type && unload_type != OUFB_CARGO_TYPE_UNLOAD) return; // If we still match, do nothing
|
||||
|
||||
if (order->GetUnloadType() != unload_type) {
|
||||
this->ModifyOrder(sel_ord, MOF_UNLOAD | (unload_type << 4));
|
||||
@@ -1452,27 +1448,11 @@ private:
|
||||
/* Transfer orders with leave empty as default */
|
||||
this->ModifyOrder(sel_ord, MOF_LOAD | (OLFB_NO_LOAD << 4), false);
|
||||
this->SetWidgetDirty(WID_O_FULL_LOAD);
|
||||
} else if(unload_type == OUFB_CARGO_TYPE_UNLOAD) {
|
||||
} else if (unload_type == OUFB_CARGO_TYPE_UNLOAD) {
|
||||
ShowCargoTypeOrdersWindow(this->vehicle, this, sel_ord, CTOWV_UNLOAD);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the transfer hotkey
|
||||
*/
|
||||
void OrderHotkey_Transfer()
|
||||
{
|
||||
this->OrderClick_Unload(OUFB_TRANSFER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the 'no unload' hotkey
|
||||
*/
|
||||
void OrderHotkey_NoUnload()
|
||||
{
|
||||
this->OrderClick_Unload(OUFB_NO_UNLOAD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the click on the nonstop button.
|
||||
* @param non_stop what non-stop type to use; -1 to use the 'next' one.
|
||||
@@ -2366,7 +2346,7 @@ public:
|
||||
|
||||
case WID_O_FULL_LOAD:
|
||||
if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
|
||||
this->OrderClick_FullLoad(-1);
|
||||
this->OrderClick_FullLoad(OLF_FULL_LOAD_ANY, true);
|
||||
} else {
|
||||
ShowDropDownMenu(this, _order_full_load_drowdown, this->vehicle->GetOrder(this->OrderGetSel())->GetLoadType(), WID_O_FULL_LOAD, 0, 0xE2 /* 1110 0010 */, 0, DDSF_LOST_FOCUS);
|
||||
}
|
||||
@@ -2374,7 +2354,7 @@ public:
|
||||
|
||||
case WID_O_UNLOAD:
|
||||
if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
|
||||
this->OrderClick_Unload(-1);
|
||||
this->OrderClick_Unload(OUFB_UNLOAD, true);
|
||||
} else {
|
||||
ShowDropDownMenu(this, _order_unload_drowdown, this->vehicle->GetOrder(this->OrderGetSel())->GetUnloadType(), WID_O_UNLOAD, 0, 0xE8 /* 1110 1000 */, 0, DDSF_LOST_FOCUS);
|
||||
}
|
||||
@@ -2603,11 +2583,11 @@ public:
|
||||
break;
|
||||
|
||||
case WID_O_FULL_LOAD:
|
||||
this->OrderClick_FullLoad(index);
|
||||
this->OrderClick_FullLoad((OrderLoadFlags)index);
|
||||
break;
|
||||
|
||||
case WID_O_UNLOAD:
|
||||
this->OrderClick_Unload(index);
|
||||
this->OrderClick_Unload((OrderUnloadFlags)index);
|
||||
break;
|
||||
|
||||
case WID_O_GOTO:
|
||||
@@ -2709,17 +2689,17 @@ public:
|
||||
if (this->vehicle->owner != _local_company) return ES_NOT_HANDLED;
|
||||
|
||||
switch (hotkey) {
|
||||
case OHK_SKIP: this->OrderClick_Skip(); break;
|
||||
case OHK_DELETE: this->OrderClick_Delete(); break;
|
||||
case OHK_SKIP: this->OrderClick_Skip(); break;
|
||||
case OHK_DELETE: this->OrderClick_Delete(); break;
|
||||
case OHK_GOTO: this->OrderClick_Goto(OPOS_GOTO); break;
|
||||
case OHK_NONSTOP: this->OrderClick_Nonstop(-1); break;
|
||||
case OHK_FULLLOAD: this->OrderClick_FullLoad(-1); break;
|
||||
case OHK_UNLOAD: this->OrderClick_Unload(-1); break;
|
||||
case OHK_NEAREST_DEPOT: this->OrderClick_NearestDepot(); break;
|
||||
case OHK_ALWAYS_SERVICE: this->OrderClick_Service(-1); break;
|
||||
case OHK_TRANSFER: this->OrderHotkey_Transfer(); break;
|
||||
case OHK_NO_UNLOAD: this->OrderHotkey_NoUnload(); break;
|
||||
case OHK_NO_LOAD: this->OrderHotkey_NoLoad(); break;
|
||||
case OHK_NONSTOP: this->OrderClick_Nonstop(-1); break;
|
||||
case OHK_FULLLOAD: this->OrderClick_FullLoad(OLF_FULL_LOAD_ANY, true); break;
|
||||
case OHK_UNLOAD: this->OrderClick_Unload(OUFB_UNLOAD, true); break;
|
||||
case OHK_NEAREST_DEPOT: this->OrderClick_NearestDepot(); break;
|
||||
case OHK_ALWAYS_SERVICE: this->OrderClick_Service(-1); break;
|
||||
case OHK_TRANSFER: this->OrderClick_Unload(OUFB_TRANSFER, true); break;
|
||||
case OHK_NO_UNLOAD: this->OrderClick_Unload(OUFB_NO_UNLOAD, true); break;
|
||||
case OHK_NO_LOAD: this->OrderClick_FullLoad(OLFB_NO_LOAD, true); break;
|
||||
default: return ES_NOT_HANDLED;
|
||||
}
|
||||
return ES_HANDLED;
|
||||
|
Reference in New Issue
Block a user