Changed item name/pluralName to a compound string (#7359)
This commit is contained in:
parent
070a4f1dfa
commit
38eb3461b9
@ -93,8 +93,8 @@ struct Item
|
||||
ItemUseFunc fieldUseFunc;
|
||||
const u8 *description;
|
||||
const u8 *effect;
|
||||
u8 name[ITEM_NAME_LENGTH];
|
||||
u8 pluralName[ITEM_NAME_PLURAL_LENGTH];
|
||||
const u8 *name;
|
||||
const u8 *pluralName;
|
||||
u8 holdEffect;
|
||||
u8 holdEffectParam;
|
||||
u8 importance:2;
|
||||
@ -121,6 +121,7 @@ struct TmHmIndexKey
|
||||
u16 moveId;
|
||||
};
|
||||
|
||||
extern const u8 gQuestionMarksItemName[];
|
||||
extern const struct Item gItemsInfo[];
|
||||
extern struct BagPocket gBagPockets[];
|
||||
extern const struct TmHmIndexKey gTMHMItemMoveIds[];
|
||||
|
||||
@ -32,6 +32,12 @@
|
||||
|
||||
/* Converts a string to a compound literal, essentially making it a pointer to const u8 */
|
||||
#define COMPOUND_STRING(str) (const u8[]) _(str)
|
||||
#define COMPOUND_STRING_SIZE_LIMIT(str, limit) (const u8[COMPOUND_STRING_CHECK_SIZE(str, limit)]) _(str)
|
||||
|
||||
/* Used for COMPOUND_STRING_SIZE_LIMIT. Stupid, but makes sure we only get
|
||||
* one error message regardless of how many characters over the limit we are.
|
||||
* Otherwise, GCC gives an error for each and every character (which is annoying). */
|
||||
#define COMPOUND_STRING_CHECK_SIZE(str, limit) (sizeof(COMPOUND_STRING(str)) > limit ? sizeof(COMPOUND_STRING(str)) - 1 : sizeof(COMPOUND_STRING(str)))
|
||||
|
||||
/* Expands to the first/second/third/fourth argument. */
|
||||
#define FIRST(a, ...) a
|
||||
|
||||
2066
src/data/items.h
2066
src/data/items.h
File diff suppressed because it is too large
Load Diff
@ -776,7 +776,9 @@ static u16 SanitizeItemId(u16 itemId)
|
||||
|
||||
const u8 *GetItemName(u16 itemId)
|
||||
{
|
||||
return gItemsInfo[SanitizeItemId(itemId)].name;
|
||||
const u8 *name = gItemsInfo[SanitizeItemId(itemId)].name;
|
||||
|
||||
return name == NULL ? gQuestionMarksItemName : name;
|
||||
}
|
||||
|
||||
u32 GetItemPrice(u16 itemId)
|
||||
@ -786,7 +788,7 @@ u32 GetItemPrice(u16 itemId)
|
||||
|
||||
static bool32 DoesItemHavePluralName(u16 itemId)
|
||||
{
|
||||
return (gItemsInfo[SanitizeItemId(itemId)].pluralName[0] != '\0');
|
||||
return gItemsInfo[SanitizeItemId(itemId)].pluralName != NULL;
|
||||
}
|
||||
|
||||
static const u8 *GetItemPluralName(u16 itemId)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user