Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package nml for openSUSE:Factory checked in at 2023-04-18 15:52:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nml (Old) and /work/SRC/openSUSE:Factory/.nml.new.2023 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "nml" Tue Apr 18 15:52:57 2023 rev:21 rq:1080019 version:0.7.2 Changes: -------- --- /work/SRC/openSUSE:Factory/nml/nml.changes 2022-12-12 17:41:33.445745013 +0100 +++ /work/SRC/openSUSE:Factory/.nml.new.2023/nml.changes 2023-04-18 15:53:00.869462180 +0200 @@ -1,0 +2,14 @@ +Tue Apr 18 00:55:51 UTC 2023 - Jan Baier <jba...@suse.com> + +- update to 0.7.2 + * Feature: support for variant_group action 0 prop for vehicles by @andythenorth in #272 + * Add: 'tunnels' callback for road- and tramtypes by @glx22 in #273 + * Feature: Engine name callback by @michicc in #276 + * Update: reformat source with black 23.1 by @frosch123 in #278 + * Fix: By default there is no ELRL railtype. by @frosch123 in #277 + * Update: [Actions] Bump used actions versions by @glx22 in #280 + * Add: Road stops (feature 0x14) by @JGRennison in #279 + * Optimise variational action2 trivial cases by @JGRennison in #281 + * Update: changelog for 0.7.2 by @glx22 in #282 + +------------------------------------------------------------------- Old: ---- nml-0.7.1.tar.gz New: ---- nml-0.7.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nml.spec ++++++ --- /var/tmp/diff_new_pack.eUXz9Y/_old 2023-04-18 15:53:01.533466004 +0200 +++ /var/tmp/diff_new_pack.eUXz9Y/_new 2023-04-18 15:53:01.541466050 +0200 @@ -1,7 +1,7 @@ # # spec file for package nml # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: nml -Version: 0.7.1 +Version: 0.7.2 Release: 0 Summary: NewGRF Meta Language License: GPL-2.0-or-later ++++++ nml-0.7.1.tar.gz -> nml-0.7.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.7.1/PKG-INFO new/nml-0.7.2/PKG-INFO --- old/nml-0.7.1/PKG-INFO 2022-12-03 23:04:11.822486400 +0100 +++ new/nml-0.7.2/PKG-INFO 2023-04-17 21:55:21.339739000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: nml -Version: 0.7.1 +Version: 0.7.2 Summary: An OpenTTD NewGRF compiler for the nml language Home-page: https://github.com/OpenTTD/nml Author: NML Development Team diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.7.1/docs/changelog.txt new/nml-0.7.2/docs/changelog.txt --- old/nml-0.7.1/docs/changelog.txt 2022-12-03 23:03:42.000000000 +0100 +++ new/nml-0.7.2/docs/changelog.txt 2023-04-17 21:54:52.000000000 +0200 @@ -1,3 +1,23 @@ +0.7.2 (2023-04-17) +------------------------------------------------------------------------ +This release adds support for vehicle variants and the road stops. + +Support for NewGRF additions of OpenTTD 14: +- Feature: Engine name callback +- Add: Road stops (feature 0x14) (#279) + +Support for NewGRF additions of OpenTTD 13: +- Add: 'tunnels' callback for road- and tramtypes (#273) +- Feature: support extra_flags for vehicles +- Feature: support for variant_group action 0 prop for vehicles + +Other changes and fixes: +- Change: Optimise trivial right shift operations on variables +- Change: Drop binary operations with constant 0 for more operators +- Fix: By default there is no ELRL railtype. (#277) +- Change: Don't output callback flag props that are zero. + + 0.7.1 (2022-12-03) ------------------------------------------------------------------------ While writing documentation for stations, we made some small changes to the syntax. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.7.1/nml/__version__.py new/nml-0.7.2/nml/__version__.py --- old/nml-0.7.1/nml/__version__.py 2022-12-03 23:04:11.000000000 +0100 +++ new/nml-0.7.2/nml/__version__.py 2023-04-17 21:55:20.000000000 +0200 @@ -1,2 +1,2 @@ # this file is autogenerated by setup.py -version = "0.7.1" +version = "0.7.2" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.7.1/nml/actions/action0.py new/nml-0.7.2/nml/actions/action0.py --- old/nml-0.7.1/nml/actions/action0.py 2022-12-03 23:03:42.000000000 +0100 +++ new/nml-0.7.2/nml/actions/action0.py 2023-04-17 21:54:52.000000000 +0200 @@ -210,6 +210,7 @@ BlockAllocation(0, 255, "Airport Tile"), BlockAllocation(0, 62, "Roadtype"), BlockAllocation(0, 62, "Tramtype"), + BlockAllocation(0, 255, "RoadStop"), ] @@ -1079,10 +1080,10 @@ callback_flag_properties = { - 0x00: {"size": 1, "num": 0x1E}, - 0x01: {"size": 1, "num": 0x17}, - 0x02: {"size": 1, "num": 0x12}, - 0x03: {"size": 1, "num": 0x14}, + 0x00: two_byte_property(0x1E, 0x31), + 0x01: two_byte_property(0x17, 0x28), + 0x02: two_byte_property(0x12, 0x22), + 0x03: two_byte_property(0x14, 0x22), 0x04: {"size": 1, "num": 0x0B}, 0x05: {"size": 1, "num": 0x08}, 0x07: two_byte_property(0x14, 0x1D), @@ -1091,6 +1092,7 @@ 0x0B: {"size": 1, "num": 0x1A}, 0x0F: {"size": 2, "num": 0x15}, 0x11: {"size": 1, "num": 0x0E}, + 0x14: {"size": 1, "num": 0x11}, } @@ -1119,11 +1121,9 @@ if not isinstance(prop_info_list, list): prop_info_list = [prop_info_list] for prop_info in prop_info_list: - act0.prop_list.append( - Action0Property( - prop_info["num"], parse_property_value(prop_info, expression.ConstantNumeric(flags)), prop_info["size"] - ) - ) + parsed_value = parse_property_value(prop_info, expression.ConstantNumeric(flags)) + if parsed_value[0].value != 0: + act0.prop_list.append(Action0Property(prop_info["num"], parsed_value, prop_info["size"])) return [act0] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.7.1/nml/actions/action0properties.py new/nml-0.7.2/nml/actions/action0properties.py --- old/nml-0.7.1/nml/actions/action0properties.py 2022-12-03 23:03:42.000000000 +0100 +++ new/nml-0.7.2/nml/actions/action0properties.py 2023-04-17 21:54:52.000000000 +0200 @@ -168,7 +168,7 @@ # # 'required' (value doesn't matter) if the property is required for the item to be valid. -properties = 0x14 * [None] +properties = 0x15 * [None] # # Some helper functions that are used for multiple features @@ -446,6 +446,8 @@ , zero_refit_mask(0x1D) ], "curve_speed_mod": {"size": 2, "num": 0x2E, "unit_conversion": 256}, + "variant_group": {"size": 2, "num": 0x2F}, + "extra_flags": {"size": 4, "num": 0x30}, } # fmt: on @@ -522,6 +524,8 @@ {"custom_function": lambda value: ctt_list(0x25, value)}, zero_refit_mask(0x16), ], + "variant_group": {"size": 2, "num": 0x26}, + "extra_flags": {"size": 4, "num": 0x27}, } # fmt: on @@ -589,6 +593,8 @@ {"custom_function": lambda value: ctt_list(0x1F, value)}, zero_refit_mask(0x11), ], + "variant_group": {"size": 2, "num": 0x20}, + "extra_flags": {"size": 4, "num": 0x21}, } # fmt: on @@ -648,6 +654,8 @@ zero_refit_mask(0x13), ], "range": {"size": 2, "num": 0x1F}, + "variant_group": {"size": 2, "num": 0x20}, + "extra_flags": {"size": 4, "num": 0x21}, } # fmt: on @@ -1468,3 +1476,49 @@ "introduces_tramtype_list": {"custom_function": lambda x: label_list(x, 0x19, "Tramtype")}, "alternative_tramtype_list": {"custom_function": lambda x: label_list(x, 0x1D, "Tramtype")}, } + +# +# Feature 0x14 (Road stops) +# + + +class ByteSequenceProp(BaseAction0Property): + def __init__(self, prop_num, items, description, pos): + self.prop_num = prop_num + self.items = items + self.description = description + self.pos = pos + + def write(self, file): + file.print_bytex(self.prop_num) + for item in self.items: + val = item.reduce_constant().value + if val > 0xFF or val < 0: + raise generic.ScriptError(self.description + " items must be bytes", self.pos) + file.print_byte(val) + file.newline() + + def get_size(self): + return 1 + len(self.items) + + +def byte_sequence_list(value, prop_num, description, expected_count): + if not isinstance(value, Array) or len(value.values) != expected_count: + raise generic.ScriptError(description + " must be an array of " + str(expected_count) + " bytes", value.pos) + return [ByteSequenceProp(prop_num, value.values, description, value.pos)] + + +properties[0x14] = { + 'class': {'size': 4, 'num': 0x08, "first": None, "string_literal": 4}, + 'availability_type': {'size': 1, 'num': 0x09}, + 'name': {'size': 2, 'num': 0x0A, "string": 0xDC, "required": True}, + 'classname': {'size': 2, 'num': 0x0B, "string": 0xDC}, + 'draw_mode': {'size': 1, 'num': 0x0C}, + "cargo_random_triggers": {"size": 4, "num": 0x0D}, + "animation_info": {"size": 2, "num": 0x0E, "value_function": animation_info}, + "animation_speed": {"size": 1, "num": 0x0F}, + "animation_triggers": {"size": 2, "num": 0x10}, + # 11 (callback flags) is not set by user + "general_flags": {"size": 4, "num": 0x12}, + "cost_multipliers": {"custom_function": lambda x: byte_sequence_list(x, 0x15, "Cost multipliers", 2)}, +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.7.1/nml/actions/action12.py new/nml-0.7.2/nml/actions/action12.py --- old/nml-0.7.1/nml/actions/action12.py 2022-12-03 23:03:42.000000000 +0100 +++ new/nml-0.7.2/nml/actions/action12.py 2023-04-17 21:54:52.000000000 +0200 @@ -18,7 +18,6 @@ class Action12(base_action.BaseAction): - # sets: list of (font_size, num_char, base_char) tuples def __init__(self, sets): self.sets = sets diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.7.1/nml/actions/action2.py new/nml-0.7.2/nml/actions/action2.py --- old/nml-0.7.1/nml/actions/action2.py 2022-12-03 23:03:42.000000000 +0100 +++ new/nml-0.7.2/nml/actions/action2.py 2023-04-17 21:54:52.000000000 +0200 @@ -219,8 +219,8 @@ # Features using sprite groups directly: vehicles, stations, canals, cargos, railtypes, airports, roadtypes, tramtypes features_sprite_group = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x0B, 0x0D, 0x10, 0x12, 0x13] -# Features using sprite layouts: houses, industry tiles, objects and airport tiles -features_sprite_layout = [0x07, 0x09, 0x0F, 0x11] +# Features using sprite layouts: houses, industry tiles, objects, airport tiles, and road stops +features_sprite_layout = [0x07, 0x09, 0x0F, 0x11, 0x14] # All features that need sprite sets features_sprite_set = features_sprite_group + features_sprite_layout diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.7.1/nml/actions/action2var.py new/nml-0.7.2/nml/actions/action2var.py --- old/nml-0.7.1/nml/actions/action2var.py 2022-12-03 23:03:42.000000000 +0100 +++ new/nml-0.7.2/nml/actions/action2var.py 2023-04-17 21:54:52.000000000 +0200 @@ -655,7 +655,7 @@ self.var_list_size += store_tmp.get_size() + 1 # Add 1 for operator # Fill param registers with temporary variables if needed - for (src, dest) in tmp_vars: + for src, dest in tmp_vars: self.var_list.append(nmlop.VAL2) self.var_list.append(src) self.var_list.append(nmlop.STO_TMP) @@ -945,7 +945,7 @@ if feature == 0x0A: # Industries -> production action2 act2 = action2production.make_empty_production_action2(pos) - elif feature in (0x07, 0x09, 0x0F, 0x11): + elif feature in (0x07, 0x09, 0x0F, 0x11, 0x14): # Tile layout action2 act2 = action2layout.make_empty_layout_action2(feature, pos) else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.7.1/nml/actions/action2var_variables.py new/nml-0.7.2/nml/actions/action2var_variables.py --- old/nml-0.7.1/nml/actions/action2var_variables.py 2022-12-03 23:03:42.000000000 +0100 +++ new/nml-0.7.2/nml/actions/action2var_variables.py 2023-04-17 21:54:52.000000000 +0200 @@ -778,6 +778,64 @@ 'percent_transported_mail' : {'var': 0xCB, 'start': 0, 'size': 8, 'value_function': value_mul_div(101, 256)}, } +# +# Roadstops (feature road_stops) +# + +varact2vars_roadstop = { + **varact2vars_base_stations, + 'view' : {'var': 0x40, 'start': 0, 'size': 8}, + + 'stop_type' : {'var': 0x41, 'start': 0, 'size': 8}, + + 'terrain_type' : {'var': 0x42, 'start': 0, 'size': 8}, + 'tile_slope' : {'var': 0x42, 'start': 8, 'size': 5}, + + 'has_road' : {'var': 0x43, 'start': 0, 'size': 32, 'value_function': lambda var, info: nmlop.CMP_NEQ(var, 0xFFFFFFFF)}, + 'has_tram' : {'var': 0x44, 'start': 0, 'size': 32, 'value_function': lambda var, info: nmlop.CMP_NEQ(var, 0xFFFFFFFF)}, + 'road_type' : {'var': 0x43, 'start': 8, 'size': 8}, # The roadtype of this tile + 'tram_type' : {'var': 0x44, 'start': 8, 'size': 8}, # The tramtype of this tile + + 'town_manhattan_dist' : {'var': 0x45, 'start': 0, 'size': 16}, + 'town_zone' : {'var': 0x45, 'start': 16, 'size': 8}, + 'town_euclidean_dist' : {'var': 0x46, 'start': 0, 'size': 32}, + + 'company_num' : {'var': 0x47, 'start': 0, 'size': 8}, # 0..14 company number + 'company_type' : {'var': 0x47, 'start': 16, 'size': 2}, # PLAYERTYPE_HUMAN, PLAYERTYPE_AI etc. + 'company_colour1' : {'var': 0x47, 'start': 24, 'size': 4}, # COLOUR_XXX. See https://newgrf-specs.tt-wiki.net/wiki/NML:List_of_default_colour_translation_palettes#Company_colour_helper_functions + 'company_colour2' : {'var': 0x47, 'start': 28, 'size': 4}, # Same as above + + 'animation_frame' : {'var': 0x49, 'start': 0, 'size': 8}, + + 'waiting_triggers' : {'var': 0x5F, 'start': 0, 'size': 8}, + 'random_bits' : {'var': 0x5F, 'start': 8, 'size': 24}, + 'random_bits_tile' : {'var': 0x5F, 'start': 24, 'size': 8}, +} + +varact2vars60x_roadstop = { + **varact2vars60x_base_stations, + 'nearby_tile_animation_frame' : {'var': 0x66, 'start': 0, 'size': 32, 'param_function': signed_tile_offset}, + 'nearby_tile_info' : {'var': 0x67, 'start': 0, 'size': 32, 'param_function': signed_tile_offset}, + 'nearby_tile_slope' : {'var': 0x67, 'start': 0, 'size': 5, 'param_function': signed_tile_offset}, + 'nearby_tile_is_water' : {'var': 0x67, 'start': 9, 'size': 1, 'param_function': signed_tile_offset}, + 'nearby_tile_terrain_type' : {'var': 0x67, 'start': 10, 'size': 3, 'param_function': signed_tile_offset}, + 'nearby_tile_water_class' : {'var': 0x67, 'start': 13, 'size': 2, 'param_function': signed_tile_offset}, + 'nearby_tile_height' : {'var': 0x67, 'start': 16, 'size': 8, 'param_function': signed_tile_offset}, + 'nearby_tile_class' : {'var': 0x67, 'start': 24, 'size': 4, 'param_function': signed_tile_offset}, + 'nearby_tile_road_stop_info' : {'var': 0x68, 'start': 0, 'size': 32, 'param_function': signed_tile_offset}, + 'nearby_tile_is_road_stop' : {'var': 0x68, 'start': 0, 'size': 32, 'param_function': signed_tile_offset, 'value_function': lambda var, info: nmlop.CMP_NEQ(var, 0xFFFFFFFF)}, + 'nearby_tile_road_stop_id' : {'var': 0x68, 'start': 0, 'size': 8, 'param_function': signed_tile_offset}, + 'nearby_tile_same_grf' : {'var': 0x68, 'start': 8, 'size': 2, 'param_function': signed_tile_offset, 'value_function': value_equals(0)}, + 'nearby_tile_other_grf' : {'var': 0x68, 'start': 8, 'size': 2, 'param_function': signed_tile_offset, 'value_function': value_equals(1)}, + 'nearby_tile_original_gfx' : {'var': 0x68, 'start': 8, 'size': 2, 'param_function': signed_tile_offset, 'value_function': value_equals(2)}, + 'nearby_tile_same_station' : {'var': 0x68, 'start': 10, 'size': 1, 'param_function': signed_tile_offset}, + 'nearby_tile_different_view' : {'var': 0x68, 'start': 11, 'size': 1, 'param_function': signed_tile_offset}, + 'nearby_tile_view' : {'var': 0x68, 'start': 12, 'size': 4, 'param_function': signed_tile_offset}, + 'nearby_tile_is_drive_through' : {'var': 0x68, 'start': 12, 'size': 4, 'param_function': signed_tile_offset, 'value_function': lambda var, info: nmlop.CMP_GE(var, 4)}, + 'nearby_tile_stop_type' : {'var': 0x68, 'start': 16, 'size': 4, 'param_function': signed_tile_offset}, + 'nearby_tile_same_stop_type' : {'var': 0x68, 'start': 20, 'size': 1, 'param_function': signed_tile_offset}, + 'nearby_tile_grfid' : {'var': 0x6A, 'start': 0, 'size': 32, 'param_function': signed_tile_offset}, +} class VarAct2Scope: def __init__(self, name, vars_normal, vars_60x, has_persistent_storage=False): @@ -817,6 +875,7 @@ scope_airporttiles = VarAct2Scope("AirportTiles", varact2vars_airporttiles, varact2vars60x_airporttiles) scope_roadtypes = VarAct2Scope("RoadTypes", varact2vars_roadtype, {}) scope_tramtypes = VarAct2Scope("TramTypes", varact2vars_tramtype, {}) +scope_roadstops = VarAct2Scope("RoadStops", varact2vars_roadstop, varact2vars60x_roadstop) varact2features = [ VarAct2Feature(scope_trains, scope_trains), @@ -839,4 +898,5 @@ VarAct2Feature(scope_airporttiles, None), VarAct2Feature(scope_roadtypes, None), VarAct2Feature(scope_tramtypes, None), + VarAct2Feature(scope_roadstops, scope_towns), ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.7.1/nml/actions/action3_callbacks.py new/nml-0.7.2/nml/actions/action3_callbacks.py --- old/nml-0.7.1/nml/actions/action3_callbacks.py 2022-12-03 23:03:42.000000000 +0100 +++ new/nml-0.7.2/nml/actions/action3_callbacks.py 2023-04-17 21:54:52.000000000 +0200 @@ -15,7 +15,7 @@ from nml import nmlop -callbacks = 0x14 * [{}] +callbacks = 0x15 * [{}] # Possible values for 'purchase': # 0 (or not set): not called from purchase list @@ -39,6 +39,7 @@ 'every_32_days' : {'type': 'cb', 'num': 0x32}, 'sound_effect' : {'type': 'cb', 'num': 0x33, 'flag_bit': 7}, 'refit_cost' : {'type': 'cb', 'num': 0x15E, 'purchase': 1}, + 'name' : {'type': 'cb', 'num': 0x161, 'flag_bit': 8, 'purchase': 2}, } # Function to convert vehicle length to the actual property value, which is (8 - length) @@ -286,6 +287,7 @@ 'gui' : {'type': 'cargo', 'num': 0x00}, 'track_overlay' : {'type': 'cargo', 'num': 0x01}, 'underlay' : {'type': 'cargo', 'num': 0x02}, + 'tunnels' : {'type': 'cargo', 'num': 0x03}, 'catenary_front' : {'type': 'cargo', 'num': 0x04}, 'catenary_back' : {'type': 'cargo', 'num': 0x05}, 'bridge_surfaces' : {'type': 'cargo', 'num': 0x06}, @@ -299,8 +301,19 @@ 'gui' : {'type': 'cargo', 'num': 0x00}, 'track_overlay' : {'type': 'cargo', 'num': 0x01}, 'underlay' : {'type': 'cargo', 'num': 0x02}, + 'tunnels' : {'type': 'cargo', 'num': 0x03}, 'catenary_front' : {'type': 'cargo', 'num': 0x04}, 'catenary_back' : {'type': 'cargo', 'num': 0x05}, 'bridge_surfaces' : {'type': 'cargo', 'num': 0x06}, 'depots' : {'type': 'cargo', 'num': 0x08}, } + +# Roadstops +callbacks[0x14] = { + 'availability' : {'type': 'cb', 'num': 0x13, 'flag_bit': 0}, + 'anim_control' : {'type': 'cb', 'num': 0x140}, + 'anim_next_frame' : {'type': 'cb', 'num': 0x141, 'flag_bit': 1}, + 'anim_speed' : {'type': 'cb', 'num': 0x142, 'flag_bit': 2}, + 'default' : {'type': 'cargo', 'num': None}, + 'purchase' : {'type': 'cargo', 'num': 0xFF}, +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.7.1/nml/ast/general.py new/nml-0.7.2/nml/ast/general.py --- old/nml-0.7.1/nml/ast/general.py 2022-12-03 23:03:42.000000000 +0100 +++ new/nml-0.7.2/nml/ast/general.py 2023-04-17 21:54:52.000000000 +0200 @@ -37,6 +37,7 @@ "FEAT_AIRPORTTILES": 0x11, "FEAT_ROADTYPES": 0x12, "FEAT_TRAMTYPES": 0x13, + "FEAT_ROADSTOPS": 0x14, } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.7.1/nml/expression/binop.py new/nml-0.7.2/nml/expression/binop.py --- old/nml-0.7.1/nml/expression/binop.py 2022-12-03 23:03:42.000000000 +0100 +++ new/nml-0.7.2/nml/expression/binop.py 2023-04-17 21:54:52.000000000 +0200 @@ -123,7 +123,22 @@ if op in (nmlop.DIV, nmlop.DIVU, nmlop.MUL) and isinstance(expr2, ConstantNumeric) and expr2.value == 1: return expr1 - if op in (nmlop.ADD, nmlop.SUB) and isinstance(expr2, ConstantNumeric) and expr2.value == 0: + if ( + op + in ( + nmlop.ADD, + nmlop.SUB, + nmlop.SHIFTU_LEFT, + nmlop.SHIFT_LEFT, + nmlop.SHIFTU_RIGHT, + nmlop.SHIFT_RIGHT, + nmlop.OR, + nmlop.XOR, + nmlop.ROT_RIGHT, + ) + and isinstance(expr2, ConstantNumeric) + and expr2.value == 0 + ): return expr1 # - Variables (as used in action2var) can have some computations attached to @@ -171,6 +186,24 @@ expr1.mask = nmlop.SHIFT_LEFT(expr1.mask, expr2).reduce() return expr1 + if ( + ( + op == nmlop.SHIFTU_RIGHT + or ( + op == nmlop.SHIFT_RIGHT + and isinstance(expr1.mask, ConstantNumeric) + and expr1.mask.uvalue < 0x80000000 + ) + ) + and isinstance(expr2, ConstantNumeric) + and expr2.value >= 0 + and expr1.shift.value >= 0 + and (expr1.shift.value + expr2.value) < 32 + ): + expr1.shift.value += expr2.value + expr1.mask = nmlop.SHIFTU_RIGHT(expr1.mask, expr2).reduce() + return expr1 + # - Try to merge multiple additions/subtractions with constant numbers if ( op in (nmlop.ADD, nmlop.SUB) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.7.1/nml/global_constants.py new/nml-0.7.2/nml/global_constants.py --- old/nml-0.7.1/nml/global_constants.py 2022-12-03 23:03:42.000000000 +0100 +++ new/nml-0.7.2/nml/global_constants.py 2023-04-17 21:54:52.000000000 +0200 @@ -130,7 +130,7 @@ "SHIP_FLAG_NO_BREAKDOWN_SMOKE": 6, "SHIP_FLAG_SPRITE_STACK": 7, - # aircrafts misc flags + # aircraft misc flags "AIRCRAFT_FLAG_2CC" : 1, "AIRCRAFT_FLAG_AUTOREFIT": 4, "AIRCRAFT_FLAG_NO_BREAKDOWN_SMOKE": 6, @@ -141,6 +141,12 @@ "VEHICLE_FLAG_AUTOREFIT": 4, "VEHICLE_FLAG_NO_BREAKDOWN_SMOKE": 6, + # vehicle extra flags + "VEHICLE_FLAG_DISABLE_NEW_VEHICLE_MESSAGE" : 0, + "VEHICLE_FLAG_DISABLE_EXCLUSIVE_PREVIEW" : 1, + "VEHICLE_FLAG_SYNC_VARIANT_EXCLUSIVE_PREVIEW" : 2, + "VEHICLE_FLAG_SYNC_VARIANT_RELIABILITY" : 3, + # Graphic flags for waterfeatures "WATERFEATURE_ALTERNATIVE_SPRITES" : 0, @@ -804,6 +810,14 @@ "ANIM_TRIGGER_APT_250_TICKS" : 4, "ANIM_TRIGGER_APT_AIRPLANE_LANDS" : 5, + "ANIM_TRIGGER_ROAD_STOP_BUILT" : 0, + "ANIM_TRIGGER_ROAD_STOP_NEW_CARGO" : 1, + "ANIM_TRIGGER_ROAD_STOP_CARGO_TAKEN" : 2, + "ANIM_TRIGGER_ROAD_STOP_VEH_ENTER" : 3, + "ANIM_TRIGGER_ROAD_STOP_VEH_LEAVE" : 4, + "ANIM_TRIGGER_ROAD_STOP_VEH_LOAD" : 5, + "ANIM_TRIGGER_ROAD_STOP_250_TICKS" : 6, + # Animation looping "ANIMATION_NON_LOOPING" : 0, "ANIMATION_LOOPING" : 1, @@ -1120,6 +1134,31 @@ "TTD_STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY" : 0x4830, "TTD_STR_ERROR_FOREST_CAN_ONLY_BE_PLANTED" : 0x4831, "TTD_STR_ERROR_CAN_ONLY_BE_POSITIONED" : 0x483B, + + # Road stops + "RST_AVAILABILITY_TYPE_PASSENGER" : 0, + "RST_AVAILABILITY_TYPE_FREIGHT" : 1, + "RST_AVAILABILITY_TYPE_ALL" : 2, + + "RST_TYPE_BUS" : 0, + "RST_TYPE_TRUCK" : 1, + + "RST_DRAW_FLAG_BAY_ROAD" : 0, + "RST_DRAW_FLAG_DRIVE_THROUGH_ROAD_OVERLAY" : 1, + + "RST_GENERAL_FLAG_RANDOM_ANIMATION" : 0, + "RST_GENERAL_FLAG_NO_CATENARY" : 2, + "RST_GENERAL_FLAG_DRIVE_THROUGH_ONLY" : 3, + "RST_GENERAL_FLAG_NO_AUTO_ROAD_CONNECTION" : 4, + "RST_GENERAL_FLAG_BUILD_MENU_ROAD_ONLY" : 5, + "RST_GENERAL_FLAG_BUILD_MENU_TRAM_ONLY" : 6, + + "RST_VIEW_BAY_NE" : 0, + "RST_VIEW_BAY_SE" : 1, + "RST_VIEW_BAY_SW" : 2, + "RST_VIEW_BAY_NW" : 3, + "RST_VIEW_DRIVE_THROUGH_X" : 4, + "RST_VIEW_DRIVE_THROUGH_Y" : 5, } # fmt: on @@ -1348,8 +1387,8 @@ cargo_numbers = {} is_default_railtype_table = True -# if no railtype_table is provided, OpenTTD assumes these 4 railtypes -railtype_table = {"RAIL": 0, "ELRL": 1, "MONO": 1, "MGLV": 2} +# if no railtype_table is provided, OpenTTD assumes these 3 railtypes +railtype_table = {"RAIL": 0, "MONO": 1, "MGLV": 2} is_default_roadtype_table = True # if no roadtype_table is provided, OpenTTD sets all vehicles to ROAD diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.7.1/nml/grfstrings.py new/nml-0.7.2/nml/grfstrings.py --- old/nml-0.7.1/nml/grfstrings.py 2022-12-03 23:03:42.000000000 +0100 +++ new/nml-0.7.2/nml/grfstrings.py 2023-04-17 21:54:52.000000000 +0200 @@ -442,7 +442,7 @@ return commands[self.name][str_type] # Compute position of the argument in the stack. stack_pos = 0 - for (pos, size) in stack: + for pos, size in stack: if pos == self.str_pos: break stack_pos += size diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.7.1/nml/main.py new/nml-0.7.2/nml/main.py --- old/nml-0.7.1/nml/main.py 2022-12-03 23:03:42.000000000 +0100 +++ new/nml-0.7.2/nml/main.py 2023-04-17 21:54:52.000000000 +0200 @@ -633,7 +633,6 @@ sys.exit(1) except Exception as ex: # Other/internal error. - if developmode: raise # Reraise exception in developmode diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.7.1/nml.egg-info/PKG-INFO new/nml-0.7.2/nml.egg-info/PKG-INFO --- old/nml-0.7.1/nml.egg-info/PKG-INFO 2022-12-03 23:04:11.000000000 +0100 +++ new/nml-0.7.2/nml.egg-info/PKG-INFO 2023-04-17 21:55:21.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: nml -Version: 0.7.1 +Version: 0.7.2 Summary: An OpenTTD NewGRF compiler for the nml language Home-page: https://github.com/OpenTTD/nml Author: NML Development Team Binary files old/nml-0.7.1/regression/expected/030_house.grf and new/nml-0.7.2/regression/expected/030_house.grf differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.7.1/regression/expected/030_house.nfo new/nml-0.7.2/regression/expected/030_house.nfo --- old/nml-0.7.1/regression/expected/030_house.nfo 2022-12-03 23:03:42.000000000 +0100 +++ new/nml-0.7.2/regression/expected/030_house.nfo 2023-04-17 21:54:52.000000000 +0200 @@ -308,9 +308,8 @@ \b2 02 03 -48 * 11 00 07 \b2 01 FF \wx0000 +48 * 9 00 07 \b1 01 FF \wx0000 14 03 -1D 00 // Name: @action3_0 49 * 57 02 07 FD 89 @@ -328,9 +327,8 @@ 51 * 7 03 07 01 00 \b0 \wx00FD // @action3_0; -52 * 11 00 07 \b2 01 FF \wx0001 +52 * 9 00 07 \b1 01 FF \wx0001 14 02 -1D 00 // Name: @action3_1 53 * 47 02 07 FD 89 @@ -347,9 +345,8 @@ 55 * 7 03 07 01 01 \b0 \wx00FD // @action3_1; -56 * 11 00 07 \b2 01 FF \wx0002 +56 * 9 00 07 \b1 01 FF \wx0002 14 02 -1D 00 // Name: @action3_2 57 * 47 02 07 FD 89 @@ -366,9 +363,8 @@ 59 * 7 03 07 01 02 \b0 \wx00FD // @action3_2; -60 * 11 00 07 \b2 01 FF \wx0003 +60 * 9 00 07 \b1 01 FF \wx0003 14 02 -1D 00 // Name: @action3_3 61 * 47 02 07 FF 89 Binary files old/nml-0.7.1/regression/expected/033_procedure.grf and new/nml-0.7.2/regression/expected/033_procedure.grf differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.7.1/regression/expected/033_procedure.nfo new/nml-0.7.2/regression/expected/033_procedure.nfo --- old/nml-0.7.1/regression/expected/033_procedure.nfo 2022-12-03 23:03:42.000000000 +0100 +++ new/nml-0.7.2/regression/expected/033_procedure.nfo 2023-04-17 21:54:52.000000000 +0200 @@ -116,8 +116,7 @@ 08 00 09 00 -9 * 11 00 0A \b2 01 FF \wx0000 -21 00 +9 * 9 00 0A \b1 01 FF \wx0000 22 42 // Name: @CB_FAILED_PROD Binary files old/nml-0.7.1/regression/expected/039_storage.grf and new/nml-0.7.2/regression/expected/039_storage.grf differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.7.1/regression/expected/039_storage.nfo new/nml-0.7.2/regression/expected/039_storage.nfo --- old/nml-0.7.1/regression/expected/039_storage.nfo 2022-12-03 23:03:42.000000000 +0100 +++ new/nml-0.7.2/regression/expected/039_storage.nfo 2023-04-17 21:54:52.000000000 +0200 @@ -46,9 +46,8 @@ 08 00 09 00 -6 * 11 00 0A \b2 01 FF \wx0000 +6 * 9 00 0A \b1 01 FF \wx0000 21 20 -22 00 // Name: @CB_FAILED_PROD 7 * 15 02 0A FE 00 \wx0000 \wx0000 \wx0000 \wx0000 \wx0000 00 Binary files old/nml-0.7.1/regression/expected/example_train.grf and new/nml-0.7.2/regression/expected/example_train.grf differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nml-0.7.1/regression/expected/example_train.nfo new/nml-0.7.2/regression/expected/example_train.nfo --- old/nml-0.7.1/regression/expected/example_train.nfo 2022-12-03 23:03:42.000000000 +0100 +++ new/nml-0.7.2/regression/expected/example_train.nfo 2023-04-17 21:54:52.000000000 +0200 @@ -505,10 +505,8 @@ \wx00FD // default: set_cargo_wagon_load; // Name: cargo_wagon_switch_graphics -117 * 37 02 00 FD 89 -10 20 \dxFFFFFFFF -\2u>> 1A 20 \dx00000008 -\2& 1A 00 \dx000000FF +117 * 23 02 00 FD 89 +10 08 \dx000000FF \b1 \wx00F1 \dx00000000 \dx00000000 // 0 .. 0: cargo_wagon_switch_vehicle; \wx00FD // default: cargo_wagon_switch_load;