[common] fix load old level format
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user