summaryrefslogtreecommitdiff
path: root/src/cargoaction.cpp
diff options
context:
space:
mode:
authorHenry Wilson <m3henry@googlemail.com>2019-04-10 22:07:06 +0100
committerMichael Lutz <michi@icosahedron.de>2019-04-10 23:22:20 +0200
commit7c8e7c6b6e16d4a26259a676db32d8776b99817e (patch)
tree99f134b7e66367cf11e10bc5061896eab4a3264f /src/cargoaction.cpp
parent3b4f224c0bc50e7248050d4bcbb6d83fd510c1cc (diff)
downloadopenttd-7c8e7c6b6e16d4a26259a676db32d8776b99817e.tar.xz
Codechange: Use null pointer literal instead of the NULL macro
Diffstat (limited to 'src/cargoaction.cpp')
-rw-r--r--src/cargoaction.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/cargoaction.cpp b/src/cargoaction.cpp
index 96ddc3708..afc1b0fff 100644
--- a/src/cargoaction.cpp
+++ b/src/cargoaction.cpp
@@ -121,7 +121,7 @@ bool CargoDelivery::operator()(CargoPacket *cp)
bool CargoLoad::operator()(CargoPacket *cp)
{
CargoPacket *cp_new = this->Preprocess(cp);
- if (cp_new == NULL) return false;
+ if (cp_new == nullptr) return false;
cp_new->SetLoadPlace(this->load_place);
this->source->RemoveFromCache(cp_new, cp_new->Count());
this->destination->Append(cp_new, VehicleCargoList::MTA_KEEP);
@@ -136,7 +136,7 @@ bool CargoLoad::operator()(CargoPacket *cp)
bool CargoReservation::operator()(CargoPacket *cp)
{
CargoPacket *cp_new = this->Preprocess(cp);
- if (cp_new == NULL) return false;
+ if (cp_new == nullptr) return false;
cp_new->SetLoadPlace(this->load_place);
this->source->reserved_count += cp_new->Count();
this->source->RemoveFromCache(cp_new, cp_new->Count());
@@ -152,7 +152,7 @@ bool CargoReservation::operator()(CargoPacket *cp)
bool CargoReturn::operator()(CargoPacket *cp)
{
CargoPacket *cp_new = this->Preprocess(cp);
- if (cp_new == NULL) cp_new = cp;
+ if (cp_new == nullptr) cp_new = cp;
assert(cp_new->Count() <= this->destination->reserved_count);
this->source->RemoveFromMeta(cp_new, VehicleCargoList::MTA_LOAD, cp_new->Count());
this->destination->reserved_count -= cp_new->Count();
@@ -168,7 +168,7 @@ bool CargoReturn::operator()(CargoPacket *cp)
bool CargoTransfer::operator()(CargoPacket *cp)
{
CargoPacket *cp_new = this->Preprocess(cp);
- if (cp_new == NULL) return false;
+ if (cp_new == nullptr) return false;
this->source->RemoveFromMeta(cp_new, VehicleCargoList::MTA_TRANSFER, cp_new->Count());
/* No transfer credits here as they were already granted during Stage(). */
this->destination->Append(cp_new, cp_new->NextStation());
@@ -183,7 +183,7 @@ bool CargoTransfer::operator()(CargoPacket *cp)
bool CargoShift::operator()(CargoPacket *cp)
{
CargoPacket *cp_new = this->Preprocess(cp);
- if (cp_new == NULL) cp_new = cp;
+ if (cp_new == nullptr) cp_new = cp;
this->source->RemoveFromMeta(cp_new, VehicleCargoList::MTA_KEEP, cp_new->Count());
this->destination->Append(cp_new, VehicleCargoList::MTA_KEEP);
return cp_new == cp;
@@ -197,7 +197,7 @@ bool CargoShift::operator()(CargoPacket *cp)
bool StationCargoReroute::operator()(CargoPacket *cp)
{
CargoPacket *cp_new = this->Preprocess(cp);
- if (cp_new == NULL) cp_new = cp;
+ if (cp_new == nullptr) cp_new = cp;
StationID next = this->ge->GetVia(cp_new->SourceStation(), this->avoid, this->avoid2);
assert(next != this->avoid && next != this->avoid2);
if (this->source != this->destination) {
@@ -220,7 +220,7 @@ bool StationCargoReroute::operator()(CargoPacket *cp)
bool VehicleCargoReroute::operator()(CargoPacket *cp)
{
CargoPacket *cp_new = this->Preprocess(cp);
- if (cp_new == NULL) cp_new = cp;
+ if (cp_new == nullptr) cp_new = cp;
if (cp_new->NextStation() == this->avoid || cp_new->NextStation() == this->avoid2) {
cp->SetNextStation(this->ge->GetVia(cp_new->SourceStation(), this->avoid, this->avoid2));
}