From b8069184a249a1e1ed8fa86c8f1f4bbaceda6e80 Mon Sep 17 00:00:00 2001 From: Kurt Date: Tue, 13 Jun 2017 22:14:17 -0700 Subject: [PATCH] Fix partycount setting for gen5 only update the party count when appropriate species present=>only update if below no species present=>only update if above Closes #1224 --- PKHeX.Core/Saves/SaveFile.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/PKHeX.Core/Saves/SaveFile.cs b/PKHeX.Core/Saves/SaveFile.cs index 1a81a34ad..e2a68cefa 100644 --- a/PKHeX.Core/Saves/SaveFile.cs +++ b/PKHeX.Core/Saves/SaveFile.cs @@ -197,7 +197,6 @@ namespace PKHeX.Core PKM[] newParty = value.Where(pk => pk.Species != 0).ToArray(); - PartyCount = newParty.Length; Array.Resize(ref newParty, 6); for (int i = PartyCount; i < newParty.Length; i++) @@ -481,8 +480,16 @@ namespace PKHeX.Core for (int i = 0; i < 6; i++) if (getPartyOffset(i) == offset) - if (PartyCount <= i) - PartyCount = i + 1; + { + if (pkm.Species != 0) + { + if (PartyCount <= i) + PartyCount = i + 1; + } + else if (PartyCount > i) + PartyCount = i; + break; + } setData(pkm.EncryptedPartyData, offset); Edited = true;