Codechange: Use null pointer literal instead of the NULL macro
This commit is contained in:

committed by
Michael Lutz

parent
3b4f224c0b
commit
7c8e7c6b6e
@@ -30,7 +30,7 @@ OrderBackup::~OrderBackup()
|
||||
if (CleaningPool()) return;
|
||||
|
||||
Order *o = this->orders;
|
||||
while (o != NULL) {
|
||||
while (o != nullptr) {
|
||||
Order *next = o->next;
|
||||
delete o;
|
||||
o = next;
|
||||
@@ -75,11 +75,11 @@ OrderBackup::OrderBackup(const Vehicle *v, uint32 user)
|
||||
void OrderBackup::DoRestore(Vehicle *v)
|
||||
{
|
||||
/* If we had shared orders, recover that */
|
||||
if (this->clone != NULL) {
|
||||
if (this->clone != nullptr) {
|
||||
DoCommand(0, v->index | CO_SHARE << 30, this->clone->index, DC_EXEC, CMD_CLONE_ORDER);
|
||||
} else if (this->orders != NULL && OrderList::CanAllocateItem()) {
|
||||
} else if (this->orders != nullptr && OrderList::CanAllocateItem()) {
|
||||
v->orders.list = new OrderList(this->orders, v);
|
||||
this->orders = NULL;
|
||||
this->orders = nullptr;
|
||||
/* Make sure buoys/oil rigs are updated in the station list. */
|
||||
InvalidateWindowClassesData(WC_STATION_LIST, 0);
|
||||
}
|
||||
@@ -206,7 +206,7 @@ CommandCost CmdClearOrderBackup(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||
/* We need to circumvent the "prevention" from this command being executed
|
||||
* while the game is paused, so use the internal method. Nor do we want
|
||||
* this command to get its cost estimated when shift is pressed. */
|
||||
DoCommandPInternal(ob->tile, 0, user, CMD_CLEAR_ORDER_BACKUP, NULL, NULL, true, false);
|
||||
DoCommandPInternal(ob->tile, 0, user, CMD_CLEAR_ORDER_BACKUP, nullptr, nullptr, true, false);
|
||||
} else {
|
||||
/* The command came from the game logic, i.e. the clearing of a tile.
|
||||
* In that case we have no need to actually sync this, just do it. */
|
||||
@@ -230,20 +230,20 @@ CommandCost CmdClearOrderBackup(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||
/**
|
||||
* Clear/update the (clone) vehicle from an order backup.
|
||||
* @param v The vehicle to clear.
|
||||
* @pre v != NULL
|
||||
* @pre v != nullptr
|
||||
* @note If it is not possible to set another vehicle as clone
|
||||
* "example", then this backed up order will be removed.
|
||||
*/
|
||||
/* static */ void OrderBackup::ClearVehicle(const Vehicle *v)
|
||||
{
|
||||
assert(v != NULL);
|
||||
assert(v != nullptr);
|
||||
OrderBackup *ob;
|
||||
FOR_ALL_ORDER_BACKUPS(ob) {
|
||||
if (ob->clone == v) {
|
||||
/* Get another item in the shared list. */
|
||||
ob->clone = (v->FirstShared() == v) ? v->NextShared() : v->FirstShared();
|
||||
/* But if that isn't there, remove it. */
|
||||
if (ob->clone == NULL) delete ob;
|
||||
if (ob->clone == nullptr) delete ob;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -260,7 +260,7 @@ CommandCost CmdClearOrderBackup(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||
{
|
||||
OrderBackup *ob;
|
||||
FOR_ALL_ORDER_BACKUPS(ob) {
|
||||
for (Order *order = ob->orders; order != NULL; order = order->next) {
|
||||
for (Order *order = ob->orders; order != nullptr; order = order->next) {
|
||||
OrderType ot = order->GetType();
|
||||
if (ot == OT_GOTO_DEPOT && (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0) continue;
|
||||
if (ot == OT_GOTO_DEPOT && hangar && !IsHangarTile(ob->tile)) continue; // Not an aircraft? Can't have a hangar order.
|
||||
|
Reference in New Issue
Block a user