Use APPRENTICE_COUNT for record_mixing mod

This commit is contained in:
GriffinR
2019-11-23 10:11:05 -05:00
parent 2bf1e0600e
commit f039e897ca
+5 -5
View File
@@ -1035,7 +1035,7 @@ static void GetSavedApprentices(struct Apprentice *dst, struct Apprentice *src)
numMixApprentices = 0; numMixApprentices = 0;
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
{ {
id = ((i + gSaveBlock2Ptr->playerApprentice.saveId) % 3) + 1; id = ((i + gSaveBlock2Ptr->playerApprentice.saveId) % (APPRENTICE_COUNT - 1)) + 1;
if (src[id].playerName[0] != EOS) if (src[id].playerName[0] != EOS)
{ {
if (GetTrainerId(src[id].playerId) != GetTrainerId(gSaveBlock2Ptr->playerTrainerId)) if (GetTrainerId(src[id].playerId) != GetTrainerId(gSaveBlock2Ptr->playerTrainerId))
@@ -1070,7 +1070,7 @@ static void GetSavedApprentices(struct Apprentice *dst, struct Apprentice *src)
} }
else else
{ {
dst[1] = src[((gSaveBlock2Ptr->playerApprentice.saveId + 1) % 3 + 1)]; dst[1] = src[((gSaveBlock2Ptr->playerApprentice.saveId + 1) % (APPRENTICE_COUNT - 1) + 1)];
} }
break; break;
} }
@@ -1156,15 +1156,15 @@ static void ReceiveApprenticeData(struct Apprentice *mixApprentice, size_t recor
case 1: case 1:
apprenticeSaveId = gSaveBlock2Ptr->playerApprentice.saveId + 1; apprenticeSaveId = gSaveBlock2Ptr->playerApprentice.saveId + 1;
gSaveBlock2Ptr->apprentices[apprenticeSaveId] = mixApprenticePtr[apprenticeId]; gSaveBlock2Ptr->apprentices[apprenticeSaveId] = mixApprenticePtr[apprenticeId];
gSaveBlock2Ptr->playerApprentice.saveId = (gSaveBlock2Ptr->playerApprentice.saveId + 1) % 3; gSaveBlock2Ptr->playerApprentice.saveId = (gSaveBlock2Ptr->playerApprentice.saveId + 1) % (APPRENTICE_COUNT - 1);
break; break;
case 2: case 2:
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
{ {
apprenticeSaveId = ((i ^ 1) + gSaveBlock2Ptr->playerApprentice.saveId) % 3 + 1; apprenticeSaveId = ((i ^ 1) + gSaveBlock2Ptr->playerApprentice.saveId) % (APPRENTICE_COUNT - 1) + 1;
gSaveBlock2Ptr->apprentices[apprenticeSaveId] = mixApprenticePtr[i]; gSaveBlock2Ptr->apprentices[apprenticeSaveId] = mixApprenticePtr[i];
} }
gSaveBlock2Ptr->playerApprentice.saveId = (gSaveBlock2Ptr->playerApprentice.saveId + 2) % 3; gSaveBlock2Ptr->playerApprentice.saveId = (gSaveBlock2Ptr->playerApprentice.saveId + 2) % (APPRENTICE_COUNT - 1);
break; break;
} }
} }