Update to 12.0-beta1

This commit is contained in:
dP
2021-08-15 14:57:29 +03:00
parent ac7d3eba75
commit 9df4f2c4fc
666 changed files with 61302 additions and 20466 deletions

View File

@@ -548,13 +548,13 @@ private:
VehicleOrderID GetOrderFromPt(int y)
{
NWidgetBase *nwid = this->GetWidget<NWidgetBase>(WID_O_ORDER_LIST);
int sel = (y - nwid->pos_y - WD_FRAMERECT_TOP) / nwid->resize_y; // Selected line in the WID_O_ORDER_LIST panel.
uint sel = (y - nwid->pos_y - WD_FRAMERECT_TOP) / nwid->resize_y; // Selected line in the WID_O_ORDER_LIST panel.
if ((uint)sel >= this->vscroll->GetCapacity()) return INVALID_VEH_ORDER_ID;
if (sel >= this->vscroll->GetCapacity()) return INVALID_VEH_ORDER_ID;
sel += this->vscroll->GetPosition();
return (sel <= vehicle->GetNumOrders() && sel >= 0) ? sel : INVALID_VEH_ORDER_ID;
return (sel <= vehicle->GetNumOrders()) ? sel : INVALID_VEH_ORDER_ID;
}
/**
@@ -643,8 +643,8 @@ private:
DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_UNLOAD | (unload_type << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
/* Transfer orders with leave empty as default */
if (unload_type == OUFB_TRANSFER) {
/* Transfer and unload orders with leave empty as default */
if (unload_type == OUFB_TRANSFER || unload_type == OUFB_UNLOAD) {
DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_LOAD | (OLFB_NO_LOAD << 4), CMD_MODIFY_ORDER);
this->SetWidgetDirty(WID_O_FULL_LOAD);
}
@@ -843,7 +843,7 @@ public:
/* Removed / replaced all orders (after deleting / sharing) */
if (this->selected_order == -1) break;
this->DeleteChildWindows();
this->CloseChildWindows();
HideDropDownMenu(this);
this->selected_order = -1;
break;
@@ -875,7 +875,7 @@ public:
/* Now we are modifying the selected order */
if (to == INVALID_VEH_ORDER_ID) {
/* Deleting selected order */
this->DeleteChildWindows();
this->CloseChildWindows();
HideDropDownMenu(this);
this->selected_order = -1;
break;
@@ -1174,7 +1174,7 @@ public:
}
/* This order won't be selected any more, close all child windows and dropdowns */
this->DeleteChildWindows();
this->CloseChildWindows();
HideDropDownMenu(this);
if (sel == INVALID_VEH_ORDER_ID || this->vehicle->owner != _local_company) {
@@ -1700,12 +1700,12 @@ static WindowDesc _other_orders_desc(
void ShowOrdersWindow(const Vehicle *v)
{
DeleteWindowById(WC_VEHICLE_DETAILS, v->index, false);
DeleteWindowById(WC_VEHICLE_TIMETABLE, v->index, false);
CloseWindowById(WC_VEHICLE_DETAILS, v->index, false);
CloseWindowById(WC_VEHICLE_TIMETABLE, v->index, false);
if (BringWindowToFrontById(WC_VEHICLE_ORDERS, v->index) != nullptr) return;
/* Using a different WindowDescs for _local_company causes problems.
* Due to this we have to close order windows in ChangeWindowOwner/DeleteCompanyWindows,
* Due to this we have to close order windows in ChangeWindowOwner/CloseCompanyWindows,
* because we cannot change switch the WindowDescs and keeping the old WindowDesc results
* in crashed due to missing widges.
* TODO Rewrite the order GUI to not use different WindowDescs.