OpenTTD/nml

Bridges management

werbfred opened this issue · 2 comments

Hello,

First of all : Great Job 🥇

I've been playing around with Bridges. I updated file nml/actions/action0properties.py by adding following code:

#
# Feature 0x06 (Bridges)
#
properties[0x06] = {
    # 0x08 - year availability (old way)
    'min_length' : { 'num': 0x09, 'size': 1 },
    'max_length' : { 'num': 0x0A, 'size': 1 },
    # 0x0B - cost factor (old way)
    'speed_limit' : { 'num': 0x0C, 'size': 2, 'unit_type': 'speed', 'unit_conversion': (5000, 1397), 'adjust_value': lambda val, unit: ottd_display_speed(val, 1, unit)},
    'sprite' : { 'num': 0x0D, 'size': 2 },
    'flags' : { 'num': 0x0E, 'size': 1 },
    'avail_year' : { 'num': 0x0F, 'size': 4 },
    'name' : { 'num': 0x10, 'size': 2, 'string': 0xDC },
    'description_rail_bridge' : { 'num': 0x11, 'size': 2, 'string': 0xDC },
    'description_road_bridge' : { 'num': 0x12, 'size': 2, 'string': 0xDC },
    'cost_factor' : { 'num': 0x13, 'size': 2 },
}

I've tested all except sprite and flags...

The code to edit a bridge becomes 👍

item(FEAT_BRIDGES, item_wooden_bridge, 0x00 ) {
    property {
        avail_year: 1800;
        cost_factor: 40;
        speed_limit: 40 km/h;
        min_length: 0;
        max_length: 12;
    }
}

name, description_rail_bridge and description_road_bridge have also been tested and working fine.

glx22 commented

Please open a PR

Created PR : Bridge management #158