diff --git a/WORK.md b/WORK.md index 1616f3d..94a965b 100644 --- a/WORK.md +++ b/WORK.md @@ -9,5 +9,4 @@ * gamepad support * screen gamepad on mobiles * resize render on mobiles -* [bug] map load on linux * [bug] game progress broken diff --git a/src/common/haxe/ru/m/tankz/util/LevelUtil.hx b/src/common/haxe/ru/m/tankz/util/LevelUtil.hx index 05b37de..5b3110b 100644 --- a/src/common/haxe/ru/m/tankz/util/LevelUtil.hx +++ b/src/common/haxe/ru/m/tankz/util/LevelUtil.hx @@ -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); } }