diff --git a/include/battle_scripts.h b/include/battle_scripts.h index a52d256fc4..9c45373632 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -207,6 +207,7 @@ extern const u8 BattleScript_ActionSelectionItemsCantBeUsed[]; extern const u8 BattleScript_ArenaTurnBeginning[]; extern const u8 BattleScript_82DB881[]; extern const u8 BattleScript_82DB8F3[]; +extern const u8 BattleScript_82DAA0B[]; extern const u8 BattleScript_AskIfWantsToForfeitMatch[]; extern const u8 BattleScript_PrintPlayerForfeited[]; extern const u8 BattleScript_PrintPlayerForfeitedLinkBattle[]; diff --git a/include/battle_tower.h b/include/battle_tower.h index d7ff700069..f07e9e5443 100644 --- a/include/battle_tower.h +++ b/include/battle_tower.h @@ -6,7 +6,7 @@ struct RSBattleTowerRecord /*0x00*/ u8 battleTowerLevelType; // 0 = level 50, 1 = level 100 /*0x01*/ u8 trainerClass; /*0x02*/ u16 winStreak; - /*0x04*/ u8 name[8]; + /*0x04*/ u8 name[PLAYER_NAME_LENGTH + 1]; /*0x0C*/ u8 trainerId[4]; /*0x10*/ struct { u16 easyChat[6]; @@ -22,10 +22,12 @@ union BattleTowerRecord struct EmeraldBattleTowerRecord emerald; }; +#define FRONTIER_TRAINER_NAME_LENGTH 7 + struct BattleFrontierTrainer { u32 facilityClass; - u8 trainerName[8]; + u8 trainerName[FRONTIER_TRAINER_NAME_LENGTH + 1]; u16 speechBefore[6]; u16 speechWin[6]; u16 speechLose[6]; diff --git a/include/global.berry.h b/include/global.berry.h index 5c8a43a021..8046d344e0 100644 --- a/include/global.berry.h +++ b/include/global.berry.h @@ -1,12 +1,12 @@ #ifndef GUARD_GLOBAL_BERRY_H #define GUARD_GLOBAL_BERRY_H -#define BERRY_NAME_COUNT 7 +#define BERRY_NAME_LENGTH 6 #define BERRY_ITEM_EFFECT_COUNT 18 struct Berry { - const u8 name[BERRY_NAME_COUNT]; + const u8 name[BERRY_NAME_LENGTH + 1]; u8 firmness; u16 size; u8 maxYield; @@ -26,7 +26,7 @@ struct Berry struct Berry2 { - u8 name[BERRY_NAME_COUNT]; + u8 name[BERRY_NAME_LENGTH + 1]; u8 firmness; u16 size; u8 maxYield; @@ -53,7 +53,7 @@ struct EnigmaBerry struct BattleEnigmaBerry { - /*0x00*/ u8 name[BERRY_NAME_COUNT]; + /*0x00*/ u8 name[BERRY_NAME_LENGTH + 1]; /*0x07*/ u8 holdEffect; /*0x08*/ u8 itemEffect[BERRY_ITEM_EFFECT_COUNT]; /*0x1A*/ u8 holdEffectParam; diff --git a/include/global.h b/include/global.h index 0fff11d09d..6977d4059f 100644 --- a/include/global.h +++ b/include/global.h @@ -57,8 +57,6 @@ #define PARTY_SIZE 6 #define POKEMON_SLOTS_NUMBER 412 -#define POKEMON_NAME_LENGTH 10 -#define OT_NAME_LENGTH 7 #define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) >= (b) ? (a) : (b)) @@ -134,8 +132,7 @@ enum LanguageId // string lengths #define ITEM_NAME_LENGTH 14 #define POKEMON_NAME_LENGTH 10 -#define OT_NAME_LENGTH 7 -#define PLAYER_NAME_LENGTH 8 +#define PLAYER_NAME_LENGTH 7 #define MAIL_WORDS_COUNT 9 enum @@ -326,7 +323,7 @@ struct EmeraldBattleTowerRecord /*0x00*/ u8 battleTowerLevelType; // 0 = level 50, 1 = level 100 /*0x01*/ u8 trainerClass; /*0x02*/ u16 winStreak; - /*0x04*/ u8 name[8]; + /*0x04*/ u8 name[PLAYER_NAME_LENGTH + 1]; /*0x0C*/ u8 trainerId[4]; /*0x10*/ struct { u16 easyChat[6]; @@ -450,7 +447,7 @@ struct BattleFrontier /*0xEBF*/ u8 field_EBF; /*0xEC0*/ u16 field_EC0[16]; /*0xEE0*/ u8 field_EE0; - /*0xEE1*/ u8 field_EE1[2][PLAYER_NAME_LENGTH]; + /*0xEE1*/ u8 field_EE1[2][PLAYER_NAME_LENGTH + 1]; /*0xEF1*/ u8 field_EF1[2][4]; /*0xEF9*/ u8 field_EF9; /*0xEFA*/ u8 field_EFA; @@ -460,7 +457,7 @@ struct BattleFrontier struct SaveBlock2 { - /*0x00*/ u8 playerName[PLAYER_NAME_LENGTH]; + /*0x00*/ u8 playerName[PLAYER_NAME_LENGTH + 1]; /*0x08*/ u8 playerGender; // MALE, FEMALE /*0x09*/ u8 specialSaveWarp; /*0x0A*/ u8 playerTrainerId[4]; @@ -516,7 +513,7 @@ struct SecretBaseRecord /*0x1A9D*/ u8 gender:1; /*0x1A9D*/ u8 sbr_field_1_5:1; /*0x1A9D*/ u8 sbr_field_1_6:2; - /*0x1A9E*/ u8 trainerName[OT_NAME_LENGTH]; + /*0x1A9E*/ u8 trainerName[PLAYER_NAME_LENGTH]; /*0x1AA5*/ u8 trainerId[4]; // byte 0 is used for determining trainer class /*0x1AA9*/ u8 language; /*0x1AAA*/ u16 sbr_field_e; @@ -602,7 +599,7 @@ struct EasyChatPair struct MailStruct { /*0x00*/ u16 words[MAIL_WORDS_COUNT]; - /*0x12*/ u8 playerName[PLAYER_NAME_LENGTH]; + /*0x12*/ u8 playerName[PLAYER_NAME_LENGTH + 1]; /*0x1A*/ u8 trainerId[4]; /*0x1E*/ u16 species; /*0x20*/ u16 itemId; @@ -691,7 +688,7 @@ struct RecordMixing_UnknownStruct struct LinkBattleRecord { - u8 name[8]; + u8 name[PLAYER_NAME_LENGTH + 1]; u16 trainerId; u16 wins; u16 losses; @@ -724,15 +721,15 @@ struct ContestWinner u32 trainerId; u16 species; u8 contestCategory; - u8 monName[11]; - u8 trainerName[8]; + u8 monName[POKEMON_NAME_LENGTH + 1]; + u8 trainerName[PLAYER_NAME_LENGTH + 1]; u8 contestRank; }; struct DayCareMail { struct MailStruct message; - u8 OT_name[OT_NAME_LENGTH + 1]; + u8 OT_name[PLAYER_NAME_LENGTH + 1]; u8 monName[POKEMON_NAME_LENGTH + 1]; u8 gameLanguage:4; u8 monLanguage:4; @@ -773,7 +770,7 @@ struct LilycoveLadyQuiz /*0x002*/ u16 unk_002[9]; /*0x014*/ u16 unk_014; /*0x016*/ u16 unk_016; - /*0x018*/ u8 playerName[8]; + /*0x018*/ u8 playerName[PLAYER_NAME_LENGTH + 1]; /*0x020*/ u16 playerTrainerId[4]; /*0x028*/ u16 itemId; /*0x02a*/ u8 unk_02a; @@ -788,7 +785,7 @@ struct LilycoveLadyFavour /*0x001*/ u8 phase; /*0x002*/ u8 unk_002; /*0x003*/ u8 unk_003; - /*0x004*/ u8 playerName[8]; + /*0x004*/ u8 playerName[PLAYER_NAME_LENGTH + 1]; /*0x00c*/ u8 unk_00c; /*0x00e*/ u16 itemId; /*0x010*/ u16 unk_010; @@ -801,7 +798,7 @@ struct LilycoveLadyContest /*0x001*/ u8 phase; /*0x002*/ u8 fave_pkblk; /*0x003*/ u8 other_pkblk; - /*0x004*/ u8 playerName[8]; + /*0x004*/ u8 playerName[PLAYER_NAME_LENGTH + 1]; /*0x00c*/ u8 max_sheen; /*0x00d*/ u8 category; /*0x00e*/ u8 language; @@ -828,7 +825,7 @@ struct WaldaPhrase struct UnkSaveSubstruct_3b98 { u32 trainerId; - u8 trainerName[8]; + u8 trainerName[PLAYER_NAME_LENGTH + 1]; }; struct SaveBlock1 diff --git a/include/pokemon.h b/include/pokemon.h index 09496b5c3d..abfb360f0d 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -205,7 +205,7 @@ struct BoxPokemon u8 hasSpecies:1; u8 isEgg:1; u8 unused:5; - u8 otName[OT_NAME_LENGTH]; + u8 otName[PLAYER_NAME_LENGTH]; u8 markings; u16 checksum; u16 unknown; diff --git a/include/record_mixing.h b/include/record_mixing.h index 3cd4d649eb..f1b74c1433 100644 --- a/include/record_mixing.h +++ b/include/record_mixing.h @@ -6,7 +6,7 @@ struct UnkRecordMixingStruct2a { u8 playerId[4]; u16 field_4; - u8 playerName[PLAYER_NAME_LENGTH]; + u8 playerName[PLAYER_NAME_LENGTH + 1]; u8 language; }; @@ -15,8 +15,8 @@ struct UnkRecordMixingStruct2b u8 playerId1[4]; u8 playerId2[4]; u16 field_8; - u8 playerName1[PLAYER_NAME_LENGTH]; - u8 playerName2[PLAYER_NAME_LENGTH]; + u8 playerName1[PLAYER_NAME_LENGTH + 1]; + u8 playerName2[PLAYER_NAME_LENGTH + 1]; u8 language; }; diff --git a/src/battle_dome.c b/src/battle_dome.c index 9f400bc7a0..ff284b564b 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -6449,12 +6449,12 @@ static void CopyDomeTrainerName(u8 *dst, u16 trainerId) { if (trainerId == TRAINER_PLAYER) { - for (i = 0; i < OT_NAME_LENGTH; i++) + for (i = 0; i < PLAYER_NAME_LENGTH; i++) dst[i] = gSaveBlock2Ptr->playerName[i]; } else if (trainerId < 300) { - for (i = 0; i < 7; i++) + for (i = 0; i < FRONTIER_TRAINER_NAME_LENGTH; i++) dst[i] = gFacilityTrainers[trainerId].trainerName[i]; } dst[i] = EOS; @@ -6475,7 +6475,7 @@ static void CopyDomeBrainTrainerName(u8 *dst) { s32 i; - for (i = 0; i < 7; i++) + for (i = 0; i < FRONTIER_TRAINER_NAME_LENGTH; i++) dst[i] = gTrainers[TRAINER_TUCKER].trainerName[i]; dst[i] = EOS; } diff --git a/src/battle_main.c b/src/battle_main.c index be6f789ecb..1a1f6f61a6 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -734,7 +734,7 @@ static void SetPlayerBerryDataInBattleStruct(void) if (IsEnigmaBerryValid() == TRUE) { - for (i = 0; i < BERRY_NAME_COUNT - 1; i++) + for (i = 0; i < BERRY_NAME_LENGTH; i++) battleBerry->name[i] = gSaveBlock1Ptr->enigmaBerry.berry.name[i]; battleBerry->name[i] = EOS; @@ -748,7 +748,7 @@ static void SetPlayerBerryDataInBattleStruct(void) { const struct Berry *berryData = GetBerryInfo(ItemIdToBerryType(ITEM_ENIGMA_BERRY)); - for (i = 0; i < BERRY_NAME_COUNT - 1; i++) + for (i = 0; i < BERRY_NAME_LENGTH; i++) battleBerry->name[i] = berryData->name[i]; battleBerry->name[i] = EOS; @@ -769,7 +769,7 @@ static void SetAllPlayersBerryData(void) { if (IsEnigmaBerryValid() == TRUE) { - for (i = 0; i < BERRY_NAME_COUNT - 1; i++) + for (i = 0; i < BERRY_NAME_LENGTH; i++) { gEnigmaBerries[0].name[i] = gSaveBlock1Ptr->enigmaBerry.berry.name[i]; gEnigmaBerries[2].name[i] = gSaveBlock1Ptr->enigmaBerry.berry.name[i]; @@ -792,7 +792,7 @@ static void SetAllPlayersBerryData(void) { const struct Berry *berryData = GetBerryInfo(ItemIdToBerryType(ITEM_ENIGMA_BERRY)); - for (i = 0; i < BERRY_NAME_COUNT - 1; i++) + for (i = 0; i < BERRY_NAME_LENGTH; i++) { gEnigmaBerries[0].name[i] = berryData->name[i]; gEnigmaBerries[2].name[i] = berryData->name[i]; @@ -830,7 +830,7 @@ static void SetAllPlayersBerryData(void) src = (struct BattleEnigmaBerry *)(gBlockRecvBuffer[i] + 2); battlerId = gLinkPlayers[i].id; - for (j = 0; j < BERRY_NAME_COUNT - 1; j++) + for (j = 0; j < BERRY_NAME_LENGTH; j++) gEnigmaBerries[battlerId].name[j] = src->name[j]; gEnigmaBerries[battlerId].name[j] = EOS; @@ -847,7 +847,7 @@ static void SetAllPlayersBerryData(void) { src = (struct BattleEnigmaBerry *)(gBlockRecvBuffer[i] + 2); - for (j = 0; j < BERRY_NAME_COUNT - 1; j++) + for (j = 0; j < BERRY_NAME_LENGTH; j++) { gEnigmaBerries[i].name[j] = src->name[j]; gEnigmaBerries[i + 2].name[j] = src->name[j]; diff --git a/src/battle_records.c b/src/battle_records.c index 8e9d045cba..1680f3cc4e 100644 --- a/src/battle_records.c +++ b/src/battle_records.c @@ -107,7 +107,7 @@ static s32 FindLinkBattleRecord(struct LinkBattleRecord *records, const u8 *name for (i = 0; i < LINK_B_RECORDS_COUNT; i++) { - if (!StringCompareN(records[i].name, name, OT_NAME_LENGTH) && records[i].trainerId == trainerId) + if (!StringCompareN(records[i].name, name, PLAYER_NAME_LENGTH) && records[i].trainerId == trainerId) return i; } @@ -198,7 +198,7 @@ static void UpdateLinkBattleRecords(struct LinkBattleRecords *records, const u8 { index = LINK_B_RECORDS_COUNT - 1; ClearLinkBattleRecord(&records->entries[index]); - StringCopyN(records->entries[index].name, name, OT_NAME_LENGTH); + StringCopyN(records->entries[index].name, name, PLAYER_NAME_LENGTH); records->entries[index].trainerId = trainerId; records->languages[index] = gLinkPlayers[battlerId].language; } diff --git a/src/berry.c b/src/berry.c index f8a0204c44..ea216b61c4 100644 --- a/src/berry.c +++ b/src/berry.c @@ -1076,8 +1076,8 @@ u16 BerryTypeToItemId(u16 berry) void GetBerryNameByBerryType(u8 berry, u8 *string) { - memcpy(string, GetBerryInfo(berry)->name, BERRY_NAME_COUNT - 1); - string[BERRY_NAME_COUNT - 1] = EOS; + memcpy(string, GetBerryInfo(berry)->name, BERRY_NAME_LENGTH); + string[BERRY_NAME_LENGTH] = EOS; } void GetBerryCountStringByBerryType(u8 berry, u8* dest, u32 berryCount) diff --git a/src/berry_blender.c b/src/berry_blender.c index 1fd6d1cddb..02df933f29 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -51,7 +51,7 @@ enum struct BlenderBerry { u16 itemId; - u8 name[BERRY_NAME_COUNT]; + u8 name[BERRY_NAME_LENGTH + 1]; u8 flavors[FLAVOR_COUNT]; u8 smoothness; }; diff --git a/src/daycare.c b/src/daycare.c index c73d915213..7599d70abe 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -368,7 +368,7 @@ static void ClearDaycareMonMail(struct DayCareMail *mail) { s32 i; - for (i = 0; i < OT_NAME_LENGTH + 1; i++) + for (i = 0; i < PLAYER_NAME_LENGTH + 1; i++) mail->OT_name[i] = 0; for (i = 0; i < POKEMON_NAME_LENGTH + 1; i++) mail->monName[i] = 0; diff --git a/src/mail_data.c b/src/mail_data.c index ebb49febf2..809dcc2a8f 100644 --- a/src/mail_data.c +++ b/src/mail_data.c @@ -22,7 +22,7 @@ void ClearMailStruct(struct MailStruct *mail) for (i = 0; i < MAIL_WORDS_COUNT; i++) mail->words[i] = 0xFFFF; - for (i = 0; i < PLAYER_NAME_LENGTH; i++) + for (i = 0; i < PLAYER_NAME_LENGTH + 1; i++) mail->playerName[i] = EOS; for (i = 0; i < 4; i++) @@ -58,7 +58,7 @@ u8 GiveMailToMon(struct Pokemon *mon, u16 itemId) for (i = 0; i < MAIL_WORDS_COUNT; i++) gSaveBlock1Ptr->mail[id].words[i] = 0xFFFF; - for (i = 0; i < PLAYER_NAME_LENGTH - 1; i++) + for (i = 0; i < PLAYER_NAME_LENGTH + 1 - 1; i++) gSaveBlock1Ptr->mail[id].playerName[i] = gSaveBlock2Ptr->playerName[i]; gSaveBlock1Ptr->mail[id].playerName[i] = EOS; PadNameString(gSaveBlock1Ptr->mail[id].playerName, CHAR_SPACE); diff --git a/src/mystery_event_script.c b/src/mystery_event_script.c index 8822cd05af..921c8e97c5 100644 --- a/src/mystery_event_script.c +++ b/src/mystery_event_script.c @@ -226,9 +226,9 @@ bool8 MEScrCmd_setenigmaberry(struct ScriptContext *ctx) const u8 *message; bool32 haveBerry = IsEnigmaBerryValid(); u8 *berry = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]); - StringCopyN(gStringVar1, gSaveBlock1Ptr->enigmaBerry.berry.name, BERRY_NAME_COUNT); + StringCopyN(gStringVar1, gSaveBlock1Ptr->enigmaBerry.berry.name, BERRY_NAME_LENGTH + 1); SetEnigmaBerry(berry); - StringCopyN(gStringVar2, gSaveBlock1Ptr->enigmaBerry.berry.name, BERRY_NAME_COUNT); + StringCopyN(gStringVar2, gSaveBlock1Ptr->enigmaBerry.berry.name, BERRY_NAME_LENGTH + 1); if (!haveBerry) { diff --git a/src/pokemon.c b/src/pokemon.c index 9022f69eab..2922549852 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -4112,7 +4112,7 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data) { retVal = 0; - while (retVal < OT_NAME_LENGTH) + while (retVal < PLAYER_NAME_LENGTH) { data[retVal] = boxMon->otName[retVal]; retVal++; @@ -4480,7 +4480,7 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg) case MON_DATA_OT_NAME: { s32 i; - for (i = 0; i < OT_NAME_LENGTH; i++) + for (i = 0; i < PLAYER_NAME_LENGTH; i++) boxMon->otName[i] = data[i]; break; } @@ -6778,7 +6778,7 @@ s8 GetFlavorRelationByPersonality(u32 personality, u8 flavor) bool8 IsTradedMon(struct Pokemon *mon) { - u8 otName[OT_NAME_LENGTH + 1]; + u8 otName[PLAYER_NAME_LENGTH + 1]; u32 otId; GetMonData(mon, MON_DATA_OT_NAME, otName); otId = GetMonData(mon, MON_DATA_OT_ID, 0); diff --git a/src/recorded_battle.c b/src/recorded_battle.c index e19f3047f7..fc3b8b94a1 100644 --- a/src/recorded_battle.c +++ b/src/recorded_battle.c @@ -28,7 +28,7 @@ extern u8 gUnknown_03001279; struct PlayerInfo { u32 trainerId; - u8 name[PLAYER_NAME_LENGTH]; + u8 name[PLAYER_NAME_LENGTH + 1]; u8 gender; u16 battlerId; u16 language; @@ -44,7 +44,7 @@ struct RecordedBattleSave { struct Pokemon playerParty[PARTY_SIZE]; struct Pokemon opponentParty[PARTY_SIZE]; - u8 playersName[MAX_BATTLERS_COUNT][PLAYER_NAME_LENGTH]; + u8 playersName[MAX_BATTLERS_COUNT][PLAYER_NAME_LENGTH + 1]; u8 playersGender[MAX_BATTLERS_COUNT]; u32 playersTrainerId[MAX_BATTLERS_COUNT]; u8 playersLanguage[MAX_BATTLERS_COUNT]; @@ -170,7 +170,7 @@ void sub_8184E58(void) } else { - for (j = 0; j < PLAYER_NAME_LENGTH; j++) + for (j = 0; j < PLAYER_NAME_LENGTH + 1; j++) sPlayers[i].name[j] = gLinkPlayers[i].name[j]; } } @@ -186,7 +186,7 @@ void sub_8184E58(void) sPlayers[0].battlerId = 0; sPlayers[0].language = gGameLanguage; - for (i = 0; i < PLAYER_NAME_LENGTH; i++) + for (i = 0; i < PLAYER_NAME_LENGTH + 1; i++) sPlayers[0].name[i] = gSaveBlock2Ptr->playerName[i]; } } @@ -343,7 +343,7 @@ u32 MoveRecordedBattleToSaveData(void) for (i = 0; i < MAX_BATTLERS_COUNT; i++) { - for (j = 0; j < PLAYER_NAME_LENGTH; j++) + for (j = 0; j < PLAYER_NAME_LENGTH + 1; j++) { battleSave->playersName[i][j] = sPlayers[i].name[j]; } @@ -1332,7 +1332,7 @@ static void SetRecordedBattleVarsFromSave(struct RecordedBattleSave *src) for (i = 0; i < MAX_BATTLERS_COUNT; i++) { - for (var = FALSE, j = 0; j < PLAYER_NAME_LENGTH; j++) + for (var = FALSE, j = 0; j < PLAYER_NAME_LENGTH + 1; j++) { gLinkPlayers[i].name[j] = src->playersName[i][j]; if (src->playersName[i][j] == EOS) diff --git a/src/rom_8011DC0.c b/src/rom_8011DC0.c index 993dc0f4f3..b2bd2eb784 100644 --- a/src/rom_8011DC0.c +++ b/src/rom_8011DC0.c @@ -40,7 +40,7 @@ struct UnkStruct_Shared { struct UnkLinkRfuStruct_02022B14 field_0; u8 needingPadding[3]; - u8 playerName[PLAYER_NAME_LENGTH]; + u8 playerName[PLAYER_NAME_LENGTH + 1]; }; struct UnkStruct_x1C diff --git a/src/secret_base.c b/src/secret_base.c index b75163200e..d357261fe5 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -1354,7 +1354,7 @@ bool8 sub_80EA904(struct SecretBaseRecord *sbr1, struct SecretBaseRecord *sbr2) { u8 i; - for (i = 0; i < OT_NAME_LENGTH && (sbr1->trainerName[i] != EOS || sbr2->trainerName[i] != EOS); i++) + for (i = 0; i < PLAYER_NAME_LENGTH && (sbr1->trainerName[i] != EOS || sbr2->trainerName[i] != EOS); i++) { if (sbr1->trainerName[i] != sbr2->trainerName[i]) { @@ -1509,7 +1509,7 @@ bool8 DoesSecretBaseBelongToPlayer(struct SecretBaseRecord *secretBase) return FALSE; } - for (i = 0; i < OT_NAME_LENGTH && (secretBase->trainerName[i] != EOS || gSaveBlock2Ptr->playerName[i] != EOS); i ++) + for (i = 0; i < PLAYER_NAME_LENGTH && (secretBase->trainerName[i] != EOS || gSaveBlock2Ptr->playerName[i] != EOS); i ++) { if (secretBase->trainerName[i] != gSaveBlock2Ptr->playerName[i]) return FALSE;