diff options
author | Henry Wilson <m3henry@googlemail.com> | 2019-04-10 22:07:06 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2019-04-10 23:22:20 +0200 |
commit | 7c8e7c6b6e16d4a26259a676db32d8776b99817e (patch) | |
tree | 99f134b7e66367cf11e10bc5061896eab4a3264f /src/cargopacket.cpp | |
parent | 3b4f224c0bc50e7248050d4bcbb6d83fd510c1cc (diff) | |
download | openttd-7c8e7c6b6e16d4a26259a676db32d8776b99817e.tar.xz |
Codechange: Use null pointer literal instead of the NULL macro
Diffstat (limited to 'src/cargopacket.cpp')
-rw-r--r-- | src/cargopacket.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/cargopacket.cpp b/src/cargopacket.cpp index 9e699d6f4..2147783c8 100644 --- a/src/cargopacket.cpp +++ b/src/cargopacket.cpp @@ -86,11 +86,11 @@ CargoPacket::CargoPacket(uint16 count, byte days_in_transit, StationID source, T /** * Split this packet in two and return the split off part. * @param new_size Size of the split part. - * @return Split off part, or NULL if no packet could be allocated! + * @return Split off part, or nullptr if no packet could be allocated! */ CargoPacket *CargoPacket::Split(uint new_size) { - if (!CargoPacket::CanAllocateItem()) return NULL; + if (!CargoPacket::CanAllocateItem()) return nullptr; Money fs = this->FeederShare(new_size); CargoPacket *cp_new = new CargoPacket(new_size, this->days_in_transit, this->source, this->source_xy, this->loaded_at_xy, fs, this->source_type, this->source_id); @@ -248,12 +248,12 @@ template <class Tinst, class Tcont> * @param cp Cargo packet to add. * @param action Either MTA_KEEP if you want to add the packet directly or MTA_LOAD * if you want to reserve it first. - * @pre cp != NULL + * @pre cp != nullptr * @pre action == MTA_LOAD || (action == MTA_KEEP && this->designation_counts[MTA_LOAD] == 0) */ void VehicleCargoList::Append(CargoPacket *cp, MoveToAction action) { - assert(cp != NULL); + assert(cp != nullptr); assert(action == MTA_LOAD || (action == MTA_KEEP && this->action_counts[MTA_LOAD] == 0)); this->AddToMeta(cp, action); @@ -689,11 +689,11 @@ uint VehicleCargoList::Reroute(uint max_move, VehicleCargoList *dest, StationID * @note Do not use the cargo packet anymore after it has been appended to this CargoList! * @param next the next hop * @param cp the cargo packet to add - * @pre cp != NULL + * @pre cp != nullptr */ void StationCargoList::Append(CargoPacket *cp, StationID next) { - assert(cp != NULL); + assert(cp != nullptr); this->AddToCache(cp); StationCargoPacketMap::List &list = this->packets[next]; @@ -776,7 +776,7 @@ uint StationCargoList::Truncate(uint max_move, StationCargoAmountMap *cargo_per_ uint prev_count = this->count; uint moved = 0; uint loop = 0; - bool do_count = cargo_per_source != NULL; + bool do_count = cargo_per_source != nullptr; while (max_move > moved) { for (Iterator it(this->packets.begin()); it != this->packets.end();) { CargoPacket *cp = *it; |