Hello community, here is the log from the commit of package nml for openSUSE:Factory checked in at 2013-01-07 17:27:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nml (Old) and /work/SRC/openSUSE:Factory/.nml.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "nml", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/nml/nml.changes 2012-11-03 21:30:59.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.nml.new/nml.changes 2013-01-07 17:27:12.000000000 +0100 @@ -1,0 +2,6 @@ +Sat Dec 29 10:50:06 UTC 2012 - s...@ammler.ch + +- update to 0.2.4 (OpenGFX 0.4.6.1) + (check changelog.txt) + +------------------------------------------------------------------- Old: ---- nml-0.2.3.src.tar.gz New: ---- nml-0.2.4.src.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nml.spec ++++++ --- /var/tmp/diff_new_pack.bHyxrT/_old 2013-01-07 17:27:13.000000000 +0100 +++ /var/tmp/diff_new_pack.bHyxrT/_new 2013-01-07 17:27:13.000000000 +0100 @@ -17,7 +17,7 @@ Name: nml -Version: 0.2.3 +Version: 0.2.4 Release: 0 Summary: NewGRF Meta Language License: GPL-2.0+ ++++++ nml-0.2.3.src.tar.gz -> nml-0.2.4.src.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.2.3/PKG-INFO new/nml-0.2.4/PKG-INFO --- old/nml-0.2.3/PKG-INFO 2012-02-19 20:51:51.000000000 +0100 +++ new/nml-0.2.4/PKG-INFO 2012-10-14 23:24:20.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: nml -Version: 0.2.3 +Version: 0.2.4 Summary: A tool to compile nml files to grf or nfo files Home-page: http://dev.openttdcoop.org/projects/nml Author: NML Development Team diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.2.3/docs/changelog.txt new/nml-0.2.4/docs/changelog.txt --- old/nml-0.2.3/docs/changelog.txt 2012-02-19 20:44:40.000000000 +0100 +++ new/nml-0.2.4/docs/changelog.txt 2012-10-14 23:22:42.000000000 +0200 @@ -1,6 +1,29 @@ +0.2.4 (2012-10-14) +------------------------------------------------------------------------ +- Feature: Report NML line information as well as pixel position for pure white pixels. Also, report number of pixels in the sprite, instead of the whole image. (issue #4029) +- Feature: 'signals' callback for railtypes. +- Feature: Allow the 'nfo' unit to be used with non-constant values. (issue #3828) +- Feature: 'build_prod_change' callback for industries to set industry production level on construction. +- Feature: Constant CB_RESULT_REFIT_COST_MASK +- Feature: Vehicle misc_flag VEHTYPE_FLAG_NO_BREAKDOWN_SMOKE. +- Feature: 'current_max_speed' variable for vehicles. (issue #3979) +- Feature: 'vehicle_is_in_depot' variable for aircraft. +- Feature: 'range' property and callback for aircraft. +- Feature: 'production_rate_1/2' variables for industries. +- Feature: 'town_zone' variable for railtypes. +- Feature: 'other_veh_(curv_info|is_hidden|x_offset|y_offset|z_offset)' variables for vehicles. +- Fix: Provide a proper error message when running out of action2 IDs +- Fix: A '{' at the end of a string could cause a crash +- Fix: Backslash-escapes in strings weren't properly validated. Also remove useless \n escape. (issue #3636) +- Fix: Provide a proper error message if a substring is missing, instead of an assertion error. (issue #3932) +- Fix: 'refit_cost' callback may also be called from the purchase menu. +- Fix: Allow using constants > 255 as variable parameter. (issue #4086) +- Fix: Sprite layout register code contained an unsorted iteration over dictionary keys, resulting in possible regression failures. + + 0.2.3 (2012-02-19) ------------------------------------------------------------------------ -- Add: Action5 for tunnel portals +- Feature: Action5 for tunnel portals - Fix: Properly catch out-of-bounds image reads (issue #3666) - Fix: Character code 0xA0 (NBSP) is used for an up arrow in TTD, so don't write it as ascii. Force unicode instead (issue #3643) @@ -8,9 +31,9 @@ 0.2.2 (2012-01-29) ------------------------------------------------------------------------ -- Add: support for (optional) url-information in the grf-block -- Add: names for newly defined cargo classes: CC_POWDERIZED and CC_NEO_BULK -- Add: clean target to Makefile in main dir and let make clean remove regression/parsetab.py +- Feature: support for (optional) url-information in the grf-block +- Feature: names for newly defined cargo classes: CC_POWDERIZED and CC_NEO_BULK +- Feature: clean target to Makefile in main dir and let make clean remove regression/parsetab.py - Fix: don't crash when a line in custom_tags.txt is missing a colon delimiter - Fix: each action4 is limited to 255 strings. Write multiple actions when we have more than that - Fix: groff warning about manpage @@ -24,7 +47,7 @@ 0.2.1 (2011-12-18) ------------------------------------------------------------------------ -- Add: CB_RESULT_NO_MORE_ARTICULATED_PARTS, CB_RESULT_REVERSED_VEHICLE +- Feature: CB_RESULT_NO_MORE_ARTICULATED_PARTS, CB_RESULT_REVERSED_VEHICLE and CB_RESULT_NO_TEXT as constants to make porting projects to NML 0.3 easier. - Fix: Internal error when the ID in a replace-block was not a compile-time constant diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.2.3/docs/readme.txt new/nml-0.2.4/docs/readme.txt --- old/nml-0.2.3/docs/readme.txt 2012-02-19 20:44:40.000000000 +0100 +++ new/nml-0.2.4/docs/readme.txt 2012-10-14 23:22:42.000000000 +0200 @@ -1,6 +1,6 @@ NML readme -Last updated: 2012-02-19 -Release version: 0.2.3 +Last updated: 2012-10-14 +Release version: 0.2.4 ------------------------------------------------------------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.2.3/nml/__version__.py new/nml-0.2.4/nml/__version__.py --- old/nml-0.2.3/nml/__version__.py 2012-02-19 20:51:51.000000000 +0100 +++ new/nml-0.2.4/nml/__version__.py 2012-10-14 23:24:20.000000000 +0200 @@ -1,2 +1,2 @@ # this file is autogenerated by setup.py -version = "0.2.3 (5f2c23ef5e1f)" +version = "0.2.4 (abf432e8d9f8)" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.2.3/nml/actions/action0properties.py new/nml-0.2.4/nml/actions/action0properties.py --- old/nml-0.2.3/nml/actions/action0properties.py 2012-02-19 20:44:40.000000000 +0100 +++ new/nml-0.2.4/nml/actions/action0properties.py 2012-10-14 23:22:42.000000000 +0200 @@ -351,6 +351,7 @@ 'non_refittable_cargo_classes' : {'size': 2, 'num': 0x19}, 'introduction_date' : {'size': 4, 'num': 0x1A}, 'cargo_age_period' : {'size': 2, 'num': 0x1C}, + 'range' : {'size': 2, 'num': 0x1F}, } properties[0x03].update(general_veh_props) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.2.3/nml/actions/action2.py new/nml-0.2.4/nml/actions/action2.py --- old/nml-0.2.3/nml/actions/action2.py 2012-02-19 20:44:40.000000000 +0100 +++ new/nml-0.2.4/nml/actions/action2.py 2012-10-14 23:22:42.000000000 +0200 @@ -60,7 +60,10 @@ if self.num_refs == 0: self.id = free_action2_ids[0] else: - self.id = free_action2_ids.pop() + try: + self.id = free_action2_ids.pop() + except IndexError: + raise generic.ScriptError("Unable to allocate ID for [random]switch, sprite set/layout/group or produce-block. Try reducing the number of such blocks.") def write_sprite_start(self, file, size): assert self.num_refs == 0, "Action2 reference counting has %d dangling references." % self.num_refs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.2.3/nml/actions/action2layout.py new/nml-0.2.4/nml/actions/action2layout.py --- old/nml-0.2.3/nml/actions/action2layout.py 2012-02-19 20:44:40.000000000 +0100 +++ new/nml-0.2.4/nml/actions/action2layout.py 2012-10-14 23:22:42.000000000 +0200 @@ -228,7 +228,7 @@ return self.params[name]['register'] def get_all_registers(self): - return [self.get_register(name) for name in self.params if self.get_register(name) is not None] + return [self.get_register(name) for name in sorted(self.params) if self.get_register(name) is not None] def create_register(self, name, value): if isinstance(value, expression.StorageOp) and value.name == "LOAD_TEMP" and isinstance(value.register, expression.ConstantNumeric): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.2.3/nml/actions/action2var.py new/nml-0.2.4/nml/actions/action2var.py --- old/nml-0.2.3/nml/actions/action2var.py 2012-02-19 20:44:40.000000000 +0100 +++ new/nml-0.2.4/nml/actions/action2var.py 2012-10-14 23:22:42.000000000 +0200 @@ -641,12 +641,11 @@ # Default function to extract parameters param, extra_params = action2var_variables.default_60xvar(name, args, pos, info) - if isinstance(param, expression.ConstantNumeric): - var = expression.Variable(expression.ConstantNumeric(info['var']), expression.ConstantNumeric(info['start']), \ + if isinstance(param, expression.ConstantNumeric) and (0 <= param.value <= 255): + res = expression.Variable(expression.ConstantNumeric(info['var']), expression.ConstantNumeric(info['start']), \ expression.ConstantNumeric((1 << info['size']) - 1), param, pos) - var.extra_params.extend(extra_params) - return var + res.extra_params.extend(extra_params) else: # Make use of var 7B to pass non-constant parameters var = expression.Variable(expression.ConstantNumeric(0x7B), expression.ConstantNumeric(info['start']), \ @@ -654,7 +653,11 @@ var.extra_params.extend(extra_params) # Set the param in the accumulator beforehand - return expression.BinOp(nmlop.VAL2, param, var, pos) + res = expression.BinOp(nmlop.VAL2, param, var, pos) + + if 'value_function' in info: + res = info['value_function'](res, info) + return res def parse_minmax(value, unit_str, action_list, act6, offset): """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.2.3/nml/actions/action2var_variables.py new/nml-0.2.4/nml/actions/action2var_variables.py --- old/nml-0.2.3/nml/actions/action2var_variables.py 2012-02-19 20:44:40.000000000 +0100 +++ new/nml-0.2.4/nml/actions/action2var_variables.py 2012-10-14 23:22:42.000000000 +0200 @@ -45,8 +45,6 @@ """ if len(args) != 1: raise generic.ScriptError("'%s'() requires one argument, encountered %d" % (name, len(args)), pos) - if isinstance(args[0], expression.ConstantNumeric): - generic.check_range(args[0].value, 0, 255, "Argument of '%s'" % name, args[0].pos) return (args[0], []) def signextend(var, info): @@ -136,8 +134,9 @@ varact2vars_trains = { #0x4786 / 0x10000 is an approximation of 3.5790976, the conversion factor #for train speed - 'max_speed' : {'var': 0x98, 'start': 0, 'size': 16, 'function': lambda var, info: muldiv(var, 0x4786, 0x10000)}, - 'current_speed' : {'var': 0xB4, 'start': 0, 'size': 16, 'function': lambda var, info: muldiv(var, 0x4786, 0x10000)}, + 'max_speed' : {'var': 0x98, 'start': 0, 'size': 16, 'function': lambda var, info: muldiv(var, 0x4786, 0x10000)}, + 'current_speed' : {'var': 0xB4, 'start': 0, 'size': 16, 'function': lambda var, info: muldiv(var, 0x4786, 0x10000)}, + 'current_max_speed' : {'var': 0x4C, 'start': 0, 'size': 16, 'function': lambda var, info: muldiv(var, 0x4786, 0x10000)}, 'vehicle_is_in_depot' : {'var': 0xE2, 'start': 7, 'size': 1} } varact2vars_trains.update(varact2vars_vehicles) @@ -145,8 +144,9 @@ varact2vars_roadvehs = { #0x23C3 / 0x10000 is an approximation of 7.1581952, the conversion factor #for road vehicle speed - 'max_speed' : {'var': 0x98, 'start': 0, 'size': 16, 'function': lambda var, info: muldiv(var, 0x23C3, 0x10000)}, - 'current_speed' : {'var': 0xB4, 'start': 0, 'size': 16, 'function': lambda var, info: muldiv(var, 0x23C3, 0x10000)}, + 'max_speed' : {'var': 0x98, 'start': 0, 'size': 16, 'function': lambda var, info: muldiv(var, 0x23C3, 0x10000)}, + 'current_speed' : {'var': 0xB4, 'start': 0, 'size': 16, 'function': lambda var, info: muldiv(var, 0x23C3, 0x10000)}, + 'current_max_speed' : {'var': 0x4C, 'start': 0, 'size': 16, 'function': lambda var, info: muldiv(var, 0x23C3, 0x10000)}, 'vehicle_is_in_depot' : {'var': 0xE2, 'start': 0, 'size': 8, 'function': lambda var, info: expression.BinOp(nmlop.CMP_EQ, var, expression.ConstantNumeric(0xFE, var.pos))}, } varact2vars_roadvehs.update(varact2vars_vehicles) @@ -154,23 +154,41 @@ varact2vars_ships = { #0x23C3 / 0x10000 is an approximation of 7.1581952, the conversion factor #for ship speed - 'max_speed' : {'var': 0x98, 'start': 0, 'size': 16, 'function': lambda var, info: muldiv(var, 0x23C3, 0x10000)}, - 'current_speed' : {'var': 0xB4, 'start': 0, 'size': 16, 'function': lambda var, info: muldiv(var, 0x23C3, 0x10000)}, + 'max_speed' : {'var': 0x98, 'start': 0, 'size': 16, 'function': lambda var, info: muldiv(var, 0x23C3, 0x10000)}, + 'current_speed' : {'var': 0xB4, 'start': 0, 'size': 16, 'function': lambda var, info: muldiv(var, 0x23C3, 0x10000)}, + 'current_max_speed' : {'var': 0x4C, 'start': 0, 'size': 16, 'function': lambda var, info: muldiv(var, 0x23C3, 0x10000)}, 'vehicle_is_in_depot' : {'var': 0xE2, 'start': 7, 'size': 1} } varact2vars_ships.update(varact2vars_vehicles) varact2vars_aircraft = { #0x3939 / 0x1000 is an approximation of 0.279617, the conversion factor + #Note that the denominator has one less zero here! #for aircraft speed - 'max_speed' : {'var': 0x98, 'start': 0, 'size': 16, 'function': lambda var, info: muldiv(var, 0x3939, 0x1000)}, - 'current_speed' : {'var': 0xB4, 'start': 0, 'size': 16, 'function': lambda var, info: muldiv(var, 0x3939, 0x1000)}, - #No such thing as identical to vehicle_is_in_depot exists for aircraft + 'max_speed' : {'var': 0x98, 'start': 0, 'size': 16, 'function': lambda var, info: muldiv(var, 0x3939, 0x1000)}, + 'current_speed' : {'var': 0xB4, 'start': 0, 'size': 16, 'function': lambda var, info: muldiv(var, 0x3939, 0x1000)}, + 'current_max_speed' : {'var': 0x4C, 'start': 0, 'size': 16, 'function': lambda var, info: muldiv(var, 0x3939, 0x1000)}, + 'vehicle_is_in_depot' : {'var': 0xE6, 'start': 0, 'size': 8, 'function': lambda var, info: expression.BinOp(nmlop.CMP_EQ, var, expression.ConstantNumeric(0, var.pos))}, } varact2vars_aircraft.update(varact2vars_vehicles) +def signed_byte_parameter(name, args, pos, info): + # Convert to a signed byte by AND-ing with 0xFF + if len(args) != 1: + raise generic.ScriptError("%s() requires one argument, encountered %d" % (name, len(args)), pos) + if isinstance(args[0], expression.ConstantNumeric): + + generic.check_range(args[0].value, -128, 127, "parameter of %s()" % name, pos) + ret = expression.BinOp(nmlop.AND, args[0], expression.ConstantNumeric(0xFF, pos), pos).reduce() + return (ret, []) + varact2vars60x_vehicles = { - 'count_veh_id': {'var': 0x60, 'start': 0, 'size': 8}, + 'count_veh_id' : {'var': 0x60, 'start': 0, 'size': 8}, + 'other_veh_curv_info' : {'var': 0x62, 'start': 0, 'size': 4, 'param_function':signed_byte_parameter, 'value_function':signextend}, + 'other_veh_is_hidden' : {'var': 0x62, 'start': 7, 'size': 1, 'param_function':signed_byte_parameter}, + 'other_veh_x_offset' : {'var': 0x62, 'start': 8, 'size': 8, 'param_function':signed_byte_parameter, 'value_function':signextend}, + 'other_veh_y_offset' : {'var': 0x62, 'start': 16, 'size': 8, 'param_function':signed_byte_parameter, 'value_function':signextend}, + 'other_veh_z_offset' : {'var': 0x62, 'start': 24, 'size': 8, 'param_function':signed_byte_parameter, 'value_function':signextend}, } varact2vars_canals = { @@ -238,6 +256,8 @@ 'random_bits' : {'var': 0x5F, 'start': 8, 'size': 16}, 'produced_cargo_waiting_1' : {'var': 0x8A, 'start': 0, 'size': 16}, 'produced_cargo_waiting_2' : {'var': 0x8C, 'start': 0, 'size': 16}, + 'production_rate_1' : {'var': 0x8E, 'start': 0, 'size': 8}, + 'production_rate_2' : {'var': 0x8F, 'start': 0, 'size': 8}, 'production_level' : {'var': 0x93, 'start': 0, 'size': 8}, 'produced_this_month_1' : {'var': 0x94, 'start': 0, 'size': 16}, 'produced_this_month_2' : {'var': 0x96, 'start': 0, 'size': 16}, @@ -259,8 +279,6 @@ def industry_count(name, args, pos, info): if len(args) < 1 or len(args) > 2: raise generic.ScriptError("'%s'() requires between 1 and 2 argument(s), encountered %d" % (name, len(args)), pos) - if isinstance(args[0], expression.ConstantNumeric): - generic.check_range(args[0].value, 0, 255, "First argument of '%s'" % name, args[0].pos) grfid = expression.ConstantNumeric(0xFFFFFFFF) if len(args) == 1 else args[1] extra_params = [(0x100, grfid)] @@ -271,8 +289,6 @@ def industry_layout_count(name, args, pos, info): if len(args) < 2 or len(args) > 3: raise generic.ScriptError("'%s'() requires between 2 and 3 argument(s), encountered %d" % (name, len(args)), pos) - if isinstance(args[0], expression.ConstantNumeric): - generic.check_range(args[0].value, 0, 255, "First argument of '%s'" % name, args[0].pos) grfid = expression.ConstantNumeric(0xFFFFFFFF) if len(args) == 2 else args[2] @@ -284,14 +300,12 @@ def industry_town_count(name, args, pos, info): if len(args) < 1 or len(args) > 2: raise generic.ScriptError("'%s'() requires between 1 and 2 argument(s), encountered %d" % (name, len(args)), pos) - if isinstance(args[0], expression.ConstantNumeric): - generic.check_range(args[0].value, 0, 255, "First argument of '%s'" % name, args[0].pos) grfid = expression.ConstantNumeric(0xFFFFFFFF) if len(args) == 1 else args[1] extra_params = [] extra_params.append( (0x100, grfid) ) - extra_params.append( (0x101, expression.ConstantNumeric(0x0100).reduce()) ) + extra_params.append( (0x101, expression.ConstantNumeric(0x0100)) ) return (args[0], extra_params) varact2vars60x_industries = { @@ -361,11 +375,12 @@ } varact2vars_railtype = { - 'terrain_type' : {'var': 0x40, 'start': 0, 'size': 8}, - 'enhanced_tunnels': {'var': 0x41, 'start': 0, 'size': 8}, - 'level_crossing_status': {'var': 0x42, 'start': 0, 'size': 8}, - 'build_date': {'var': 0x43, 'start': 0, 'size': 32}, - 'random_bits' : {'var': 0x5F, 'start': 8, 'size': 2}, + 'terrain_type' : {'var': 0x40, 'start': 0, 'size': 8}, + 'enhanced_tunnels' : {'var': 0x41, 'start': 0, 'size': 8}, + 'level_crossing_status' : {'var': 0x42, 'start': 0, 'size': 8}, + 'build_date' : {'var': 0x43, 'start': 0, 'size': 32}, + 'town_zone' : {'var': 0x44, 'start': 0, 'size': 8}, + 'random_bits' : {'var': 0x5F, 'start': 8, 'size': 2}, } varact2vars_airporttiles = { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.2.3/nml/actions/action3_callbacks.py new/nml-0.2.4/nml/actions/action3_callbacks.py --- old/nml-0.2.3/nml/actions/action3_callbacks.py 2012-02-19 20:44:40.000000000 +0100 +++ new/nml-0.2.4/nml/actions/action3_callbacks.py 2012-10-14 23:22:42.000000000 +0200 @@ -38,7 +38,7 @@ 'start_stop' : {'type': 'cb', 'num': 0x31}, 'every_32_days' : {'type': 'cb', 'num': 0x32}, 'sound_effect' : {'type': 'cb', 'num': 0x33, 'flag_bit': 7}, - 'refit_cost' : {'type': 'cb', 'num': 0x15E}, + 'refit_cost' : {'type': 'cb', 'num': 0x15E, 'purchase': 1}, } # Trains @@ -113,6 +113,8 @@ 'mail_capacity' : {'type': 'cb', 'num': 0x36, 'var10': 0x11, 'purchase': 'purchase_mail_capacity'}, 'purchase_mail_capacity' : {'type': 'cb', 'num': 0x36, 'var10': 0x11, 'purchase': 2}, 'cargo_age_period' : {'type': 'cb', 'num': 0x36, 'var10': 0x1C}, + 'range' : {'type': 'cb', 'num': 0x36, 'var10': 0x1F, 'purchase': 'purchase_range'}, + 'purchase_range' : {'type': 'cb', 'num': 0x36, 'var10': 0x1F, 'purchase': 2}, 'rotor' : {'type': 'override'}, } callbacks[0x03].update(general_vehicle_cbs) @@ -180,6 +182,7 @@ 'colour' : {'type': 'cb', 'num': 0x14A, 'flag_bit': 11}, 'cargo_input' : {'type': 'cb', 'num': 0x14B, 'flag_bit': 12}, 'cargo_output' : {'type': 'cb', 'num': 0x14C, 'flag_bit': 13}, + 'build_prod_change' : {'type': 'cb', 'num': 0x15F, 'flag_bit': 14}, 'default' : {'type': 'cargo', 'num': None}, } @@ -239,6 +242,7 @@ 'depots' : {'type': 'cargo', 'num': 0x08}, 'fences' : {'type': 'cargo', 'num': 0x09}, 'tunnel_overlay' : {'type': 'cargo', 'num': 0x0A}, + 'signals' : {'type': 'cargo', 'num': 0x0B}, } # Airport tiles diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.2.3/nml/actions/action5.py new/nml-0.2.4/nml/actions/action5.py --- old/nml-0.2.3/nml/actions/action5.py 2012-02-19 20:44:40.000000000 +0100 +++ new/nml-0.2.4/nml/actions/action5.py 2012-10-14 23:22:42.000000000 +0200 @@ -75,7 +75,7 @@ 'AQUEDUCTS' : (0x12, 8, Action5BlockType.OFFSET), 'AUTORAIL' : (0x13, 55, Action5BlockType.OFFSET), 'FLAGS' : (0x14, 36, Action5BlockType.OFFSET), - 'OTTD_GUI' : (0x15, 162, Action5BlockType.OFFSET), + 'OTTD_GUI' : (0x15, 166, Action5BlockType.OFFSET), 'AIRPORT_PREVIEW' : (0x16, 9, Action5BlockType.OFFSET), 'RAILTYPE_TUNNELS': (0x17, 16, Action5BlockType.OFFSET), } @@ -101,7 +101,7 @@ raise generic.ScriptError("replacenew parameter 'offset' must be zero for sprite replacement type '%s'" % replaces.type, replaces.pos) elif block_type == Action5BlockType.OFFSET: if num_sprites + replaces.offset > num_required: - generic.print_warning("Exceeding the limit of %d spriets for sprite replacement type '%s', extra sprites may be ignored" % (num_required, replaces.type), replaces.pos) + generic.print_warning("Exceeding the limit of %d sprites for sprite replacement type '%s', extra sprites may be ignored" % (num_required, replaces.type), replaces.pos) if replaces.offset != 0 or num_sprites != num_required: offset = replaces.offset else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.2.3/nml/ast/item.py new/nml-0.2.4/nml/ast/item.py --- old/nml-0.2.3/nml/ast/item.py 2012-02-19 20:44:40.000000000 +0100 +++ new/nml-0.2.4/nml/ast/item.py 2012-10-14 23:22:42.000000000 +0200 @@ -128,7 +128,7 @@ def pre_process(self): self.value = self.value.reduce(global_constants.const_list, unknown_id_fatal = False) - if self.unit is not None and not (isinstance(self.value, expression.ConstantNumeric) or isinstance(self.value, expression.ConstantFloat)): + if (self.unit is not None and self.unit.type != 'nfo') and not (isinstance(self.value, expression.ConstantNumeric) or isinstance(self.value, expression.ConstantFloat)): raise generic.ScriptError("Using a unit for a property is only allowed if the value is constant", self.pos) def debug_print(self, indentation): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.2.3/nml/global_constants.py new/nml-0.2.4/nml/global_constants.py --- old/nml-0.2.3/nml/global_constants.py 2012-02-19 20:44:40.000000000 +0100 +++ new/nml-0.2.4/nml/global_constants.py 2012-10-14 23:22:42.000000000 +0200 @@ -146,23 +146,28 @@ 'TRAIN_FLAG_MU' : 2, 'TRAIN_FLAG_FLIP' : 3, 'TRAIN_FLAG_AUTOREFIT': 4, + 'TRAIN_FLAG_NO_BREAKDOWN_SMOKE': 6, #roadveh misc flags 'ROADVEH_FLAG_TRAM' : 0, 'ROADVEH_FLAG_2CC' : 1, 'ROADVEH_FLAG_AUTOREFIT': 4, + 'ROADVEH_FLAG_NO_BREAKDOWN_SMOKE': 6, #ship misc flags 'SHIP_FLAG_2CC' : 1, 'SHIP_FLAG_AUTOREFIT': 4, + 'SHIP_FLAG_NO_BREAKDOWN_SMOKE': 6, #aircrafts misc flags 'AIRCRAFT_FLAG_2CC' : 1, 'AIRCRAFT_FLAG_AUTOREFIT': 4, + 'AIRCRAFT_FLAG_NO_BREAKDOWN_SMOKE': 6, #for those, who can't tell the difference between a train and an aircraft: 'VEHICLE_FLAG_2CC' : 1, 'VEHICLE_FLAG_AUTOREFIT': 4, + 'VEHICLE_FLAG_NO_BREAKDOWN_SMOKE': 6, #Graphic flags for waterfeatures 'WATERFEATURE_ALTERNATIVE_SPRITES' : 0, @@ -196,6 +201,7 @@ 'CB_RESULT_COLOUR_MAPPING_ADD_CC' : 0x4000, 'CB_RESULT_AUTOREFIT' : 0x4000, + 'CB_RESULT_REFIT_COST_MASK' : 0x3FFF, 'CB_RESULT_NO_SOUND' : 0x7EFF, # Never a valid sound id diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.2.3/nml/grfstrings.py new/nml-0.2.4/nml/grfstrings.py --- old/nml-0.2.3/nml/grfstrings.py 2012-02-19 20:44:40.000000000 +0100 +++ new/nml-0.2.4/nml/grfstrings.py 2012-10-14 23:22:42.000000000 +0200 @@ -56,7 +56,7 @@ return False i += 1 else: - if string[i+1] in ('\\', 'n', '"'): + if string[i+1] in ('\\', '"'): i += 2 elif string[i+1] == 'U': return False @@ -94,7 +94,7 @@ size += utf8_get_size(ord(string[i])) i += 1 else: - if string[i+1] in ('\\', 'n', '"'): + if string[i+1] in ('\\', '"'): size += 1 i += 2 elif string[i+1] == 'U': @@ -157,6 +157,9 @@ if not isinstance(val, (nml.expression.StringLiteral, nml.expression.String)): raise generic.ScriptError("Expected a (literal) string", val.pos) if isinstance(val, nml.expression.String): + # Check that the string exists + if val.name.value not in default_lang.strings: + raise generic.ScriptError("Substring \"%s\" does not exist" % val.name.value, val.pos) return get_translation(val, lang_id) return val.value @@ -396,8 +399,44 @@ def get_arg_size(self): return commands[self.name]['size'] +# Characters that are valid in hex numbers +VALID_HEX = "0123456789abcdefABCDEF" +def is_valid_hex(string): + return all(c in VALID_HEX for c in string) + +def validate_escapes(string, pos): + """ + Validate that all escapes (starting with a backslash) are correct. + When an invalid escape is encountered, an error is thrown + + @param string: String to validate + @type string: C{unicode} + + @param pos: Position information + @type pos: L{Position} + """ + i = 0 + while i < len(string): + # find next '\' + i = string.find('\\', i) + if i == -1: break + + if i+1 >= len(string): + raise generic.ScriptError("Unexpected end-of-line encountered after '\\'", pos) + if string[i+1] in ('\\', '"'): + i += 2 + elif string[i+1] == 'U': + if i+5 >= len(string) or not is_valid_hex(string[i+2:i+6]): + raise generic.ScriptError("Expected 4 hexadecimal characters after '\\U'", pos) + i += 6 + else: + if i+2 >= len(string) or not is_valid_hex(string[i+1:i+3]): + raise generic.ScriptError("Expected 2 hexadecimal characters after '\\'", pos) + i += 3 + class NewGRFString(object): def __init__(self, string, lang, strip_choice_lists, pos): + validate_escapes(string, pos) self.string = string self.cases = {} self.components = [] @@ -415,6 +454,8 @@ start = idx + 1 end = start cmd_pos = None + if start >= len(string): + raise generic.ScriptError("Expected '}' before end-of-line.", pos) if string[start].isdigit(): while end < len(string) and string[end].isdigit(): end += 1 if end == len(string) or string[end] != ':': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.2.3/nml/output_grf.py new/nml-0.2.4/nml/output_grf.py --- old/nml-0.2.3/nml/output_grf.py 2012-02-19 20:44:40.000000000 +0100 +++ new/nml-0.2.4/nml/output_grf.py 2012-10-14 23:22:42.000000000 +0200 @@ -131,8 +131,8 @@ white_pixels += 1 if white_pixels != 0: pixels = sprite.size[0] * sprite.size[1] - pos = generic.PixelPosition(sprite_info.file.value, x, y) - generic.print_warning("%i of %i pixels (%i%%) are pure white" % (white_pixels, pixels, white_pixels * 100 / pixels), pos) + image_pos = generic.PixelPosition(sprite_info.file.value, x, y) + generic.print_warning("%s: %i of %i pixels (%i%%) are pure white" % (str(image_pos), white_pixels, pixels, white_pixels * 100 / pixels), sprite_info.file.pos) self.wsprite(sprite, sprite_info.xrel.value, sprite_info.yrel.value, sprite_info.compression.value, im_pal) def print_empty_realsprite(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.2.3/nml.egg-info/PKG-INFO new/nml-0.2.4/nml.egg-info/PKG-INFO --- old/nml-0.2.3/nml.egg-info/PKG-INFO 2012-02-19 20:51:51.000000000 +0100 +++ new/nml-0.2.4/nml.egg-info/PKG-INFO 2012-10-14 23:24:20.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: nml -Version: 0.2.3 +Version: 0.2.4 Summary: A tool to compile nml files to grf or nfo files Home-page: http://dev.openttdcoop.org/projects/nml Author: NML Development Team Files old/nml-0.2.3/regression/expected/026_asl.grf and new/nml-0.2.4/regression/expected/026_asl.grf differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.2.3/regression/expected/026_asl.nfo new/nml-0.2.4/regression/expected/026_asl.nfo --- old/nml-0.2.3/regression/expected/026_asl.nfo 2012-02-19 20:44:40.000000000 +0100 +++ new/nml-0.2.4/regression/expected/026_asl.nfo 2012-10-14 23:22:42.000000000 +0200 @@ -29,16 +29,16 @@ // Name: layout2 - feature 0F 7 * 37 02 0F FE \b66 \dx00000000 \wx0000 \dx80000000 \wx0002 \b0 \b0 \b0 \b16 \b16 \b16 80 -\dx80000000 \wx0003 \b0 \b0 \b0 \b16 \b16 \b16 82 81 +\dx80000000 \wx0003 \b0 \b0 \b0 \b16 \b16 \b16 81 82 // Name: layout2@registers - feature 0F 8 * 66 02 0F FE 89 43 20 \dx000000FF \2sto 1A 20 \dx00000080 -\2r 1A 20 \dx00000001 -\2sto 1A 20 \dx00000081 \2r 62 00 29 \dx00000001 \2^ 1A 20 \dx00000001 +\2sto 1A 20 \dx00000081 +\2r 1A 20 \dx00000001 \2sto 1A 00 \dx00000082 \b1 \wx00FE \dx00000000 \dx00000000 @@ -53,16 +53,16 @@ // Name: layout2 - feature 11 13 * 37 02 11 FD \b66 \dx00000000 \wx0000 \dx80000000 \wx0002 \b0 \b0 \b0 \b16 \b16 \b16 80 -\dx80000000 \wx0003 \b0 \b0 \b0 \b16 \b16 \b16 82 81 +\dx80000000 \wx0003 \b0 \b0 \b0 \b16 \b16 \b16 81 82 // Name: layout2@registers - feature 11 14 * 66 02 11 FD 89 44 20 \dx000000FF \2sto 1A 20 \dx00000080 -\2r 1A 20 \dx00000001 -\2sto 1A 20 \dx00000081 \2r 60 00 29 \dx00000001 \2^ 1A 20 \dx00000001 +\2sto 1A 20 \dx00000081 +\2r 1A 20 \dx00000001 \2sto 1A 00 \dx00000082 \b1 \wx00FD \dx00000000 \dx00000000 -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org