From b5284f99ae359f3ecf4bcee954f589d9074f4745 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Fri, 19 Aug 2022 21:18:28 +0000 Subject: [PATCH] fix crash when spaces are in puzzle pack name --- .../flixel-desktop-habit-puzzle-game/source/HabitState.hx | 1 + .../source/HabitState.kiss | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) 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