diff --git a/src/articulated_vehicles.cpp b/src/articulated_vehicles.cpp --- a/src/articulated_vehicles.cpp +++ b/src/articulated_vehicles.cpp @@ -31,9 +31,9 @@ static const uint MAX_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(u /* 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 engi * 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 GetVehicleDefaultCa { 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 IsArticulatedVehicleCarryingDiffere 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 CheckConsistencyOfArticulatedVehicl 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;