Codechange: Use null pointer literal instead of the NULL macro
This commit is contained in:
committed by
Michael Lutz
parent
3b4f224c0b
commit
7c8e7c6b6e
@@ -21,7 +21,7 @@
|
||||
|
||||
/** Resolver for the airport scope. */
|
||||
struct AirportScopeResolver : public ScopeResolver {
|
||||
struct Station *st; ///< Station of the airport for which the callback is run, or \c NULL for build gui.
|
||||
struct Station *st; ///< Station of the airport for which the callback is run, or \c nullptr for build gui.
|
||||
byte airport_id; ///< Type of airport for which the callback is run.
|
||||
byte layout; ///< Layout of the airport to build.
|
||||
TileIndex tile; ///< Tile for the callback, only valid for airporttile callbacks.
|
||||
@@ -30,7 +30,7 @@ struct AirportScopeResolver : public ScopeResolver {
|
||||
* Constructor of the scope resolver for an airport.
|
||||
* @param ro Surrounding resolver.
|
||||
* @param tile %Tile for the callback, only valid for airporttile callbacks.
|
||||
* @param st %Station of the airport for which the callback is run, or \c NULL for build gui.
|
||||
* @param st %Station of the airport for which the callback is run, or \c nullptr for build gui.
|
||||
* @param airport_id Type of airport for which the callback is run.
|
||||
* @param layout Layout of the airport to build.
|
||||
*/
|
||||
@@ -202,14 +202,14 @@ void AirportOverrideManager::SetEntitySpec(AirportSpec *as)
|
||||
case 0x40: return this->layout;
|
||||
}
|
||||
|
||||
if (this->st == NULL) {
|
||||
if (this->st == nullptr) {
|
||||
*available = false;
|
||||
return UINT_MAX;
|
||||
}
|
||||
|
||||
switch (variable) {
|
||||
/* Get a variable from the persistent storage */
|
||||
case 0x7C: return (this->st->airport.psa != NULL) ? this->st->airport.psa->GetValue(parameter) : 0;
|
||||
case 0x7C: return (this->st->airport.psa != nullptr) ? this->st->airport.psa->GetValue(parameter) : 0;
|
||||
|
||||
case 0xF0: return this->st->facilities;
|
||||
case 0xFA: return Clamp(this->st->build_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0, 65535);
|
||||
@@ -225,12 +225,12 @@ void AirportOverrideManager::SetEntitySpec(AirportSpec *as)
|
||||
if (group->num_loaded > 0) return group->loaded[0];
|
||||
if (group->num_loading > 0) return group->loading[0];
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* virtual */ uint32 AirportScopeResolver::GetRandomBits() const
|
||||
{
|
||||
return this->st == NULL ? 0 : this->st->random_bits;
|
||||
return this->st == nullptr ? 0 : this->st->random_bits;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,14 +240,14 @@ void AirportOverrideManager::SetEntitySpec(AirportSpec *as)
|
||||
*/
|
||||
/* virtual */ void AirportScopeResolver::StorePSA(uint pos, int32 value)
|
||||
{
|
||||
if (this->st == NULL) return;
|
||||
if (this->st == nullptr) return;
|
||||
|
||||
if (this->st->airport.psa == NULL) {
|
||||
if (this->st->airport.psa == nullptr) {
|
||||
/* There is no need to create a storage if the value is zero. */
|
||||
if (value == 0) return;
|
||||
|
||||
/* Create storage on first modification. */
|
||||
uint32 grfid = (this->ro.grffile != NULL) ? this->ro.grffile->grfid : 0;
|
||||
uint32 grfid = (this->ro.grffile != nullptr) ? this->ro.grffile->grfid : 0;
|
||||
assert(PersistentStorage::CanAllocateItem());
|
||||
this->st->airport.psa = new PersistentStorage(grfid, GSF_AIRPORTS, this->st->airport.tile);
|
||||
}
|
||||
@@ -257,7 +257,7 @@ void AirportOverrideManager::SetEntitySpec(AirportSpec *as)
|
||||
/**
|
||||
* Constructor of the airport resolver.
|
||||
* @param tile %Tile for the callback, only valid for airporttile callbacks.
|
||||
* @param st %Station of the airport for which the callback is run, or \c NULL for build gui.
|
||||
* @param st %Station of the airport for which the callback is run, or \c nullptr for build gui.
|
||||
* @param airport_id Type of airport for which the callback is run.
|
||||
* @param layout Layout of the airport to build.
|
||||
* @param callback Callback ID.
|
||||
@@ -273,9 +273,9 @@ AirportResolverObject::AirportResolverObject(TileIndex tile, Station *st, byte a
|
||||
|
||||
SpriteID GetCustomAirportSprite(const AirportSpec *as, byte layout)
|
||||
{
|
||||
AirportResolverObject object(INVALID_TILE, NULL, as->GetIndex(), layout);
|
||||
AirportResolverObject object(INVALID_TILE, nullptr, as->GetIndex(), layout);
|
||||
const SpriteGroup *group = object.Resolve();
|
||||
if (group == NULL) return as->preview_sprite;
|
||||
if (group == nullptr) return as->preview_sprite;
|
||||
|
||||
return group->GetResult();
|
||||
}
|
||||
@@ -295,7 +295,7 @@ uint16 GetAirportCallback(CallbackID callback, uint32 param1, uint32 param2, Sta
|
||||
*/
|
||||
StringID GetAirportTextCallback(const AirportSpec *as, byte layout, uint16 callback)
|
||||
{
|
||||
AirportResolverObject object(INVALID_TILE, NULL, as->GetIndex(), layout, (CallbackID)callback);
|
||||
AirportResolverObject object(INVALID_TILE, nullptr, as->GetIndex(), layout, (CallbackID)callback);
|
||||
uint16 cb_res = object.ResolveCallback();
|
||||
if (cb_res == CALLBACK_FAILED || cb_res == 0x400) return STR_UNDEFINED;
|
||||
if (cb_res > 0x400) {
|
||||
|
||||
Reference in New Issue
Block a user