[DnM+/AC]: Fix Islands Not Saving

Closes #52
This commit is contained in:
Cuyler36 2020-03-12 20:36:02 -04:00
parent 42bd503e32
commit 75dfd6a3ba

View file

@ -2581,6 +2581,10 @@ private void SetupMapPictureBoxes()
if (CurrentSaveInfo.ContainsIsland)
{
for (var i = 0; i < _islandItemEditors.Count; i++)
_islandItemEditors[i].Dispose();
_islandItemEditors.Clear();
IslandAcres = new WorldAcre[CurrentSaveInfo.IslandAcreCount];
_islandAcreMap = new PictureBoxWithInterpolationMode[IslandAcres.Length];
_newLeafIslandAcreMap = new PictureBoxWithInterpolationMode[16];
@ -2619,7 +2623,7 @@ private void SetupMapPictureBoxes()
IslandAcres[idx] = new WorldAcre(acreId, idx, acreItems);
if (SaveFile.SaveGeneration == SaveGeneration.GCN ||
((idx > 4 && idx < 7) || (idx > 8 && idx < 11)))
(SaveFile.SaveGeneration == SaveGeneration.N3DS && ((idx > 4 && idx < 7) || (idx > 8 && idx < 11))))
{
var ePlus = SaveFile.SaveType == SaveType.DoubutsuNoMoriEPlus ||
SaveFile.SaveType == SaveType.AnimalForestEPlus;
@ -4100,9 +4104,17 @@ private void SaveToolStripMenuItemClick(object sender, EventArgs e)
// Save Town Ordinances in New Leaf
UpdateNewLeafOrdinances();
// Save DnM+/AC Island Cabana
// Save DnM+/AC Island and Cabana
if (SaveFile.SaveType == SaveType.DoubutsuNoMoriPlus || SaveFile.SaveType == SaveType.AnimalCrossing)
{
for (var i = 0; i < _islandItemEditors.Count; i++)
{
var items = _islandItemEditors[i].Items;
for (var x = 0; x < 256; x++)
{
SaveFile.Write(CurrentSaveInfo.SaveOffsets.IslandWorldData + + i * 512 + x * 2, items[x].ItemId, SaveFile.IsBigEndian, true);
}
}
_islandCabana.Data.Rooms[0].Write();
}