Merge: Codechange: Use null pointer literal instead of the NULL macro
This commit is contained in:
@@ -66,13 +66,13 @@ bool VehicleListIdentifier::UnpackIfValid(uint32 data)
|
||||
* @param type Type of vehicle
|
||||
* @param tile The tile the depot is located on
|
||||
* @param engines Pointer to list to add vehicles to
|
||||
* @param wagons Pointer to list to add wagons to (can be NULL)
|
||||
* @param wagons Pointer to list to add wagons to (can be nullptr)
|
||||
* @param individual_wagons If true add every wagon to \a wagons which is not attached to an engine. If false only add the first wagon of every row.
|
||||
*/
|
||||
void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engines, VehicleList *wagons, bool individual_wagons)
|
||||
{
|
||||
engines->clear();
|
||||
if (wagons != NULL && wagons != engines) wagons->clear();
|
||||
if (wagons != nullptr && wagons != engines) wagons->clear();
|
||||
|
||||
const Vehicle *v;
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
@@ -85,7 +85,7 @@ void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engine
|
||||
const Train *t = Train::From(v);
|
||||
if (t->IsArticulatedPart() || t->IsRearDualheaded()) continue;
|
||||
if (t->track != TRACK_BIT_DEPOT) continue;
|
||||
if (wagons != NULL && t->First()->IsFreeWagon()) {
|
||||
if (wagons != nullptr && t->First()->IsFreeWagon()) {
|
||||
if (individual_wagons || t->IsFreeWagon()) wagons->push_back(t);
|
||||
continue;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engine
|
||||
/* Ensure the lists are not wasting too much space. If the lists are fresh
|
||||
* (i.e. built within a command) then this will actually do nothing. */
|
||||
engines->shrink_to_fit();
|
||||
if (wagons != NULL && wagons != engines) wagons->shrink_to_fit();
|
||||
if (wagons != nullptr && wagons != engines) wagons->shrink_to_fit();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,9 +148,9 @@ bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &vli
|
||||
case VL_SHARED_ORDERS:
|
||||
/* Add all vehicles from this vehicle's shared order list */
|
||||
v = Vehicle::GetIfValid(vli.index);
|
||||
if (v == NULL || v->type != vli.vtype || !v->IsPrimaryVehicle()) return false;
|
||||
if (v == nullptr || v->type != vli.vtype || !v->IsPrimaryVehicle()) return false;
|
||||
|
||||
for (; v != NULL; v = v->NextShared()) {
|
||||
for (; v != nullptr; v = v->NextShared()) {
|
||||
list->push_back(v);
|
||||
}
|
||||
break;
|
||||
@@ -192,7 +192,7 @@ bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &vli
|
||||
fill_all_vehicles();
|
||||
} else {
|
||||
const TraceRestrictSlot *slot = TraceRestrictSlot::GetIfValid(vli.index);
|
||||
if (slot == NULL) return false;
|
||||
if (slot == nullptr) return false;
|
||||
for (VehicleID id : slot->occupants) {
|
||||
list->push_back(Vehicle::Get(id));
|
||||
}
|
||||
@@ -202,7 +202,7 @@ bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &vli
|
||||
|
||||
case VL_SINGLE_VEH: {
|
||||
v = Vehicle::GetIfValid(vli.index);
|
||||
if (v != NULL) list->push_back(v);
|
||||
if (v != nullptr) list->push_back(v);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user