Commits

Anonymous committed e095cb3

Change: Merge aircraft properties 'is_helicopter' and 'is_large' into a single common property 'aircraft_type'. (closes #3700).

Comments (0)

Files changed (2)

nml/actions/action0properties.py

 # Feature 0x03 (Aircraft)
 #
 
+def aircraft_type_prop(value):
+    value = value.reduce_constant()
+    if not value.value in (0, 2, 3):
+        raise generic.ScriptError("Invalid value for aircraft_type", value.pos)
+    return [Action0Property(0x09, ConstantNumeric(value.value & 2), 1),
+            Action0Property(0x0A, ConstantNumeric(value.value & 1), 1)]
+
 properties[0x03] = {
     'sprite_id'                    : {'size': 1, 'num': 0x08},
-    'is_helicopter'                : {'size': 1, 'num': 0x09},
-    'is_large'                     : {'size': 1, 'num': 0x0A},
+    'aircraft_type'                : {'custom_function': aircraft_type_prop},
     'cost_factor'                  : {'size': 1, 'num': 0x0B},
     'speed'                        : {'size': 1, 'num': 0x0C, 'unit_type': 'speed', 'unit_conversion': 0.279617, 'adjust_value': lambda val, unit: ottd_display_speed(val, 1, unit)},
     'acceleration'                 : {'size': 1, 'num': 0x0D},

nml/global_constants.py

 
     'NEW_CARGO_SPRITE'       : 0xFFFF,
 
-    #aircraft type/size
-    'AIRCRAFT_TYPE_NORMAL'     : 0x02,
+    #aircraft type
     'AIRCRAFT_TYPE_HELICOPTER' : 0x00,
-    'AIRCRAFT_SIZE_SMALL'      : 0x00,
-    'AIRCRAFT_SIZE_LARGE'      : 0x01,
+    'AIRCRAFT_TYPE_SMALL'      : 0x02,
+    'AIRCRAFT_TYPE_LARGE'      : 0x03,
 
     #ground sprite IDs
     'GROUNDSPRITE_CONCRETE'    : 1420,