diff options
| author | Elliptic Ellipsis <elliptic.ellipsis@gmail.com> | 2022-03-25 05:34:53 +0000 |
|---|---|---|
| committer | Elliptic Ellipsis <elliptic.ellipsis@gmail.com> | 2022-03-25 05:35:12 +0000 |
| commit | 2d37348cb6994f6fe20a0ffbc2ee2d87bd7447a2 (patch) | |
| tree | c43ce69da5d2e1fe8744d0a54a3a9650de6f20d1 /src/object | |
| parent | 481079092ce272558c887c9563948af0f0fa9d58 (diff) | |
Fix a lot of pointer comparisons to 0 (or nothing) to explicitly use NULL
Diffstat (limited to 'src/object')
| -rw-r--r-- | src/object/bakerOven.c | 2 | ||||
| -rw-r--r-- | src/object/bigBarrel.c | 6 | ||||
| -rw-r--r-- | src/object/button.c | 2 | ||||
| -rw-r--r-- | src/object/fileScreenObjects.c | 4 | ||||
| -rw-r--r-- | src/object/houseDoorExterior.c | 4 | ||||
| -rw-r--r-- | src/object/object49.c | 8 | ||||
| -rw-r--r-- | src/object/pot.c | 2 |
7 files changed, 14 insertions, 14 deletions
diff --git a/src/object/bakerOven.c b/src/object/bakerOven.c index fd2b80aa..d4b26c28 100644 --- a/src/object/bakerOven.c +++ b/src/object/bakerOven.c @@ -22,7 +22,7 @@ void sub_0809CC74(Entity* this) { /* Create steam clouds */ for (i = 0; i < 3; i++) { ent = CreateObject(BAKER_OVEN, 1, i); - if (ent) { + if (ent != NULL) { ent->parent = this; PositionRelative(this, ent, 16 * Q_16_16((i + 1) / 2) - Q_16_16(8.0), Q_16_16(-14.0)); } diff --git a/src/object/bigBarrel.c b/src/object/bigBarrel.c index af09b0f4..77e6ff6a 100644 --- a/src/object/bigBarrel.c +++ b/src/object/bigBarrel.c @@ -105,7 +105,7 @@ void sub_08088BE0(BigBarrelEntity* this) { if (CheckLocalFlag(0x15) == 0) { sub_08088C78(this, 2, 0, 0xffffff88); ent = sub_08088C78(this, 4, 0x15, 0); - if (ent) { + if (ent != NULL) { ent->x.HALF.HI = gRoomControls.origin_x + 0x48; ent->y.HALF.HI = gRoomControls.origin_y + 200; } @@ -114,7 +114,7 @@ void sub_08088BE0(BigBarrelEntity* this) { if (CheckLocalFlag(0x16) == 0) { sub_08088C78(this, 2, 1, 0x78); ent = sub_08088C78(this, 4, 0x16, 0); - if (ent) { + if (ent != NULL) { ent->x.HALF.HI = gRoomControls.origin_x + 0x188; ent->y.HALF.HI = gRoomControls.origin_y + 200; } @@ -249,7 +249,7 @@ void sub_08088E74(BigBarrelEntity* this) { } else { if ((gRoomTransition.frameCount & 7U) == 0) { ent = CreateObjectWithParent(super, OBJECT_2A, 0, 0x1e); - if (ent) { + if (ent != NULL) { ent->updatePriority = 3; ent->spriteRendering.b3 = 0; ent->spritePriority.b0 = 0; diff --git a/src/object/button.c b/src/object/button.c index 5a29e636..d4f602ba 100644 --- a/src/object/button.c +++ b/src/object/button.c @@ -242,7 +242,7 @@ u32 sub_08081F7C(Entity* this, u32 r7) { if (this->actionDelay == 0) return 1; if (--this->actionDelay > 6) { - if (this->child) + if (this->child != NULL) this->child->spriteOffsetY = -4; } else { if (this->actionDelay == 6) { diff --git a/src/object/fileScreenObjects.c b/src/object/fileScreenObjects.c index 7d2a295f..c7cac4e7 100644 --- a/src/object/fileScreenObjects.c +++ b/src/object/fileScreenObjects.c @@ -252,7 +252,7 @@ void sub_0808EABC(Entity* this) { void sub_0808EB74(Entity* this) { Entity* entity = sub_0808EC80(gMapDataBottomSpecial.unk6); - if (entity) { + if (entity != NULL) { this->x.WORD = entity->x.WORD; this->y.WORD = entity->y.WORD; this->spriteRendering.b3 = entity->spriteRendering.b3; @@ -305,7 +305,7 @@ void sub_0808EBB8(Entity* this) { // Fall through default: entity = sub_0808EC80(var0); - if (entity) { + if (entity != NULL) { SortEntityBelow(entity, this); this->spriteRendering.b3 = entity->spriteRendering.b3; x = entity->x.HALF.HI; diff --git a/src/object/houseDoorExterior.c b/src/object/houseDoorExterior.c index 1627c7e8..baadd362 100644 --- a/src/object/houseDoorExterior.c +++ b/src/object/houseDoorExterior.c @@ -53,7 +53,7 @@ void sub_080866D8(Entity* this) { if ((*((u32*)(&this->field_0x68)) & mask) == 0 && sub_080867CC(prop->unk5) && CheckRegionOnScreen(prop->unk0, prop->unk2, 32, 32)) { entity = CreateObject(HOUSE_DOOR_EXT, prop->unk7, prop->unk6); - if (entity) { + if (entity != NULL) { entity->field_0x6c.HALF.LO = i; entity->x.HALF.HI = gRoomControls.origin_x + prop->unk0 + 16; entity->y.HALF.HI = gRoomControls.origin_y + prop->unk2 + 32; @@ -157,7 +157,7 @@ static void sub_080868EC(Entity* entity, unk_80868EC* arg1) { void sub_0808692C(Entity* this) { this->flags &= ~ENT_SCRIPTED; this->type2 = 2; - this->action = this->frameIndex == 0 ? 1 : 2; + this->action = (this->frameIndex == 0) ? 1 : 2; this->subAction = 0; this->actionDelay = 8; } diff --git a/src/object/object49.c b/src/object/object49.c index 1b74b298..4eca5e6e 100644 --- a/src/object/object49.c +++ b/src/object/object49.c @@ -195,7 +195,7 @@ void sub_0808F3DC(Entity* this) { if (this->type == 5 && (this->frame & 1)) { Entity* entity = CreateObjectWithParent(this->child, 0x49, 8, 0); - if (entity) { + if (entity != NULL) { entity->parent = this->parent; entity->child = this->parent->parent; } @@ -262,19 +262,19 @@ void sub_0808F554(Entity* this) { void sub_0808F5EC(Entity* this) { Entity* entity = CreateObjectWithParent(this->child, 0x49, 5, 0); - if (entity) { + if (entity != NULL) { entity->parent = this; entity->child = this->child; } entity = CreateObjectWithParent(this->child, 0x49, 6, 0); - if (entity) { + if (entity != NULL) { entity->parent = this; entity->child = this->child; } entity = CreateObjectWithParent(this->child, 0x49, 7, 0); - if (entity) { + if (entity != NULL) { entity->parent = this; entity->child = this->child; } diff --git a/src/object/pot.c b/src/object/pot.c index 22ee8ce0..a11c6d4d 100644 --- a/src/object/pot.c +++ b/src/object/pot.c @@ -283,7 +283,7 @@ u32 sub_0808288C(Entity* this, u32 form, u32 arg2, u32 arg3) { break; default: entity = CreateObjectWithParent(this, GROUND_ITEM, form, arg2); - if (entity) { + if (entity != NULL) { if (arg3 == 2) { entity->actionDelay = 5; entity->field_0x86.HWORD = this->field_0x86.HWORD; |
