diff --git a/Patches/SaveAndStatePatches.cs b/Patches/SaveAndStatePatches.cs index e82c31a..e5e0c00 100644 --- a/Patches/SaveAndStatePatches.cs +++ b/Patches/SaveAndStatePatches.cs @@ -182,7 +182,7 @@ public static void Postfix(SimGameState __instance) { var dmg = PilotInjuryHolder.HolderInstance.pilotInjuriesMap[pKey].Count - sim.Commander.StatCollection.GetValue("Injuries"); - for (int i = 0; i < dmg; i++) + for (int i = dmg - 1; i >= 0; i--) { PilotInjuryHolder.HolderInstance.pilotInjuriesMap[pKey].RemoveAt(i); ModInit.modLog?.Info?.Write( @@ -235,7 +235,7 @@ public static void Postfix(SimGameState __instance) { var dmg = PilotInjuryHolder.HolderInstance.pilotInjuriesMap[pKey].Count - p.StatCollection.GetValue("Injuries"); - for (int i = 0; i < dmg; i++) + for (int i = dmg - 1; i >= 0; i--) { PilotInjuryHolder.HolderInstance.pilotInjuriesMap[pKey].RemoveAt(i); ModInit.modLog?.Info?.Write( @@ -310,7 +310,7 @@ public static void Postfix(SimGameState __instance, SimGameEventResult result, L { var dmg = PilotInjuryHolder.HolderInstance.pilotInjuriesMap[pKey].Count - p.StatCollection.GetValue("Injuries"); ModInit.modLog?.Info?.Write($"{p.Callsign} has {dmg} extra injuries. Removing."); - for (int j = 0; j < dmg; j++) + for (int j = dmg - 1; j >= 0; j--) { PilotInjuryHolder.HolderInstance.pilotInjuriesMap[pKey].RemoveAt(j); } @@ -379,7 +379,7 @@ public static void Postfix(SimGameState __instance, SimGameEventResult result, L { var dmg = PilotInjuryHolder.HolderInstance.pilotInjuriesMap[pKey].Count - commander.StatCollection.GetValue("Injuries"); ModInit.modLog?.Info?.Write($"{commander.Callsign} has {dmg} extra injuries. Removing."); - for (int j = 0; j < dmg; j++) + for (int j = dmg - 1; j >= 0; j--) { PilotInjuryHolder.HolderInstance.pilotInjuriesMap[pKey].RemoveAt(j); } @@ -633,7 +633,7 @@ public static void Prefix(Contract __instance, MissionResult result, bool isGood ModInit.modLog?.Info?.Write( $"Post-Mission Injuries ({p.StatCollection.GetValue("Injuries")}) less than InjuryHolder count ({PilotInjuryHolder.HolderInstance.pilotInjuriesMap[pKey].Count})"); PilotInjuryHolder.HolderInstance.pilotInjuriesMap[pKey].Reverse(); - for (int i = 0; i < diff; i++) + for (int i = diff - 1; i >= 0; i--) { ModInit.modLog?.Info?.Write( $"Removing {PilotInjuryHolder.HolderInstance.pilotInjuriesMap[pKey][i]} from {p.Callsign}"); diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index dac1785..b47fbc7 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.5.1")] -[assembly: AssemblyFileVersion("1.0.5.1")] +[assembly: AssemblyVersion("1.0.5.2")] +[assembly: AssemblyFileVersion("1.0.5.2")] diff --git a/bin/Debug/TisButAScratch.dll b/bin/Debug/TisButAScratch.dll index acc354d..1155bd6 100644 Binary files a/bin/Debug/TisButAScratch.dll and b/bin/Debug/TisButAScratch.dll differ diff --git a/bin/Debug/TisButAScratch.pdb b/bin/Debug/TisButAScratch.pdb index 48f92a4..fec5192 100644 Binary files a/bin/Debug/TisButAScratch.pdb and b/bin/Debug/TisButAScratch.pdb differ diff --git a/obj/Debug/TisButAScratch.dll b/obj/Debug/TisButAScratch.dll index acc354d..1155bd6 100644 Binary files a/obj/Debug/TisButAScratch.dll and b/obj/Debug/TisButAScratch.dll differ diff --git a/obj/Debug/TisButAScratch.pdb b/obj/Debug/TisButAScratch.pdb index 48f92a4..fec5192 100644 Binary files a/obj/Debug/TisButAScratch.pdb and b/obj/Debug/TisButAScratch.pdb differ