Added the optional parameter "limit(\d+,\d+)", to specify the range of the value's attribute
Added, partly, toplevel [terrain_type] tag
This commit is contained in:
parent
98833e2b5b
commit
42d4ae9109
2 changed files with 49 additions and 15 deletions
|
@ -6,12 +6,8 @@
|
|||
integer="re ^(\+|-)?[0-9]+$"
|
||||
float="re ^(\+|-)?[0-9]+(\.[0-9]*)?$"
|
||||
boolean="enum true,false,yes,no,on,off"
|
||||
# slash-separated filenames
|
||||
path="re ^([a-zA-Z0-9_\-.+]+/)*[a-zA-Z0-9_\-.+]+(~(TC|RC|PAL|FL|GS|CS|CROP|SCALE|BL|O|R|G|B|NOP|RIGHT)\(.*\))*$"
|
||||
#TODO: imagepath, remove imagepathfunctions from path
|
||||
# comma-separated paths
|
||||
pathlist="re ^(([a-zA-Z0-9_\-.+]+/)*[a-zA-Z0-9_\-.+]+(~(TC|RC|PAL|FL|GS|CS|CROP|SCALE|BL|O|R|G|B|NOP|RIGHT)\(.*\))*,)*([a-zA-Z0-9_\-.+]+/)*[a-zA-Z0-9_\-.+]+(~(TC|RC|PAL|FL|GS|CS|CROP|SCALE|BL|O|R|G|B|NOP|RIGHT)\(.*\))*$"
|
||||
#TODO: imagepathlist, same as above
|
||||
pathimage="re ^([a-zA-Z0-9_\-.+]+/)*[a-zA-Z0-9_\-.+]+(~(TC|RC|PAL|FL|GS|CS|CROP|SCALE|BL|O|R|G|B|NOP|RIGHT)\(.*\))*$" # TODO: Some 'path' must be changed to 'pathimage'
|
||||
path="re ^[a-zA-Z0-9_\-.+\/]*[a-zA-Z0-9_\-.+]$"
|
||||
[root]
|
||||
# All possible root elements
|
||||
_about="repeated about"
|
||||
|
@ -29,7 +25,8 @@
|
|||
_theme="repeated theme"
|
||||
_units="optional units"
|
||||
_section="optional section"
|
||||
_topic="repeated topic" # TODO: Somehow, has to say that depends on the 'section'
|
||||
_topic="repeated topic" # TODO: Somehow, has to say that depends on the 'section'
|
||||
_terrain_type="repeated terrain_type"
|
||||
[/root]
|
||||
|
||||
[about]
|
||||
|
@ -47,7 +44,7 @@
|
|||
[description]
|
||||
text="_ -images is a list of the background images for the credits"
|
||||
[/description]
|
||||
images="optional string" #TODO: should be a list of paths
|
||||
images="optional path list"
|
||||
[/about-campaign:about]
|
||||
about_preference_type="enum boolean,int"
|
||||
[advanced_preference]
|
||||
|
@ -92,7 +89,7 @@
|
|||
difficulty_descriptions="required string" #TODO: this one's especially complicated
|
||||
extra_defines="optional string list"
|
||||
first_scenario="required identifier"
|
||||
icon="optional path"
|
||||
icon="optional pathimage"
|
||||
id="required string"
|
||||
image="optional path"
|
||||
name="required string translatable"
|
||||
|
@ -120,7 +117,7 @@
|
|||
[fonts]
|
||||
_font="repeated font"
|
||||
|
||||
order="required string list" #TODO: should be a list of paths
|
||||
order="required path list"
|
||||
[/fonts]
|
||||
# this is a list of path:integer
|
||||
flag_image_type="re ^((([a-zA-Z0-9_\-.+]+/)*[a-zA-Z0-9_\-.+]+):[0-9]+,)*(([a-zA-Z0-9_\-.+]+/)*[a-zA-Z0-9_\-.+]+):[0-9]+$"
|
||||
|
@ -137,8 +134,8 @@
|
|||
buttons_y="optional integer"
|
||||
buttons_padding="optional integer"
|
||||
cross_image="required path"
|
||||
default_defeat_music="required pathlist"
|
||||
default_victory_music="required pathlist"
|
||||
default_defeat_music="required path list"
|
||||
default_victory_music="required path list"
|
||||
#defense_color_scale="
|
||||
ellipsis_image="required path"
|
||||
enemy_ball_image="required path"
|
||||
|
@ -146,7 +143,7 @@
|
|||
flag_icon_image="required path"
|
||||
flag_image="required flag_image_type"
|
||||
flag_rgb="optional identifier"
|
||||
footprint_prefix="required pathlist"
|
||||
footprint_prefix="required path list"
|
||||
footprint_teleport_enter="required path"
|
||||
footprint_teleport_exit="required path"
|
||||
grid_image="required path"
|
||||
|
@ -171,7 +168,7 @@
|
|||
tip_padding="required integer"
|
||||
tip_width="required integer"
|
||||
tip_x="required integer"
|
||||
title="required pathlist"
|
||||
title="required path list"
|
||||
title_music="required path" #maybe list
|
||||
tod_bright_image="required path"
|
||||
unmoved_ball_image="required path"
|
||||
|
@ -327,7 +324,7 @@
|
|||
alignment="optional alignments" # required
|
||||
cost="optional integer" # required
|
||||
description="optional string translatable"
|
||||
die_sound="optional pathlist"
|
||||
die_sound="optional path list"
|
||||
do_not_list="optional boolean"
|
||||
ellipse="optional path"
|
||||
experience="optional integer" # required
|
||||
|
@ -354,6 +351,34 @@
|
|||
inherit="optional boolean"
|
||||
variation_name="required identifier"
|
||||
[/variation:unit_type]
|
||||
[terrain_type]
|
||||
symbol_image="required path"
|
||||
editor_image="optional path"
|
||||
id="required string"
|
||||
name="required string translatable"
|
||||
description="optional string translatable"
|
||||
editor_name="optional string"
|
||||
string="required string"
|
||||
# TODO: unit_height_adjust=...
|
||||
submerge="optional float limit(0,1)"
|
||||
light="optional integer"
|
||||
max_light="optional integer"
|
||||
min_light="optional integer"
|
||||
heals="forbidden integer"
|
||||
gives_income="optional boolean"
|
||||
recruit_onto="optional boolean"
|
||||
recruit_from="optional boolean"
|
||||
# TODO: aliasof=...
|
||||
# TODO: def_alias=...
|
||||
# TODO: mvt_alias=...
|
||||
# TODO: income_description=...
|
||||
# TODO: income_description_ally=...
|
||||
# TODO: income_description_enemy=...
|
||||
# TODO: income_description_own=...
|
||||
editor_group="required string list"
|
||||
hidden="optional boolean"
|
||||
hide_help="optional boolean"
|
||||
[/terrain_type]
|
||||
[/schema]
|
||||
|
||||
## Things that still need to be converted, in a similar format.
|
||||
|
|
|
@ -81,6 +81,15 @@ class Validator:
|
|||
elif 'translatable' not in attribute.optionals and 'optional-translatable' not in attribute.optionals and match.is_translatable() == True:
|
||||
self.validate_result_add(node.file, node.line, "Attribute [%s] %s" % (verbosename, attribute.name), "Value isn't translatable, but have a _ at the beginning")
|
||||
|
||||
regex_limit = re.compile(ur'^limit\((\d+.\d+|\d+),(\d+.\d+|\d+)\)$')
|
||||
checklimit = [i for i in attribute.optionals if regex_limit.search(i)]
|
||||
if len(checklimit):
|
||||
checklimit = checklimit[0]
|
||||
number_min, number_max = regex_limit.search(checklimit).groups()
|
||||
|
||||
if float(match.data) > float(number_max) or float(match.data) < float(number_min):
|
||||
self.validate_result_add(node.file, node.line, "Attribute [%s] %s" % (verbosename, attribute.name), "Value must be between %s and %s, found : %s" % (number_min, number_max, match.data))
|
||||
|
||||
if 'list' in attribute.optionals:
|
||||
pos = 1
|
||||
for i in match.data.split(","):
|
||||
|
|
Loading…
Add table
Reference in a new issue