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

@@ -137,11 +137,11 @@ DisasterVehicle::DisasterVehicle(int x, int y, Direction direction, DisasterSubT
case ST_HELICOPTER:
case ST_BIG_UFO:
case ST_BIG_UFO_DESTROYER:
GetAircraftFlightLevelBounds(this, &this->z_pos, NULL);
GetAircraftFlightLevelBounds(this, &this->z_pos, nullptr);
break;
case ST_HELICOPTER_ROTORS:
GetAircraftFlightLevelBounds(this, &this->z_pos, NULL);
GetAircraftFlightLevelBounds(this, &this->z_pos, nullptr);
this->z_pos += ROTOR_Z_OFFSET;
break;
@@ -190,7 +190,7 @@ void DisasterVehicle::UpdatePosition(int x, int y, int z)
this->UpdatePositionAndViewport();
DisasterVehicle *u = this->Next();
if (u != NULL) {
if (u != nullptr) {
int safe_x = Clamp(x, 0, MapMaxX() * TILE_SIZE);
int safe_y = Clamp(y - 1, 0, MapMaxY() * TILE_SIZE);
@@ -203,7 +203,7 @@ void DisasterVehicle::UpdatePosition(int x, int y, int z)
u->UpdateImage();
u->UpdatePositionAndViewport();
if ((u = u->Next()) != NULL) {
if ((u = u->Next()) != nullptr) {
u->x_pos = x;
u->y_pos = y;
u->z_pos = z + ROTOR_Z_OFFSET;
@@ -357,7 +357,7 @@ static bool DisasterTick_Ufo(DisasterVehicle *v)
} else {
/* Target a vehicle */
RoadVehicle *u = RoadVehicle::Get(v->dest_tile);
assert(u != NULL && u->type == VEH_ROAD && u->IsFrontEngine());
assert(u != nullptr && u->type == VEH_ROAD && u->IsFrontEngine());
uint dist = Delta(v->x_pos, u->x_pos) + Delta(v->y_pos, u->y_pos);
@@ -748,16 +748,16 @@ static void Disaster_Airplane_Init()
{
if (!Vehicle::CanAllocateItem(2)) return;
Industry *i, *found = NULL;
Industry *i, *found = nullptr;
FOR_ALL_INDUSTRIES(i) {
if ((GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_AIRPLANE_ATTACKS) &&
(found == NULL || Chance16(1, 2))) {
(found == nullptr || Chance16(1, 2))) {
found = i;
}
}
if (found == NULL) return;
if (found == nullptr) return;
/* Start from the bottom (south side) of the map */
int x = (MapSizeX() + 9) * TILE_SIZE - 1;
@@ -774,16 +774,16 @@ static void Disaster_Helicopter_Init()
{
if (!Vehicle::CanAllocateItem(3)) return;
Industry *i, *found = NULL;
Industry *i, *found = nullptr;
FOR_ALL_INDUSTRIES(i) {
if ((GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_CHOPPER_ATTACKS) &&
(found == NULL || Chance16(1, 2))) {
(found == nullptr || Chance16(1, 2))) {
found = i;
}
}
if (found == NULL) return;
if (found == nullptr) return;
int x = -16 * (int)TILE_SIZE;
int y = TileY(found->location.tile) * TILE_SIZE + 37;
@@ -966,7 +966,7 @@ void ReleaseDisastersTargetingVehicle(VehicleID vehicle)
/* Revert to target-searching */
v->current_order.SetDestination(0);
v->dest_tile = RandomTile();
GetAircraftFlightLevelBounds(v, &v->z_pos, NULL);
GetAircraftFlightLevelBounds(v, &v->z_pos, nullptr);
v->age = 0;
}
}