mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 06:34:19 +00:00
Minor tweaks
PK9: Fix writing box bin of self-owned SV eggs clearing nickname trash, also clear any hint of trading completely SAV1: ensure current box is index:0 if uninitialized
This commit is contained in:
parent
d5e5eec082
commit
de6c1baaf2
4 changed files with 18 additions and 7 deletions
|
@ -609,6 +609,9 @@ public sealed class PK9 : PKM, ISanityChecksum, ITeraType, ITechRecord, IObedien
|
|||
HandlingTrainerGender = 0;
|
||||
HandlingTrainerLanguage = 0;
|
||||
|
||||
MetDate = null;
|
||||
MetLocation = 0;
|
||||
Nickname = SpeciesName.GetSpeciesNameGeneration(Species, tr.Language, 9);
|
||||
Nickname = SpeciesName.GetEggName(tr.Language, 9);
|
||||
OriginalTrainerName = tr.OT;
|
||||
CurrentHandler = 0;
|
||||
|
|
|
@ -145,6 +145,8 @@ public sealed class SAV1 : SaveFile, ILangDeviantSave, IEventFlagArray, IEventWo
|
|||
bool newContent = AnyBoxSlotSpeciesPresent(current, boxSlotCount);
|
||||
if (newContent)
|
||||
BoxesInitialized = boxInitialized = true;
|
||||
else
|
||||
current = CurrentBox = 0; // No content, reset to box 1.
|
||||
}
|
||||
|
||||
for (int i = 0; i < BoxCount; i++)
|
||||
|
@ -154,7 +156,7 @@ public sealed class SAV1 : SaveFile, ILangDeviantSave, IEventFlagArray, IEventWo
|
|||
var src = GetUnpackedBoxSpan(i);
|
||||
|
||||
bool written = PokeList1.MergeSingles(src, dest, StringLength, boxSlotCount, false, boxInitialized);
|
||||
if (written && i == CurrentBox)
|
||||
if (written && i == current) // Ensure the current box is mirrored in the box buffer; easier than having dest be CurrentBox.
|
||||
dest.CopyTo(Data.AsSpan(Offsets.CurrentBox));
|
||||
}
|
||||
|
||||
|
|
|
@ -63,12 +63,12 @@ public sealed partial class ErrorWindow : Form
|
|||
}
|
||||
}
|
||||
|
||||
public void LoadException(Exception ex, string friendlyMessage, bool allowContinue) => Invoke(() =>
|
||||
public void LoadException(Exception ex, string friendlyMessage, bool allowContinue)
|
||||
{
|
||||
ShowContinue = allowContinue;
|
||||
Message = friendlyMessage;
|
||||
Error = ex;
|
||||
});
|
||||
}
|
||||
|
||||
private void UpdateExceptionDetailsMessage()
|
||||
{
|
||||
|
|
|
@ -68,9 +68,7 @@ internal static class Program
|
|||
try
|
||||
{
|
||||
var e = t.Exception;
|
||||
string errorMessage = IsPluginError<IPlugin>(e, out var pluginName)
|
||||
? $"An error occurred in a PKHeX plugin. Please report this error to the plugin author/maintainer.\n{pluginName}"
|
||||
: "An error occurred in PKHeX. Please report this error to the PKHeX author.";
|
||||
string errorMessage = GetErrorMessage(e);
|
||||
result = ErrorWindow.ShowErrorDialog(errorMessage, e, true);
|
||||
}
|
||||
catch (Exception reportingException)
|
||||
|
@ -83,6 +81,13 @@ internal static class Program
|
|||
Application.Exit();
|
||||
}
|
||||
|
||||
private static string GetErrorMessage(Exception e)
|
||||
{
|
||||
return IsPluginError<IPlugin>(e, out var pluginName)
|
||||
? $"An error occurred in a PKHeX plugin. Please report this error to the plugin author/maintainer.\n{pluginName}"
|
||||
: "An error occurred in PKHeX. Please report this error to the PKHeX author.";
|
||||
}
|
||||
|
||||
// Handle the UI exceptions by showing a dialog box, and asking the user if they wish to abort execution.
|
||||
// NOTE: This exception cannot be kept from terminating the application - it can only
|
||||
// log the event, and inform the user about it.
|
||||
|
@ -97,7 +102,8 @@ internal static class Program
|
|||
}
|
||||
else if (ex != null)
|
||||
{
|
||||
ErrorWindow.ShowErrorDialog("An unhandled exception has occurred.\nPKHeX must now close.", ex, false);
|
||||
var msg = GetErrorMessage(ex);
|
||||
ErrorWindow.ShowErrorDialog($"{msg}\nPKHeX must now close.", ex, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue