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
@@ -104,13 +104,13 @@ public:
|
||||
switch (widget) {
|
||||
case WID_BO_OBJECT_NAME: {
|
||||
const ObjectSpec *spec = ObjectClass::Get(_selected_object_class)->GetSpec(_selected_object_index);
|
||||
SetDParam(0, spec != NULL ? spec->name : STR_EMPTY);
|
||||
SetDParam(0, spec != nullptr ? spec->name : STR_EMPTY);
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_BO_OBJECT_SIZE: {
|
||||
const ObjectSpec *spec = ObjectClass::Get(_selected_object_class)->GetSpec(_selected_object_index);
|
||||
int size = spec == NULL ? 0 : spec->size;
|
||||
int size = spec == nullptr ? 0 : spec->size;
|
||||
SetDParam(0, GB(size, HasBit(_selected_object_view, 0) ? 4 : 0, 4));
|
||||
SetDParam(1, GB(size, HasBit(_selected_object_view, 0) ? 0 : 4, 4));
|
||||
break;
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
case WID_BO_OBJECT_MATRIX: {
|
||||
/* Get the right amount of buttons based on the current spec. */
|
||||
const ObjectSpec *spec = ObjectClass::Get(_selected_object_class)->GetSpec(_selected_object_index);
|
||||
if (spec != NULL) {
|
||||
if (spec != nullptr) {
|
||||
if (spec->views >= 2) size->width += resize->width;
|
||||
if (spec->views >= 4) size->height += resize->height;
|
||||
}
|
||||
@@ -185,7 +185,7 @@ public:
|
||||
|
||||
/* Get the right size for the single widget based on the current spec. */
|
||||
const ObjectSpec *spec = ObjectClass::Get(_selected_object_class)->GetSpec(_selected_object_index);
|
||||
if (spec != NULL) {
|
||||
if (spec != nullptr) {
|
||||
if (spec->views >= 2) size->width = size->width / 2 - 1;
|
||||
if (spec->views >= 4) size->height = size->height / 2 - 1;
|
||||
}
|
||||
@@ -229,7 +229,7 @@ public:
|
||||
|
||||
case WID_BO_OBJECT_SPRITE: {
|
||||
const ObjectSpec *spec = ObjectClass::Get(_selected_object_class)->GetSpec(_selected_object_index);
|
||||
if (spec == NULL) break;
|
||||
if (spec == nullptr) break;
|
||||
|
||||
/* Height of the selection matrix.
|
||||
* Depending on the number of views, the matrix has a 1x1, 1x2, 2x1 or 2x2 layout. To make the previews
|
||||
@@ -243,7 +243,7 @@ public:
|
||||
if (FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) {
|
||||
DrawPixelInfo *old_dpi = _cur_dpi;
|
||||
_cur_dpi = &tmp_dpi;
|
||||
if (spec->grf_prop.grffile == NULL) {
|
||||
if (spec->grf_prop.grffile == nullptr) {
|
||||
extern const DrawTileSprites _objects[];
|
||||
const DrawTileSprites *dts = &_objects[spec->grf_prop.local_id];
|
||||
DrawOrigTileSeqInGUI((r.right - r.left) / 2 - 1, (r.bottom - r.top + matrix_height / 2) / 2 - OBJECT_MARGIN - ScaleGUITrad(TILE_PIXELS), dts, PAL_NONE);
|
||||
@@ -260,7 +260,7 @@ public:
|
||||
int obj_index = objclass->GetIndexFromUI(GB(widget, 16, 16));
|
||||
if (obj_index < 0) break;
|
||||
const ObjectSpec *spec = objclass->GetSpec(obj_index);
|
||||
if (spec == NULL) break;
|
||||
if (spec == nullptr) break;
|
||||
|
||||
if (!spec->IsAvailable()) {
|
||||
GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, PC_BLACK, FILLRECT_CHECKER);
|
||||
@@ -270,7 +270,7 @@ public:
|
||||
if (FillDrawPixelInfo(&tmp_dpi, r.left + 1, r.top, (r.right - 1) - (r.left + 1) + 1, r.bottom - r.top + 1)) {
|
||||
DrawPixelInfo *old_dpi = _cur_dpi;
|
||||
_cur_dpi = &tmp_dpi;
|
||||
if (spec->grf_prop.grffile == NULL) {
|
||||
if (spec->grf_prop.grffile == nullptr) {
|
||||
extern const DrawTileSprites _objects[];
|
||||
const DrawTileSprites *dts = &_objects[spec->grf_prop.local_id];
|
||||
DrawOrigTileSeqInGUI((r.right - r.left) / 2 - 1, r.bottom - r.top - OBJECT_MARGIN - ScaleGUITrad(TILE_PIXELS), dts, PAL_NONE);
|
||||
@@ -285,11 +285,11 @@ public:
|
||||
|
||||
case WID_BO_INFO: {
|
||||
const ObjectSpec *spec = ObjectClass::Get(_selected_object_class)->GetSpec(_selected_object_index);
|
||||
if (spec == NULL) break;
|
||||
if (spec == nullptr) break;
|
||||
|
||||
/* Get the extra message for the GUI */
|
||||
if (HasBit(spec->callback_mask, CBM_OBJ_FUND_MORE_TEXT)) {
|
||||
uint16 callback_res = GetObjectCallback(CBID_OBJECT_FUND_MORE_TEXT, 0, 0, spec, NULL, INVALID_TILE, _selected_object_view);
|
||||
uint16 callback_res = GetObjectCallback(CBID_OBJECT_FUND_MORE_TEXT, 0, 0, spec, nullptr, INVALID_TILE, _selected_object_view);
|
||||
if (callback_res != CALLBACK_FAILED && callback_res != 0x400) {
|
||||
if (callback_res > 0x400) {
|
||||
ErrorUnknownCallbackResult(spec->grf_prop.grffile->grfid, CBID_OBJECT_FUND_MORE_TEXT, callback_res);
|
||||
|
Reference in New Issue
Block a user