public static void ReparentGroup(MapLua.SaveLua.Army.UnitsGroup Source, MapLua.SaveLua.Army.UnitsGroup NewOwner, MapLua.SaveLua.Army.UnitsGroup OldOwner) { if (OldOwner == null) { } OldOwner.RemoveGroup(Source); NewOwner.AddGroup(Source); }
public override void DoRedo() { MapLua.SaveLua.Army.UnitsGroup[] RemoveOld = new MapLua.SaveLua.Army.UnitsGroup[RegisteredGroup.UnitGroups.Count]; RegisteredGroup.UnitGroups.CopyTo(RemoveOld); for (int i = 0; i < RemoveOld.Length; i++) { RegisteredGroup.RemoveGroup(AllGroups[i]); AllGroups[i].ClearUnitInstances(); } RegisteredGroup.UnitGroups.Clear(); for (int i = 0; i < AllGroups.Length; i++) { RegisteredGroup.AddGroup(AllGroups[i]); AllGroups[i].InstantiateGroup(true); } Undo.Current.EditMenu.ChangeCategory(7); MapLuaParser.Current.UnitsMenu.ChangePage(0); MapLuaParser.Current.UnitsMenu.Generate(); }