Codechange: Use null pointer literal instead of the NULL macro
This commit is contained in:

committed by
Michael Lutz

parent
3b4f224c0b
commit
7c8e7c6b6e
@@ -14,15 +14,15 @@
|
||||
|
||||
/* Helper for filling property tables */
|
||||
#define NIP(prop, base, variable, type, name) { name, (ptrdiff_t)cpp_offsetof(base, variable), cpp_sizeof(base, variable), prop, type }
|
||||
#define NIP_END() { NULL, 0, 0, 0, 0 }
|
||||
#define NIP_END() { nullptr, 0, 0, 0, 0 }
|
||||
|
||||
/* Helper for filling callback tables */
|
||||
#define NIC(cb_id, base, variable, bit) { #cb_id, (ptrdiff_t)cpp_offsetof(base, variable), cpp_sizeof(base, variable), bit, cb_id }
|
||||
#define NIC_END() { NULL, 0, 0, 0, 0 }
|
||||
#define NIC_END() { nullptr, 0, 0, 0, 0 }
|
||||
|
||||
/* Helper for filling variable tables */
|
||||
#define NIV(var, name) { name, var }
|
||||
#define NIV_END() { NULL, 0 }
|
||||
#define NIV_END() { nullptr, 0 }
|
||||
|
||||
|
||||
/*** NewGRF Vehicles ***/
|
||||
@@ -69,7 +69,7 @@ static const NIVariable _niv_vehicles[] = {
|
||||
};
|
||||
|
||||
class NIHVehicle : public NIHelper {
|
||||
bool IsInspectable(uint index) const override { return Vehicle::Get(index)->GetGRF() != NULL; }
|
||||
bool IsInspectable(uint index) const override { return Vehicle::Get(index)->GetGRF() != nullptr; }
|
||||
uint GetParent(uint index) const override { const Vehicle *first = Vehicle::Get(index)->First(); return GetInspectWindowNumber(GetGrfSpecFeature(first->type), first->index); }
|
||||
const void *GetInstance(uint index)const override { return Vehicle::Get(index); }
|
||||
const void *GetSpec(uint index) const override { return Vehicle::Get(index)->GetEngine(); }
|
||||
@@ -85,7 +85,7 @@ class NIHVehicle : public NIHelper {
|
||||
};
|
||||
|
||||
static const NIFeature _nif_vehicle = {
|
||||
NULL,
|
||||
nullptr,
|
||||
_nic_vehicles,
|
||||
_niv_vehicles,
|
||||
new NIHVehicle(),
|
||||
@@ -132,9 +132,9 @@ static const NIVariable _niv_stations[] = {
|
||||
};
|
||||
|
||||
class NIHStation : public NIHelper {
|
||||
bool IsInspectable(uint index) const override { return GetStationSpec(index) != NULL; }
|
||||
bool IsInspectable(uint index) const override { return GetStationSpec(index) != nullptr; }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Station::GetByTile(index)->town->index); }
|
||||
const void *GetInstance(uint index)const override { return NULL; }
|
||||
const void *GetInstance(uint index)const override { return nullptr; }
|
||||
const void *GetSpec(uint index) const override { return GetStationSpec(index); }
|
||||
void SetStringParameters(uint index) const override { this->SetObjectAtStringParameters(STR_STATION_NAME, GetStationIndex(index), index); }
|
||||
uint32 GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? GetStationSpec(index)->grf_prop.grffile->grfid : 0; }
|
||||
@@ -147,7 +147,7 @@ class NIHStation : public NIHelper {
|
||||
};
|
||||
|
||||
static const NIFeature _nif_station = {
|
||||
NULL,
|
||||
nullptr,
|
||||
_nic_stations,
|
||||
_niv_stations,
|
||||
new NIHStation(),
|
||||
@@ -197,9 +197,9 @@ static const NIVariable _niv_house[] = {
|
||||
};
|
||||
|
||||
class NIHHouse : public NIHelper {
|
||||
bool IsInspectable(uint index) const override { return HouseSpec::Get(GetHouseType(index))->grf_prop.grffile != NULL; }
|
||||
bool IsInspectable(uint index) const override { return HouseSpec::Get(GetHouseType(index))->grf_prop.grffile != nullptr; }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, GetTownIndex(index)); }
|
||||
const void *GetInstance(uint index)const override { return NULL; }
|
||||
const void *GetInstance(uint index)const override { return nullptr; }
|
||||
const void *GetSpec(uint index) const override { return HouseSpec::Get(GetHouseType(index)); }
|
||||
void SetStringParameters(uint index) const override { this->SetObjectAtStringParameters(STR_TOWN_NAME, GetTownIndex(index), index); }
|
||||
uint32 GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? HouseSpec::Get(GetHouseType(index))->grf_prop.grffile->grfid : 0; }
|
||||
@@ -212,7 +212,7 @@ class NIHHouse : public NIHelper {
|
||||
};
|
||||
|
||||
static const NIFeature _nif_house = {
|
||||
NULL,
|
||||
nullptr,
|
||||
_nic_house,
|
||||
_niv_house,
|
||||
new NIHHouse(),
|
||||
@@ -247,9 +247,9 @@ static const NIVariable _niv_industrytiles[] = {
|
||||
};
|
||||
|
||||
class NIHIndustryTile : public NIHelper {
|
||||
bool IsInspectable(uint index) const override { return GetIndustryTileSpec(GetIndustryGfx(index))->grf_prop.grffile != NULL; }
|
||||
bool IsInspectable(uint index) const override { return GetIndustryTileSpec(GetIndustryGfx(index))->grf_prop.grffile != nullptr; }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_INDUSTRIES, GetIndustryIndex(index)); }
|
||||
const void *GetInstance(uint index)const override { return NULL; }
|
||||
const void *GetInstance(uint index)const override { return nullptr; }
|
||||
const void *GetSpec(uint index) const override { return GetIndustryTileSpec(GetIndustryGfx(index)); }
|
||||
void SetStringParameters(uint index) const override { this->SetObjectAtStringParameters(STR_INDUSTRY_NAME, GetIndustryIndex(index), index); }
|
||||
uint32 GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? GetIndustryTileSpec(GetIndustryGfx(index))->grf_prop.grffile->grfid : 0; }
|
||||
@@ -262,7 +262,7 @@ class NIHIndustryTile : public NIHelper {
|
||||
};
|
||||
|
||||
static const NIFeature _nif_industrytile = {
|
||||
NULL,
|
||||
nullptr,
|
||||
_nic_industrytiles,
|
||||
_niv_industrytiles,
|
||||
new NIHIndustryTile(),
|
||||
@@ -346,7 +346,7 @@ static const NIVariable _niv_industries[] = {
|
||||
};
|
||||
|
||||
class NIHIndustry : public NIHelper {
|
||||
bool IsInspectable(uint index) const override { return GetIndustrySpec(Industry::Get(index)->type)->grf_prop.grffile != NULL; }
|
||||
bool IsInspectable(uint index) const override { return GetIndustrySpec(Industry::Get(index)->type)->grf_prop.grffile != nullptr; }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Industry::Get(index)->town->index); }
|
||||
const void *GetInstance(uint index)const override { return Industry::Get(index); }
|
||||
const void *GetSpec(uint index) const override { return GetIndustrySpec(Industry::Get(index)->type); }
|
||||
@@ -365,7 +365,7 @@ class NIHIndustry : public NIHelper {
|
||||
const int32 *GetPSAFirstPosition(uint index, uint32 grfid) const override
|
||||
{
|
||||
const Industry *i = (const Industry *)this->GetInstance(index);
|
||||
if (i->psa == NULL) return NULL;
|
||||
if (i->psa == nullptr) return nullptr;
|
||||
return (int32 *)(&i->psa->storage);
|
||||
}
|
||||
};
|
||||
@@ -411,7 +411,7 @@ static const NIVariable _niv_objects[] = {
|
||||
};
|
||||
|
||||
class NIHObject : public NIHelper {
|
||||
bool IsInspectable(uint index) const override { return ObjectSpec::GetByTile(index)->grf_prop.grffile != NULL; }
|
||||
bool IsInspectable(uint index) const override { return ObjectSpec::GetByTile(index)->grf_prop.grffile != nullptr; }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Object::GetByTile(index)->town->index); }
|
||||
const void *GetInstance(uint index)const override { return Object::GetByTile(index); }
|
||||
const void *GetSpec(uint index) const override { return ObjectSpec::GetByTile(index); }
|
||||
@@ -426,7 +426,7 @@ class NIHObject : public NIHelper {
|
||||
};
|
||||
|
||||
static const NIFeature _nif_object = {
|
||||
NULL,
|
||||
nullptr,
|
||||
_nic_objects,
|
||||
_niv_objects,
|
||||
new NIHObject(),
|
||||
@@ -447,8 +447,8 @@ static const NIVariable _niv_railtypes[] = {
|
||||
class NIHRailType : public NIHelper {
|
||||
bool IsInspectable(uint index) const override { return true; }
|
||||
uint GetParent(uint index) const override { return UINT32_MAX; }
|
||||
const void *GetInstance(uint index)const override { return NULL; }
|
||||
const void *GetSpec(uint index) const override { return NULL; }
|
||||
const void *GetInstance(uint index)const override { return nullptr; }
|
||||
const void *GetSpec(uint index) const override { return nullptr; }
|
||||
void SetStringParameters(uint index) const override { this->SetObjectAtStringParameters(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE, INVALID_STRING_ID, index); }
|
||||
uint32 GetGRFID(uint index) const override { return 0; }
|
||||
|
||||
@@ -456,14 +456,14 @@ class NIHRailType : public NIHelper {
|
||||
{
|
||||
/* There is no unique GRFFile for the tile. Multiple GRFs can define different parts of the railtype.
|
||||
* However, currently the NewGRF Debug GUI does not display variables depending on the GRF (like 0x7F) anyway. */
|
||||
RailTypeResolverObject ro(NULL, index, TCX_NORMAL, RTSG_END);
|
||||
RailTypeResolverObject ro(nullptr, index, TCX_NORMAL, RTSG_END);
|
||||
return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
|
||||
}
|
||||
};
|
||||
|
||||
static const NIFeature _nif_railtype = {
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
_niv_railtypes,
|
||||
new NIHRailType(),
|
||||
};
|
||||
@@ -481,9 +481,9 @@ static const NICallback _nic_airporttiles[] = {
|
||||
};
|
||||
|
||||
class NIHAirportTile : public NIHelper {
|
||||
bool IsInspectable(uint index) const override { return AirportTileSpec::Get(GetAirportGfx(index))->grf_prop.grffile != NULL; }
|
||||
bool IsInspectable(uint index) const override { return AirportTileSpec::Get(GetAirportGfx(index))->grf_prop.grffile != nullptr; }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Station::GetByTile(index)->town->index); }
|
||||
const void *GetInstance(uint index)const override { return NULL; }
|
||||
const void *GetInstance(uint index)const override { return nullptr; }
|
||||
const void *GetSpec(uint index) const override { return AirportTileSpec::Get(GetAirportGfx(index)); }
|
||||
void SetStringParameters(uint index) const override { this->SetObjectAtStringParameters(STR_STATION_NAME, GetStationIndex(index), index); }
|
||||
uint32 GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? AirportTileSpec::Get(GetAirportGfx(index))->grf_prop.grffile->grfid : 0; }
|
||||
@@ -496,7 +496,7 @@ class NIHAirportTile : public NIHelper {
|
||||
};
|
||||
|
||||
static const NIFeature _nif_airporttile = {
|
||||
NULL,
|
||||
nullptr,
|
||||
_nic_airporttiles,
|
||||
_niv_industrytiles, // Yes, they share this (at least now)
|
||||
new NIHAirportTile(),
|
||||
@@ -522,7 +522,7 @@ class NIHTown : public NIHelper {
|
||||
bool IsInspectable(uint index) const override { return Town::IsValidID(index); }
|
||||
uint GetParent(uint index) const override { return UINT32_MAX; }
|
||||
const void *GetInstance(uint index)const override { return Town::Get(index); }
|
||||
const void *GetSpec(uint index) const override { return NULL; }
|
||||
const void *GetSpec(uint index) const override { return nullptr; }
|
||||
void SetStringParameters(uint index) const override { this->SetSimpleStringParameters(STR_TOWN_NAME, index); }
|
||||
uint32 GetGRFID(uint index) const override { return 0; }
|
||||
bool PSAWithParameter() const override { return true; }
|
||||
@@ -530,7 +530,7 @@ class NIHTown : public NIHelper {
|
||||
|
||||
uint Resolve(uint index, uint var, uint param, bool *avail) const override
|
||||
{
|
||||
TownResolverObject ro(NULL, Town::Get(index), true);
|
||||
TownResolverObject ro(nullptr, Town::Get(index), true);
|
||||
return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
|
||||
}
|
||||
|
||||
@@ -543,13 +543,13 @@ class NIHTown : public NIHelper {
|
||||
if ((*iter)->grfid == grfid) return (int32 *)(&(*iter)->storage[0]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
static const NIFeature _nif_town = {
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
_niv_towns,
|
||||
new NIHTown(),
|
||||
};
|
||||
@@ -561,16 +561,16 @@ static const NIFeature * const _nifeatures[] = {
|
||||
&_nif_vehicle, // GSF_SHIPS
|
||||
&_nif_vehicle, // GSF_AIRCRAFT
|
||||
&_nif_station, // GSF_STATIONS
|
||||
NULL, // GSF_CANALS (no callbacks/action2 implemented)
|
||||
NULL, // GSF_BRIDGES (no callbacks/action2)
|
||||
nullptr, // GSF_CANALS (no callbacks/action2 implemented)
|
||||
nullptr, // GSF_BRIDGES (no callbacks/action2)
|
||||
&_nif_house, // GSF_HOUSES
|
||||
NULL, // GSF_GLOBALVAR (has no "physical" objects)
|
||||
nullptr, // GSF_GLOBALVAR (has no "physical" objects)
|
||||
&_nif_industrytile, // GSF_INDUSTRYTILES
|
||||
&_nif_industry, // GSF_INDUSTRIES
|
||||
NULL, // GSF_CARGOES (has no "physical" objects)
|
||||
NULL, // GSF_SOUNDFX (has no "physical" objects)
|
||||
NULL, // GSF_AIRPORTS (feature not implemented)
|
||||
NULL, // GSF_SIGNALS (feature not implemented)
|
||||
nullptr, // GSF_CARGOES (has no "physical" objects)
|
||||
nullptr, // GSF_SOUNDFX (has no "physical" objects)
|
||||
nullptr, // GSF_AIRPORTS (feature not implemented)
|
||||
nullptr, // GSF_SIGNALS (feature not implemented)
|
||||
&_nif_object, // GSF_OBJECTS
|
||||
&_nif_railtype, // GSF_RAILTYPES
|
||||
&_nif_airporttile, // GSF_AIRPORTTILES
|
||||
|
Reference in New Issue
Block a user