Merge: Codechange: Use null pointer literal instead of the NULL macro

This commit is contained in:
Jonathan G Rennison
2019-04-11 18:14:13 +01:00
585 changed files with 6604 additions and 6604 deletions

View File

@@ -90,7 +90,7 @@ void BuildObject(ObjectType type, TileIndex tile, CompanyID owner, Town *town, u
Object *o = new Object();
o->type = type;
o->location = ta;
o->town = town == NULL ? CalcClosestTownFromTile(tile) : town;
o->town = town == nullptr ? CalcClosestTownFromTile(tile) : town;
o->build_date = _date;
o->view = view;
@@ -114,7 +114,7 @@ void BuildObject(ObjectType type, TileIndex tile, CompanyID owner, Town *town, u
}
}
assert(o->town != NULL);
assert(o->town != nullptr);
TILE_AREA_LOOP(t, ta) {
WaterClass wc = (IsWaterTile(t) ? GetWaterClass(t) : WATER_CLASS_INVALID);
@@ -264,7 +264,7 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
uint16 callback = CALLBACK_FAILED;
if (HasBit(spec->callback_mask, CBM_OBJ_SLOPE_CHECK)) {
TileIndex diff = t - tile;
callback = GetObjectCallback(CBID_OBJECT_LAND_SLOPE_CHECK, GetTileSlope(t), TileY(diff) << 4 | TileX(diff), spec, NULL, t, view);
callback = GetObjectCallback(CBID_OBJECT_LAND_SLOPE_CHECK, GetTileSlope(t), TileY(diff) << 4 | TileX(diff), spec, nullptr, t, view);
}
if (callback == CALLBACK_FAILED) {
@@ -319,7 +319,7 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
return_cmd_error(STR_ERROR_YOU_ALREADY_OWN_IT);
}
c = Company::GetIfValid(_current_company);
if (c != NULL && (int)GB(c->purchase_land_limit, 16, 16) < 1) {
if (c != nullptr && (int)GB(c->purchase_land_limit, 16, 16) < 1) {
return_cmd_error(STR_ERROR_PURCHASE_LAND_LIMIT_REACHED);
}
break;
@@ -350,12 +350,12 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
}
if (flags & DC_EXEC) {
BuildObject(type, tile, _current_company, NULL, view);
BuildObject(type, tile, _current_company, nullptr, view);
/* Make sure the HQ starts at the right size. */
if (type == OBJECT_HQ) UpdateCompanyHQ(tile, hq_score);
if (type == OBJECT_OWNED_LAND && c != NULL) c->purchase_land_limit -= 1 << 16;
if (type == OBJECT_OWNED_LAND && c != nullptr) c->purchase_land_limit -= 1 << 16;
}
cost.AddCost(ObjectSpec::Get(type)->GetBuildCost() * size_x * size_y);
@@ -384,7 +384,7 @@ CommandCost CmdPurchaseLandArea(TileIndex tile, DoCommandFlag flags, uint32 p1,
bool had_success = false;
const Company *c = Company::GetIfValid(_current_company);
int limit = (c == NULL ? INT32_MAX : GB(c->purchase_land_limit, 16, 16));
int limit = (c == nullptr ? INT32_MAX : GB(c->purchase_land_limit, 16, 16));
TileIterator *iter = HasBit(p2, 0) ? (TileIterator *)new DiagonalTileIterator(tile, p1) : new OrthogonalTileIterator(tile, p1);
for (; *iter != INVALID_TILE; ++(*iter)) {
@@ -394,7 +394,7 @@ CommandCost CmdPurchaseLandArea(TileIndex tile, DoCommandFlag flags, uint32 p1,
last_error = ret;
/* We may not clear more tiles. */
if (c != NULL && GB(c->purchase_land_limit, 16, 16) < 1) break;
if (c != nullptr && GB(c->purchase_land_limit, 16, 16) < 1) break;
continue;
}
@@ -432,7 +432,7 @@ static void DrawTile_Object(TileInfo *ti)
if ((spec->flags & OBJECT_FLAG_HAS_NO_FOUNDATION) == 0) DrawFoundation(ti, GetFoundation_Object(ti->tile, ti->tileh));
if (type < NEW_OBJECT_OFFSET) {
const DrawTileSprites *dts = NULL;
const DrawTileSprites *dts = nullptr;
Owner to = GetTileOwner(ti->tile);
PaletteID palette = to == OWNER_NONE ? PAL_NONE : COMPANY_SPRITE_COLOUR(to);
@@ -513,7 +513,7 @@ std::vector<ClearedObjectArea> _cleared_object_areas;
/**
* Find the entry in _cleared_object_areas which occupies a certain tile.
* @param tile Tile of interest
* @return Occupying entry, or NULL if none
* @return Occupying entry, or nullptr if none
*/
ClearedObjectArea *FindClearedObject(TileIndex tile)
{
@@ -523,7 +523,7 @@ ClearedObjectArea *FindClearedObject(TileIndex tile)
if (coa.area.Intersects(ta)) return &coa;
}
return NULL;
return nullptr;
}
static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlag flags)
@@ -633,7 +633,7 @@ static void GetTileDesc_Object(TileIndex tile, TileDesc *td)
td->owner[0] = GetTileOwner(tile);
td->build_date = Object::GetByTile(tile)->build_date;
if (spec->grf_prop.grffile != NULL) {
if (spec->grf_prop.grffile != nullptr) {
td->grf = GetGRFConfig(spec->grf_prop.grffile->grfid)->GetName();
}
}
@@ -760,7 +760,7 @@ static bool TryBuildTransmitter()
int h;
if (IsTileType(tile, MP_CLEAR) && IsTileFlat(tile, &h) && h >= 4 && !IsBridgeAbove(tile)) {
TileIndex t = tile;
if (CircularTileSearch(&t, 9, HasTransmitter, NULL)) return false;
if (CircularTileSearch(&t, 9, HasTransmitter, nullptr)) return false;
BuildObject(OBJECT_TRANSMITTER, tile);
return true;
@@ -820,7 +820,7 @@ void GenerateObjects()
default:
uint8 view = RandomRange(spec->views);
if (CmdBuildObject(RandomTile(), DC_EXEC | DC_AUTO | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, i, view, NULL).Succeeded()) amount--;
if (CmdBuildObject(RandomTile(), DC_EXEC | DC_AUTO | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, i, view, nullptr).Succeeded()) amount--;
break;
}
}
@@ -906,8 +906,8 @@ extern const TileTypeProcs _tile_type_object_procs = {
AnimateTile_Object, // animate_tile_proc
TileLoop_Object, // tile_loop_proc
ChangeTileOwner_Object, // change_tile_owner_proc
NULL, // add_produced_cargo_proc
NULL, // vehicle_enter_tile_proc
nullptr, // add_produced_cargo_proc
nullptr, // vehicle_enter_tile_proc
GetFoundation_Object, // get_foundation_proc
TerraformTile_Object, // terraform_tile_proc
};