diff --git a/projects/flixel-desktop-habit-puzzle-game/source/HabitState.hx b/projects/flixel-desktop-habit-puzzle-game/source/HabitState.hx index 89f1bc20..f5d207ed 100644 --- a/projects/flixel-desktop-habit-puzzle-game/source/HabitState.hx +++ b/projects/flixel-desktop-habit-puzzle-game/source/HabitState.hx @@ -1,5 +1,6 @@ package; +using StringTools; import flash.display.BitmapData; import haxe.io.Path; import flixel.FlxG; diff --git a/projects/flixel-desktop-habit-puzzle-game/source/HabitState.kiss b/projects/flixel-desktop-habit-puzzle-game/source/HabitState.kiss index 66b3c186..4cca5309 100644 --- a/projects/flixel-desktop-habit-puzzle-game/source/HabitState.kiss +++ b/projects/flixel-desktop-habit-puzzle-game/source/HabitState.kiss @@ -249,9 +249,14 @@ FlxColor.GRAY ]) +(function nameForSave [:String name] + (doFor forbiddenChar (.split #"~%&\;:"',<>?# "# "") + (set name (name.replace forbiddenChar ""))) + name) + (method makeRewardSprites [m p currentRewardFile] (set save (new FlxSave)) - (save.bind currentRewardFile.path) + (assert (save.bind (nameForSave currentRewardFile.path)) "failed to bind save data") (unless save.data.storedPositions (set save.data.storedPositions (new Map))) (unless save.data.storedAngles