forked from mirror/OpenTTD
Codechange: Use null pointer literal instead of the NULL macro
This commit is contained in:
committed by
Michael Lutz
parent
3b4f224c0b
commit
7c8e7c6b6e
@@ -79,7 +79,7 @@ uint32 GetIndustryIDAtOffset(TileIndex tile, const Industry *i, uint32 cur_grfid
|
||||
}
|
||||
}
|
||||
/* Not an 'old type' tile */
|
||||
if (indtsp->grf_prop.spritegroup[0] != NULL) { // tile has a spritegroup ?
|
||||
if (indtsp->grf_prop.spritegroup[0] != nullptr) { // tile has a spritegroup ?
|
||||
if (indtsp->grf_prop.grffile->grfid == cur_grfid) { // same industry, same grf ?
|
||||
return indtsp->grf_prop.local_id;
|
||||
} else {
|
||||
@@ -202,7 +202,7 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout
|
||||
|
||||
const IndustrySpec *indspec = GetIndustrySpec(this->type);
|
||||
|
||||
if (this->industry == NULL) {
|
||||
if (this->industry == nullptr) {
|
||||
DEBUG(grf, 1, "Unhandled variable 0x%X (no available industry) in callback 0x%x", variable, this->ro.callback);
|
||||
|
||||
*available = false;
|
||||
@@ -240,7 +240,7 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout
|
||||
bool is_ai = false;
|
||||
|
||||
const Company *c = Company::GetIfValid(this->industry->founder);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
const Livery *l = &c->livery[LS_DEFAULT];
|
||||
|
||||
is_ai = c->is_ai;
|
||||
@@ -338,7 +338,7 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout
|
||||
}
|
||||
|
||||
/* Get a variable from the persistent storage */
|
||||
case 0x7C: return (this->industry->psa != NULL) ? this->industry->psa->GetValue(parameter) : 0;
|
||||
case 0x7C: return (this->industry->psa != nullptr) ? this->industry->psa->GetValue(parameter) : 0;
|
||||
|
||||
/* Industry structure access*/
|
||||
case 0x80: return this->industry->location.tile;
|
||||
@@ -411,7 +411,7 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout
|
||||
|
||||
/* virtual */ uint32 IndustriesScopeResolver::GetRandomBits() const
|
||||
{
|
||||
return this->industry != NULL ? this->industry->random : 0;
|
||||
return this->industry != nullptr ? this->industry->random : 0;
|
||||
}
|
||||
|
||||
/* virtual */ uint32 IndustriesScopeResolver::GetTriggers() const
|
||||
@@ -423,13 +423,13 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout
|
||||
{
|
||||
if (this->industry->index == INVALID_INDUSTRY) return;
|
||||
|
||||
if (this->industry->psa == NULL) {
|
||||
if (this->industry->psa == nullptr) {
|
||||
/* There is no need to create a storage if the value is zero. */
|
||||
if (value == 0) return;
|
||||
|
||||
/* Create storage on first modification. */
|
||||
const IndustrySpec *indsp = GetIndustrySpec(this->industry->type);
|
||||
uint32 grfid = (indsp->grf_prop.grffile != NULL) ? indsp->grf_prop.grffile->grfid : 0;
|
||||
uint32 grfid = (indsp->grf_prop.grffile != nullptr) ? indsp->grf_prop.grffile->grfid : 0;
|
||||
assert(PersistentStorage::CanAllocateItem());
|
||||
this->industry->psa = new PersistentStorage(grfid, GSF_INDUSTRIES, this->industry->location.tile);
|
||||
}
|
||||
@@ -445,7 +445,7 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout
|
||||
static const GRFFile *GetGrffile(IndustryType type)
|
||||
{
|
||||
const IndustrySpec *indspec = GetIndustrySpec(type);
|
||||
return (indspec != NULL) ? indspec->grf_prop.grffile : NULL;
|
||||
return (indspec != nullptr) ? indspec->grf_prop.grffile : nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -462,7 +462,7 @@ IndustriesResolverObject::IndustriesResolverObject(TileIndex tile, Industry *ind
|
||||
CallbackID callback, uint32 callback_param1, uint32 callback_param2)
|
||||
: ResolverObject(GetGrffile(type), callback, callback_param1, callback_param2),
|
||||
industries_scope(*this, tile, indus, type, random_bits),
|
||||
town_scope(NULL)
|
||||
town_scope(nullptr)
|
||||
{
|
||||
this->root_spritegroup = GetIndustrySpec(type)->grf_prop.spritegroup[0];
|
||||
}
|
||||
@@ -478,16 +478,16 @@ IndustriesResolverObject::~IndustriesResolverObject()
|
||||
*/
|
||||
TownScopeResolver *IndustriesResolverObject::GetTown()
|
||||
{
|
||||
if (this->town_scope == NULL) {
|
||||
Town *t = NULL;
|
||||
if (this->town_scope == nullptr) {
|
||||
Town *t = nullptr;
|
||||
bool readonly = true;
|
||||
if (this->industries_scope.industry != NULL) {
|
||||
if (this->industries_scope.industry != nullptr) {
|
||||
t = this->industries_scope.industry->town;
|
||||
readonly = this->industries_scope.industry->index == INVALID_INDUSTRY;
|
||||
} else if (this->industries_scope.tile != INVALID_TILE) {
|
||||
t = ClosestTownFromTile(this->industries_scope.tile, UINT_MAX);
|
||||
}
|
||||
if (t == NULL) return NULL;
|
||||
if (t == nullptr) return nullptr;
|
||||
this->town_scope = new TownScopeResolver(*this, t, readonly);
|
||||
}
|
||||
return this->town_scope;
|
||||
@@ -533,7 +533,7 @@ CommandCost CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, uin
|
||||
ind.town = ClosestTownFromTile(tile, UINT_MAX);
|
||||
ind.random = initial_random_bits;
|
||||
ind.founder = founder;
|
||||
ind.psa = NULL;
|
||||
ind.psa = nullptr;
|
||||
|
||||
IndustriesResolverObject object(tile, &ind, type, seed, CBID_INDUSTRY_LOCATION, 0, creation_type);
|
||||
uint16 result = object.ResolveCallback();
|
||||
@@ -556,7 +556,7 @@ uint32 GetIndustryProbabilityCallback(IndustryType type, IndustryAvailabilityCal
|
||||
const IndustrySpec *indspec = GetIndustrySpec(type);
|
||||
|
||||
if (HasBit(indspec->callback_mask, CBM_IND_PROBABILITY)) {
|
||||
uint16 res = GetIndustryCallback(CBID_INDUSTRY_PROBABILITY, 0, creation_type, NULL, type, INVALID_TILE);
|
||||
uint16 res = GetIndustryCallback(CBID_INDUSTRY_PROBABILITY, 0, creation_type, nullptr, type, INVALID_TILE);
|
||||
if (res != CALLBACK_FAILED) {
|
||||
if (indspec->grf_prop.grffile->grf_version < 8) {
|
||||
/* Disallow if result != 0 */
|
||||
@@ -608,7 +608,7 @@ void IndustryProductionCallback(Industry *ind, int reason)
|
||||
|
||||
SB(object.callback_param2, 8, 16, loop);
|
||||
const SpriteGroup *tgroup = object.Resolve();
|
||||
if (tgroup == NULL || tgroup->type != SGT_INDUSTRY_PRODUCTION) break;
|
||||
if (tgroup == nullptr || tgroup->type != SGT_INDUSTRY_PRODUCTION) break;
|
||||
const IndustryProductionSpriteGroup *group = (const IndustryProductionSpriteGroup *)tgroup;
|
||||
|
||||
if (group->version == 0xFF) {
|
||||
|
Reference in New Issue
Block a user