diff options
author | Henry Wilson <m3henry@googlemail.com> | 2019-04-10 22:07:06 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2019-04-10 23:22:20 +0200 |
commit | 7c8e7c6b6e16d4a26259a676db32d8776b99817e (patch) | |
tree | 99f134b7e66367cf11e10bc5061896eab4a3264f /src/newgrf_airport.cpp | |
parent | 3b4f224c0bc50e7248050d4bcbb6d83fd510c1cc (diff) | |
download | openttd-7c8e7c6b6e16d4a26259a676db32d8776b99817e.tar.xz |
Codechange: Use null pointer literal instead of the NULL macro
Diffstat (limited to 'src/newgrf_airport.cpp')
-rw-r--r-- | src/newgrf_airport.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/newgrf_airport.cpp b/src/newgrf_airport.cpp index 615292aef..8ec390a4f 100644 --- a/src/newgrf_airport.cpp +++ b/src/newgrf_airport.cpp @@ -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) { |