Index: nacltoons/data/res/validate.lua |
diff --git a/nacltoons/data/res/validate.lua b/nacltoons/data/res/validate.lua |
index 1c40683a1ef0037fa1343759d306c20e8c18161b..5928dc957ace3eaf8083c52fa989df6aec48e4bf 100644 |
--- a/nacltoons/data/res/validate.lua |
+++ b/nacltoons/data/res/validate.lua |
@@ -93,16 +93,25 @@ validate.ValidateLevelDef = function(filename, gamedef, leveldef) |
CheckValidKeys(filename, leveldef, { 'num_stars', 'shapes', 'sprites', 'script' }) |
if leveldef.shapes then |
- local valid_keys = { 'start', 'finish', 'color', 'type', 'anchor', 'tag', 'dynamic' } |
- local valid_types = { 'line', 'edge' } |
+ local valid_keys = { 'pos', 'children', 'start', 'finish', 'color', 'type', 'anchor', 'tag', 'dynamic' } |
+ local valid_types = { 'compound', 'line', 'edge' } |
local required_keys = { 'type' } |
- for _, shape in pairs(leveldef.shapes) do |
- CheckValidKeys(filename, shape, valid_keys) |
- CheckRequiredKeys(filename, shape, required_keys, 'shape') |
- if not ListContains(valid_types, shape.type) then |
- Err('invalid shape type: ' .. shape.type) |
+ |
+ local function ValidateShapeList(shapes) |
+ for _, shape in pairs(shapes) do |
+ if #shape > 0 then |
+ ValidateShapeList(shape) |
+ else |
+ CheckValidKeys(filename, shape, valid_keys) |
+ CheckRequiredKeys(filename, shape, required_keys, 'shape') |
+ if not ListContains(valid_types, shape.type) then |
+ Err('invalid shape type: ' .. shape.type) |
+ end |
+ end |
end |
end |
+ |
+ ValidateShapeList(leveldef.shapes) |
end |
if leveldef.sprites then |