summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/battle_dome.c6
-rw-r--r--src/battle_main.c12
-rw-r--r--src/battle_records.c4
-rw-r--r--src/berry.c4
-rw-r--r--src/berry_blender.c2
-rw-r--r--src/daycare.c2
-rw-r--r--src/mail_data.c4
-rw-r--r--src/mystery_event_script.c4
-rw-r--r--src/pokemon.c6
-rw-r--r--src/recorded_battle.c12
-rw-r--r--src/rom_8011DC0.c2
-rw-r--r--src/secret_base.c4
12 files changed, 31 insertions, 31 deletions
diff --git a/src/battle_dome.c b/src/battle_dome.c
index 9f400bc7a..ff284b564 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 be6f789ec..1a1f6f61a 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 8e9d045cb..1680f3cc4 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 f8a0204c4..ea216b61c 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 1fd6d1cdd..02df933f2 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 c73d91521..7599d70ab 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 ebb49febf..809dcc2a8 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 8822cd05a..921c8e97c 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 9022f69ea..292254985 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 e19f3047f..fc3b8b94a 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 993dc0f4f..b2bd2eb78 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 b75163200..d357261fe 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;