Creat new machines for ORPG

This commit is contained in:
Matt Nadareski
2025-01-13 22:32:21 -05:00
parent 701a1aaa61
commit 7160d34b07

View File

@@ -442,8 +442,11 @@ namespace SabreTools.DatFiles
if (machine == null) if (machine == null)
return; return;
// TODO: Clone current machine so that all data can be retained // Clone current machine to avoid conflict
// TODO: Assign cloned machine to the item with the new name machine = (Machine)machine.Clone();
// Reassign the item to the new machine
datItem.SetFieldValue<Machine>(DatItem.MachineKey, machine);
// Remove extensions from Rom items // Remove extensions from Rom items
if (datItem is Rom) if (datItem is Rom)
@@ -500,7 +503,6 @@ namespace SabreTools.DatFiles
/// </summary> /// </summary>
/// <param name="datItem">DatItem to run logic on</param> /// <param name="datItem">DatItem to run logic on</param>
/// <remarks>Applies to <see cref="ItemsDB"/></remarks> /// <remarks>Applies to <see cref="ItemsDB"/></remarks>
/// TODO: Investigate if this causes cascading issues in updating the machine
private void SetOneRomPerGameImplDB(KeyValuePair<long, DatItem> datItem) private void SetOneRomPerGameImplDB(KeyValuePair<long, DatItem> datItem)
{ {
// If the item name is null // If the item name is null
@@ -513,8 +515,14 @@ namespace SabreTools.DatFiles
if (machine.Value == null) if (machine.Value == null)
return; return;
// TODO: Clone current machine so that all data can be retained // Clone current machine to avoid conflict
// TODO: Assign cloned machine to the item with the new name long newMachineIndex = AddMachineDB((Machine)machine.Value.Clone());
machine = new KeyValuePair<long, Machine?>(newMachineIndex, ItemsDB.GetMachine(newMachineIndex));
if (machine.Value == null)
return;
// Reassign the item to the new machine
ItemsDB._itemToMachineMapping[machine.Key] = newMachineIndex;
// Remove extensions from Rom items // Remove extensions from Rom items
if (datItem.Value is Rom) if (datItem.Value is Rom)