From 7c8e7c6b6e16d4a26259a676db32d8776b99817e Mon Sep 17 00:00:00 2001 From: Henry Wilson Date: Wed, 10 Apr 2019 22:07:06 +0100 Subject: Codechange: Use null pointer literal instead of the NULL macro --- src/vehiclelist.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/vehiclelist.cpp') diff --git a/src/vehiclelist.cpp b/src/vehiclelist.cpp index c98797573..acb848982 100644 --- a/src/vehiclelist.cpp +++ b/src/vehiclelist.cpp @@ -65,13 +65,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) { @@ -84,7 +84,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; } @@ -104,7 +104,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(); } /** @@ -139,9 +139,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; -- cgit v1.2.3-54-g00ecf