Update to 14.0-beta1

This commit is contained in:
dP
2024-02-04 02:18:17 +05:30
parent 79037e2c65
commit 33ef333b57
1325 changed files with 138465 additions and 70987 deletions

View File

@@ -10,6 +10,7 @@
#include "stdafx.h"
#include "train.h"
#include "vehiclelist.h"
#include "vehiclelist_func.h"
#include "group.h"
#include "safeguards.h"
@@ -18,7 +19,7 @@
* Pack a VehicleListIdentifier in a single uint32.
* @return The packed identifier.
*/
uint32 VehicleListIdentifier::Pack() const
uint32_t VehicleListIdentifier::Pack() const
{
byte c = this->company == OWNER_NONE ? 0xF : (byte)this->company;
assert(c < (1 << 4));
@@ -35,7 +36,7 @@ uint32 VehicleListIdentifier::Pack() const
* @param data The data to unpack.
* @return true iff the data was valid (enough).
*/
bool VehicleListIdentifier::UnpackIfValid(uint32 data)
bool VehicleListIdentifier::UnpackIfValid(uint32_t data)
{
byte c = GB(data, 28, 4);
this->company = c == 0xF ? OWNER_NONE : (CompanyID)c;
@@ -50,7 +51,7 @@ bool VehicleListIdentifier::UnpackIfValid(uint32 data)
* Decode a packed vehicle list identifier into a new one.
* @param data The data to unpack.
*/
/* static */ VehicleListIdentifier VehicleListIdentifier::UnPack(uint32 data)
/* static */ VehicleListIdentifier VehicleListIdentifier::UnPack(uint32_t data)
{
VehicleListIdentifier result;
[[maybe_unused]] bool ret = result.UnpackIfValid(data);
@@ -116,17 +117,11 @@ bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &vli
switch (vli.type) {
case VL_STATION_LIST:
for (const Vehicle *v : Vehicle::Iterate()) {
if (v->type == vli.vtype && v->IsPrimaryVehicle()) {
for (const Order *order : v->Orders()) {
if ((order->IsType(OT_GOTO_STATION) || order->IsType(OT_GOTO_WAYPOINT) || order->IsType(OT_IMPLICIT))
&& order->GetDestination() == vli.index) {
list->push_back(v);
break;
}
}
}
}
FindVehiclesWithOrder(
[&vli](const Vehicle *v) { return v->type == vli.vtype; },
[&vli](const Order *order) { return (order->IsType(OT_GOTO_STATION) || order->IsType(OT_GOTO_WAYPOINT) || order->IsType(OT_IMPLICIT)) && order->GetDestination() == vli.index; },
[&list](const Vehicle *v) { list->push_back(v); }
);
break;
case VL_SHARED_ORDERS: {
@@ -150,7 +145,7 @@ bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &vli
}
break;
}
FALLTHROUGH;
[[fallthrough]];
case VL_STANDARD:
for (const Vehicle *v : Vehicle::Iterate()) {
@@ -161,16 +156,11 @@ bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &vli
break;
case VL_DEPOT_LIST:
for (const Vehicle *v : Vehicle::Iterate()) {
if (v->type == vli.vtype && v->IsPrimaryVehicle()) {
for (const Order *order : v->Orders()) {
if (order->IsType(OT_GOTO_DEPOT) && !(order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) && order->GetDestination() == vli.index) {
list->push_back(v);
break;
}
}
}
}
FindVehiclesWithOrder(
[&vli](const Vehicle *v) { return v->type == vli.vtype; },
[&vli](const Order *order) { return order->IsType(OT_GOTO_DEPOT) && !(order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) && order->GetDestination() == vli.index; },
[&list](const Vehicle *v) { list->push_back(v); }
);
break;
default: return false;