diff --git a/src/game/activemenu.c b/src/game/activemenu.c index d99cf625b..37cfd4fa6 100644 --- a/src/game/activemenu.c +++ b/src/game/activemenu.c @@ -960,7 +960,7 @@ static Gfx *amRenderSlot(Gfx *gdl, char *text, s16 x, s16 y, s32 mode, s32 flags paddingbottom = 3; } - if (text == NULL || strcmp(text, "") == 0) { + if (text == NULL || text[0] == '\0') { return gdl; } diff --git a/src/game/activemenutick.c b/src/game/activemenutick.c index 9c105faf1..9cb57893c 100644 --- a/src/game/activemenutick.c +++ b/src/game/activemenutick.c @@ -314,7 +314,7 @@ void amTick(void) amGetSlotDetails(slotnum, &flags, text); - if (strcmp(text, "") == 0) { + if (text[0] == '\0') { gotoslot = false; } diff --git a/src/game/menu.c b/src/game/menu.c index dacc7dda4..b3e8f4e73 100644 --- a/src/game/menu.c +++ b/src/game/menu.c @@ -528,7 +528,7 @@ static void menuCalculateItemSize(struct menuitem *item, s16 *width, s16 *height case MENUITEMTYPE_DROPDOWN: text = menuResolveParam2Text(item); - if (text && strcmp(text, "") == 0) { + if (text && text[0] == '\0') { *width = 0; *height = 0; } else { @@ -582,7 +582,7 @@ static void menuCalculateItemSize(struct menuitem *item, s16 *width, s16 *height if (text == NULL) { *width = 120; - } else if (strcmp(text, "") == 0) { + } else if (text[0] == '\0') { *width = 0; *height = 0; } else { @@ -630,7 +630,7 @@ static void menuCalculateItemSize(struct menuitem *item, s16 *width, s16 *height font = g_FontHandelGothicMd; } - if (strcmp(text, "") == 0) { + if (text[0] == '\0') { *height = 0; *width = *height; } else { @@ -650,8 +650,7 @@ static void menuCalculateItemSize(struct menuitem *item, s16 *width, s16 *height if ((item->flags & (MENUITEMFLAG_LABEL_HASRIGHTTEXT | MENUITEMFLAG_BIGFONT)) == 0) { text = menuResolveText(item->param3, item); - // @bug: This is not how you check for an empty string - if (text != NULL && text != "") { + if (text != NULL) { textMeasure(&textheight, &textwidth, text, chars, font, 0); *width += textwidth + 5; diff --git a/src/game/menuitem.c b/src/game/menuitem.c index 2d77bcf18..3458a4b5d 100644 --- a/src/game/menuitem.c +++ b/src/game/menuitem.c @@ -1895,8 +1895,7 @@ static Gfx *menuitemLabelRender(Gfx *gdl, struct menurendercontext *context) // Right side text text = menuResolveText(context->item->param3, context->item); - // This is not how you check if a string is empty... - if (text != NULL && text != "") { + if (text != NULL) { s32 textheight; s32 textwidth; @@ -2114,8 +2113,7 @@ static Gfx *menuitemSelectableRender(Gfx *gdl, struct menurendercontext *context // Right side text text = menuResolveText(context->item->param3, context->item); - // This is not how you check if a string is empty... - if (text != NULL && text != "") { + if (text != NULL) { s32 textheight; s32 textwidth; @@ -2653,7 +2651,7 @@ static char *menuitemScrollableGetText(u32 type) */ static Gfx *menuitemScrollableRender(Gfx *gdl, struct menurendercontext *context) { - char alltext[8000] = ""; + char alltext[8000]; char headingtext[8000]; char bodytext[8000]; bool prevwaslinebreak; @@ -2667,6 +2665,8 @@ static Gfx *menuitemScrollableRender(Gfx *gdl, struct menurendercontext *context char *rawtext; s32 paddingright = 24; + alltext[0] = '\0'; + rawtext = menuitemScrollableGetText(context->item->param); if (menuIsScrollableUnscrollable(context->item)) { @@ -2764,7 +2764,7 @@ static bool menuitemScrollableTick(struct menuitem *item, struct menudialog *dia u32 stack; if ((s16)dialog->height != data->scrollable.unk06) { - char wrapped[8000] = ""; + char wrapped[8000]; char *rawtext; s32 width; s32 height; @@ -2773,6 +2773,8 @@ static bool menuitemScrollableTick(struct menuitem *item, struct menudialog *dia s16 colwidth; s16 rowheight; + wrapped[0] = '\0'; + dialogFindItem(dialog, item, &rowindex, &colindex); colwidth = g_Menus[g_MpPlayerNum].cols[colindex].width; diff --git a/src/game/propobj.c b/src/game/propobj.c index d5450aa96..1dbf1568e 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -14802,7 +14802,7 @@ static void weaponGetPickupText(char *buffer, s32 weaponnum, bool dual) void currentPlayerQueuePickupWeaponHudmsg(u32 weaponnum, bool dual) { - char buffer[100] = ""; + char buffer[100]; weaponGetPickupText(buffer, weaponnum, dual); hudmsgCreateWithFlags(buffer, HUDMSGTYPE_DEFAULT, HUDMSGFLAG_ONLYIFALIVE | HUDMSGFLAG_ALLOWDUPES);