1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-02-01 17:38:19 +00:00

Remove DynamicTools; fix pause menu on HTML5

Calls intended for `ArrayTools.clone` were being routed to
`DynamicTools.clone` due to the order of `using` statements in
`imports.hx`. This caused the pause menu to break due to arrays
becoming fubar (missing length property).

Using `DynamicTools` is a little dangerous, so remove it in favor
of calling `Reflect.copy` directly.
This commit is contained in:
Mike Welsh 2024-03-05 23:21:57 -08:00
parent c98870e923
commit a516e9199f
3 changed files with 2 additions and 17 deletions

View file

@ -13,7 +13,6 @@ using Lambda;
using StringTools;
using funkin.util.tools.ArraySortTools;
using funkin.util.tools.ArrayTools;
using funkin.util.tools.DynamicTools;
using funkin.util.tools.FloatTools;
using funkin.util.tools.Int64Tools;
using funkin.util.tools.IntTools;

View file

@ -4530,14 +4530,14 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
{
// Create an event and place it in the chart.
// TODO: Figure out configuring event data.
var newEventData:SongEventData = new SongEventData(cursorSnappedMs, eventKindToPlace, eventDataToPlace.clone());
var newEventData:SongEventData = new SongEventData(cursorSnappedMs, eventKindToPlace, Reflect.copy(eventDataToPlace));
performCommand(new AddEventsCommand([newEventData], FlxG.keys.pressed.CONTROL));
}
else
{
// Create a note and place it in the chart.
var newNoteData:SongNoteData = new SongNoteData(cursorSnappedMs, cursorColumn, 0, noteKindToPlace.clone());
var newNoteData:SongNoteData = new SongNoteData(cursorSnappedMs, cursorColumn, 0, Reflect.copy(noteKindToPlace));
performCommand(new AddNotesCommand([newNoteData], FlxG.keys.pressed.CONTROL));

View file

@ -1,14 +0,0 @@
package funkin.util.tools;
class DynamicTools
{
/**
* Creates a full clone of the input `Dynamic`. Only guaranteed to work on anonymous structures.
* @param input The `Dynamic` to clone.
* @return A clone of the input `Dynamic`.
*/
public static function clone(input:Dynamic):Dynamic
{
return Reflect.copy(input);
}
}