Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1936)

Unified Diff: nacltoons/data/res/validate.lua

Issue 15070003: [nacltoons] Add compound shapes. (Closed) Base URL: https://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698