Merge branch 'master' into jgrpp
# Conflicts: # src/autoreplace_cmd.cpp # src/build_vehicle_gui.cpp # src/cargotype.cpp # src/economy.cpp # src/engine_gui.cpp # src/industry_cmd.cpp # src/industry_gui.cpp # src/linkgraph/linkgraph_gui.h # src/linkgraph/refresh.cpp # src/linkgraph/refresh.h # src/newgrf.cpp # src/newgrf_airporttiles.h # src/newgrf_roadstop.cpp # src/newgrf_station.cpp # src/newgrf_station.h # src/order_base.h # src/order_cmd.cpp # src/order_func.h # src/order_gui.cpp # src/pathfinder/pathfinder_type.h # src/saveload/afterload.cpp # src/subsidy_base.h # src/vehicle_cmd.cpp # src/vehicle_gui.cpp # src/vehicle_gui_base.h
This commit is contained in:
@@ -340,7 +340,7 @@ Order::Order(uint64_t packed)
|
||||
this->dest = GB(packed, 24, 16);
|
||||
this->extra = nullptr;
|
||||
this->next = nullptr;
|
||||
this->refit_cargo = CT_NO_REFIT;
|
||||
this->refit_cargo = CARGO_NO_REFIT;
|
||||
this->occupancy = 0;
|
||||
this->wait_time = 0;
|
||||
this->travel_time = 0;
|
||||
@@ -1804,7 +1804,7 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
|
||||
VehicleID veh = GB(p1, 0, 20);
|
||||
ModifyOrderFlags mof = Extract<ModifyOrderFlags, 0, 8>(p2);
|
||||
uint16_t data = GB(p2, 8, 16);
|
||||
CargoID cargo_id = (mof == MOF_CARGO_TYPE_UNLOAD || mof == MOF_CARGO_TYPE_LOAD) ? (CargoID) GB(p2, 24, 8) : (CargoID) CT_INVALID;
|
||||
CargoID cargo_id = (mof == MOF_CARGO_TYPE_UNLOAD || mof == MOF_CARGO_TYPE_LOAD) ? (CargoID) GB(p2, 24, 8) : (CargoID) INVALID_CARGO;
|
||||
|
||||
if (mof >= MOF_END) return CMD_ERROR;
|
||||
|
||||
@@ -1878,7 +1878,7 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
|
||||
break;
|
||||
|
||||
case MOF_CARGO_TYPE_UNLOAD:
|
||||
if (cargo_id >= NUM_CARGO && cargo_id != CT_INVALID) return CMD_ERROR;
|
||||
if (cargo_id >= NUM_CARGO && cargo_id != INVALID_CARGO) return CMD_ERROR;
|
||||
if (data == OUFB_CARGO_TYPE_UNLOAD) return CMD_ERROR;
|
||||
/* FALL THROUGH */
|
||||
case MOF_UNLOAD:
|
||||
@@ -1892,7 +1892,7 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
|
||||
break;
|
||||
|
||||
case MOF_CARGO_TYPE_LOAD:
|
||||
if (cargo_id >= NUM_CARGO && cargo_id != CT_INVALID) return CMD_ERROR;
|
||||
if (cargo_id >= NUM_CARGO && cargo_id != INVALID_CARGO) return CMD_ERROR;
|
||||
if (data == OLFB_CARGO_TYPE_LOAD || data == OLF_FULL_LOAD_ANY) return CMD_ERROR;
|
||||
/* FALL THROUGH */
|
||||
case MOF_LOAD:
|
||||
@@ -2090,7 +2090,7 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
|
||||
case MOF_NON_STOP:
|
||||
order->SetNonStopType((OrderNonStopFlags)data);
|
||||
if (data & ONSF_NO_STOP_AT_DESTINATION_STATION) {
|
||||
order->SetRefit(CT_NO_REFIT);
|
||||
order->SetRefit(CARGO_NO_REFIT);
|
||||
order->SetLoadType(OLF_LOAD_IF_POSSIBLE);
|
||||
order->SetUnloadType(OUF_UNLOAD_IF_POSSIBLE);
|
||||
if (order->IsWaitTimetabled() || order->GetWaitTime() > 0) {
|
||||
@@ -2111,7 +2111,7 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
|
||||
break;
|
||||
|
||||
case MOF_CARGO_TYPE_UNLOAD:
|
||||
if (cargo_id == CT_INVALID) {
|
||||
if (cargo_id == INVALID_CARGO) {
|
||||
for (CargoID i = 0; i < NUM_CARGO; i++) {
|
||||
order->SetUnloadType((OrderUnloadFlags)data, i);
|
||||
}
|
||||
@@ -2122,11 +2122,11 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
|
||||
|
||||
case MOF_LOAD:
|
||||
order->SetLoadType((OrderLoadFlags)data);
|
||||
if (data & OLFB_NO_LOAD) order->SetRefit(CT_NO_REFIT);
|
||||
if (data & OLFB_NO_LOAD) order->SetRefit(CARGO_NO_REFIT);
|
||||
break;
|
||||
|
||||
case MOF_CARGO_TYPE_LOAD:
|
||||
if (cargo_id == CT_INVALID) {
|
||||
if (cargo_id == INVALID_CARGO) {
|
||||
for (CargoID i = 0; i < NUM_CARGO; i++) {
|
||||
order->SetLoadType((OrderLoadFlags)data, i);
|
||||
}
|
||||
@@ -2146,19 +2146,19 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
|
||||
case DA_SERVICE:
|
||||
order->SetDepotOrderType((OrderDepotTypeFlags)(order->GetDepotOrderType() | ODTFB_SERVICE));
|
||||
order->SetDepotActionType((OrderDepotActionFlags)(base_order_action_type));
|
||||
order->SetRefit(CT_NO_REFIT);
|
||||
order->SetRefit(CARGO_NO_REFIT);
|
||||
break;
|
||||
|
||||
case DA_STOP:
|
||||
order->SetDepotOrderType((OrderDepotTypeFlags)(order->GetDepotOrderType() & ~ODTFB_SERVICE));
|
||||
order->SetDepotActionType((OrderDepotActionFlags)(base_order_action_type | ODATFB_HALT));
|
||||
order->SetRefit(CT_NO_REFIT);
|
||||
order->SetRefit(CARGO_NO_REFIT);
|
||||
break;
|
||||
|
||||
case DA_SELL:
|
||||
order->SetDepotOrderType((OrderDepotTypeFlags)(order->GetDepotOrderType() & ~ODTFB_SERVICE));
|
||||
order->SetDepotActionType((OrderDepotActionFlags)(base_order_action_type | ODATFB_HALT | ODATFB_SELL));
|
||||
order->SetRefit(CT_NO_REFIT);
|
||||
order->SetRefit(CARGO_NO_REFIT);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -2374,7 +2374,7 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
|
||||
}
|
||||
switch (mof) {
|
||||
case MOF_CARGO_TYPE_UNLOAD:
|
||||
if (cargo_id == CT_INVALID) {
|
||||
if (cargo_id == INVALID_CARGO) {
|
||||
for (CargoID i = 0; i < NUM_CARGO; i++) {
|
||||
u->current_order.SetUnloadType((OrderUnloadFlags)data, i);
|
||||
}
|
||||
@@ -2384,7 +2384,7 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
|
||||
break;
|
||||
|
||||
case MOF_CARGO_TYPE_LOAD:
|
||||
if (cargo_id == CT_INVALID) {
|
||||
if (cargo_id == INVALID_CARGO) {
|
||||
for (CargoID i = 0; i < NUM_CARGO; i++) {
|
||||
u->current_order.SetLoadType((OrderLoadFlags)data, i);
|
||||
}
|
||||
@@ -2717,7 +2717,7 @@ CommandCost CmdOrderRefit(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint
|
||||
VehicleOrderID order_number = GB(p2, 16, 16);
|
||||
CargoID cargo = GB(p2, 0, 8);
|
||||
|
||||
if (cargo >= NUM_CARGO && cargo != CT_NO_REFIT && cargo != CT_AUTO_REFIT) return CMD_ERROR;
|
||||
if (cargo >= NUM_CARGO && cargo != CARGO_NO_REFIT && cargo != CARGO_AUTO_REFIT) return CMD_ERROR;
|
||||
|
||||
const Vehicle *v = Vehicle::GetIfValid(veh);
|
||||
if (v == nullptr || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
||||
@@ -2729,7 +2729,7 @@ CommandCost CmdOrderRefit(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint
|
||||
if (order == nullptr) return CMD_ERROR;
|
||||
|
||||
/* Automatic refit cargo is only supported for goto station orders. */
|
||||
if (cargo == CT_AUTO_REFIT && !order->IsType(OT_GOTO_STATION)) return CMD_ERROR;
|
||||
if (cargo == CARGO_AUTO_REFIT && !order->IsType(OT_GOTO_STATION)) return CMD_ERROR;
|
||||
|
||||
if (order->GetLoadType() & OLFB_NO_LOAD) return CMD_ERROR;
|
||||
|
||||
@@ -2737,7 +2737,7 @@ CommandCost CmdOrderRefit(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint
|
||||
order->SetRefit(cargo);
|
||||
|
||||
/* Make the depot order an 'always go' order. */
|
||||
if (cargo != CT_NO_REFIT && order->IsType(OT_GOTO_DEPOT)) {
|
||||
if (cargo != CARGO_NO_REFIT && order->IsType(OT_GOTO_DEPOT)) {
|
||||
order->SetDepotOrderType((OrderDepotTypeFlags)(order->GetDepotOrderType() & ~ODTFB_SERVICE));
|
||||
order->SetDepotActionType((OrderDepotActionFlags)(order->GetDepotActionType() & ~(ODATFB_HALT | ODATFB_SELL)));
|
||||
}
|
||||
|
Reference in New Issue
Block a user