Stop hard-coding number of preset names

This commit is contained in:
GriffinR 2023-02-04 00:00:38 -05:00
parent 5496f0e6b0
commit bbf0cf0103

View file

@ -503,7 +503,9 @@ static const u8 *const sFemalePresetNames[] = {
gText_DefaultNameHalie
};
// .text
// The number of male vs. female names is assumed to be the same.
// If they aren't, the smaller of the two sizes will be used and any extra names will be ignored.
#define NUM_PRESET_NAMES min(ARRAY_COUNT(sMalePresetNames), ARRAY_COUNT(sFemalePresetNames))
enum
{
@ -1597,7 +1599,7 @@ static void Task_NewGameBirchSpeech_StartNamingScreen(u8 taskId)
{
FreeAllWindowBuffers();
FreeAndDestroyMonPicSprite(gTasks[taskId].tLotadSpriteId);
NewGameBirchSpeech_SetDefaultPlayerName(Random() % 20);
NewGameBirchSpeech_SetDefaultPlayerName(Random() % NUM_PRESET_NAMES);
DestroyTask(taskId);
DoNamingScreen(NAMING_SCREEN_PLAYER, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, CB2_NewGameBirchSpeech_ReturnFromNamingScreen);
}