Codechange: Use null pointer literal instead of the NULL macro

This commit is contained in:
Henry Wilson
2019-04-10 22:07:06 +01:00
committed by Michael Lutz
parent 3b4f224c0b
commit 7c8e7c6b6e
463 changed files with 5674 additions and 5674 deletions

View File

@@ -31,9 +31,9 @@ static const uint MAX_ARTICULATED_PARTS = 100; ///< Maximum of articulated parts
* @param mirrored Returns whether the part shall be flipped.
* @return engine to add or INVALID_ENGINE
*/
static EngineID GetNextArticulatedPart(uint index, EngineID front_type, Vehicle *front = NULL, bool *mirrored = NULL)
static EngineID GetNextArticulatedPart(uint index, EngineID front_type, Vehicle *front = nullptr, bool *mirrored = nullptr)
{
assert(front == NULL || front->engine_type == front_type);
assert(front == nullptr || front->engine_type == front_type);
const Engine *front_engine = Engine::Get(front_type);
@@ -44,12 +44,12 @@ static EngineID GetNextArticulatedPart(uint index, EngineID front_type, Vehicle
/* 8 bits, bit 7 for mirroring */
callback = GB(callback, 0, 8);
if (callback == 0xFF) return INVALID_ENGINE;
if (mirrored != NULL) *mirrored = HasBit(callback, 7);
if (mirrored != nullptr) *mirrored = HasBit(callback, 7);
callback = GB(callback, 0, 7);
} else {
/* 15 bits, bit 14 for mirroring */
if (callback == 0x7FFF) return INVALID_ENGINE;
if (mirrored != NULL) *mirrored = HasBit(callback, 14);
if (mirrored != nullptr) *mirrored = HasBit(callback, 14);
callback = GB(callback, 0, 14);
}
@@ -80,7 +80,7 @@ uint CountArticulatedParts(EngineID engine_type, bool purchase_window)
* either, so it doesn't matter how many articulated parts there are. */
if (!Vehicle::CanAllocateItem()) return 0;
Vehicle *v = NULL;
Vehicle *v = nullptr;
if (!purchase_window) {
v = new Vehicle();
v->engine_type = engine_type;
@@ -108,7 +108,7 @@ static inline uint16 GetVehicleDefaultCapacity(EngineID engine, CargoID *cargo_t
{
const Engine *e = Engine::Get(engine);
CargoID cargo = (e->CanCarryCargo() ? e->GetDefaultCargoType() : (CargoID)CT_INVALID);
if (cargo_type != NULL) *cargo_type = cargo;
if (cargo_type != nullptr) *cargo_type = cargo;
if (cargo == CT_INVALID) return 0;
return e->GetDisplayDefaultCapacity();
}
@@ -290,15 +290,15 @@ bool IsArticulatedVehicleCarryingDifferentCargoes(const Vehicle *v, CargoID *car
if (v->cargo_type != CT_INVALID && v->GetEngine()->CanCarryCargo()) {
if (first_cargo == CT_INVALID) first_cargo = v->cargo_type;
if (first_cargo != v->cargo_type) {
if (cargo_type != NULL) *cargo_type = CT_INVALID;
if (cargo_type != nullptr) *cargo_type = CT_INVALID;
return true;
}
}
v = v->HasArticulatedPart() ? v->GetNextArticulatedPart() : NULL;
} while (v != NULL);
v = v->HasArticulatedPart() ? v->GetNextArticulatedPart() : nullptr;
} while (v != nullptr);
if (cargo_type != NULL) *cargo_type = first_cargo;
if (cargo_type != nullptr) *cargo_type = first_cargo;
return false;
}
@@ -330,8 +330,8 @@ void CheckConsistencyOfArticulatedVehicle(const Vehicle *v)
assert(v->cargo_type < NUM_CARGO);
real_default_capacity[v->cargo_type] += v->cargo_cap;
v = v->HasArticulatedPart() ? v->GetNextArticulatedPart() : NULL;
} while (v != NULL);
v = v->HasArticulatedPart() ? v->GetNextArticulatedPart() : nullptr;
} while (v != nullptr);
/* Check whether the vehicle carries more cargoes than expected */
bool carries_more = false;