[common] fix load old level format

This commit is contained in:
2019-06-20 11:16:17 +03:00
parent db0adbac30
commit 1b36016a1a
2 changed files with 4 additions and 4 deletions

View File

@@ -9,5 +9,4 @@
* gamepad support
* screen gamepad on mobiles
* resize render on mobiles
* [bug] map load on linux
* [bug] game progress broken

View File

@@ -40,7 +40,10 @@ class LevelUtil {
}
public static function loads(data:String):LevelConfig {
try {
// If first char is digit load as old format
if (Std.parseInt(data.charAt(0)) != null) {
return loadsOld(data);
} else {
var obj:LevelSource = Yaml.parse(data, Parser.options().useObjects());
return {
data: obj.data.split('').map(function(c) return Std.parseInt(c)),
@@ -48,8 +51,6 @@ class LevelUtil {
name: obj.name,
size: obj.size,
}
} catch (error:Dynamic) {
return loadsOld(data);
}
}