Skip to content

Add: New capacity callbacks and misc_flags bit 5 constant - #444

Open
Brickblock1 wants to merge 1 commit into
OpenTTD:masterfrom
Brickblock1:misc_flags-bit-5
Open

Brickblock1 wants to merge 1 commit into
OpenTTD:masterfrom
Brickblock1:misc_flags-bit-5

Conversation

@Brickblock1

Copy link
Copy Markdown
Contributor

NML does not currently allow setting CB 36 and 15 independently which is a shame. NML also doesn't support misc_flags bit 5 cleanly with a constant.

The flag is very useful since it makes it considerably easier and safer to use the 'cargo_capacity' property and CB 36 / 'cargo_capacity_default' as they get decopled form whatever the default cargotype is. It also has the benefit of making CB 15 / 'cargo_capacity_refit' called regardless of if the vehicle is refited allowing one to implement only CB 15 instead of also implementing CB 36 even though it only gets caled in one case.

'cargo_capacity' : [ {'type': 'cb', 'num': 0x15, 'flag_bit': 3},
{'type': 'cb', 'num': 0x36, 'var10': 0x14, 'purchase': 'purchase_cargo_capacity'}],
'purchase_cargo_capacity' : {'type': 'cb', 'num': 0x36, 'var10': 0x14, 'purchase': 2},
{'type': 'cb', 'num': 0x36, 'var10': 0x14, 'purchase': 'purchase_cargo_capacity', 'deprecate_message': "'cargo_capacity' is deprecated, consider using 'cargo_capacity_refit' with misc flag TRAIN_FLAG_SIMPLE_REFIT_CAPACITY instead"}], # Depricated due to being complicated and inefficent

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{'type': 'cb', 'num': 0x36, 'var10': 0x14, 'purchase': 'purchase_cargo_capacity', 'deprecate_message': "'cargo_capacity' is deprecated, consider using 'cargo_capacity_refit' with misc flag TRAIN_FLAG_SIMPLE_REFIT_CAPACITY instead"}], # Depricated due to being complicated and inefficent
{'type': 'cb', 'num': 0x36, 'var10': 0x14, 'purchase': 'purchase_cargo_capacity', 'deprecate_message': "'cargo_capacity' is deprecated, consider using 'cargo_capacity_refit' with misc flag TRAIN_FLAG_SIMPLE_REFIT_CAPACITY instead"}], # Deprecated due to being complicated and inefficent

'cargo_capacity' : [ {'type': 'cb', 'num': 0x15, 'flag_bit': 3},
{'type': 'cb', 'num': 0x36, 'var10': 0x0F, 'purchase': 'purchase_cargo_capacity'}],
'purchase_cargo_capacity' : {'type': 'cb', 'num': 0x36, 'var10': 0x0F, 'purchase': 2},
{'type': 'cb', 'num': 0x36, 'var10': 0x0F, 'purchase': 'purchase_cargo_capacity', 'deprecate_message': "'cargo_capacity' is deprecated, consider using 'cargo_capacity_refit' with misc flag ROADVEH_FLAG_SIMPLE_REFIT_CAPACITY instead"}], # Depricated due to being complicated and inefficent

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{'type': 'cb', 'num': 0x36, 'var10': 0x0F, 'purchase': 'purchase_cargo_capacity', 'deprecate_message': "'cargo_capacity' is deprecated, consider using 'cargo_capacity_refit' with misc flag ROADVEH_FLAG_SIMPLE_REFIT_CAPACITY instead"}], # Depricated due to being complicated and inefficent
{'type': 'cb', 'num': 0x36, 'var10': 0x0F, 'purchase': 'purchase_cargo_capacity', 'deprecate_message': "'cargo_capacity' is deprecated, consider using 'cargo_capacity_refit' with misc flag ROADVEH_FLAG_SIMPLE_REFIT_CAPACITY instead"}], # Deprecated due to being complicated and inefficent

'visual_effect' : {'type': 'cb', 'num': 0x10, 'flag_bit': 0},
'effect_spawn_model' : {'type': 'cb', 'num': 0x10, 'flag_bit': 0},
'cargo_capacity' : [ {'type': 'cb', 'num': 0x15, 'flag_bit': 3},
{'type': 'cb', 'num': 0x36, 'var10': 0x0D, 'purchase': 'purchase_cargo_capacity', 'deprecate_message': "'cargo_capacity' is deprecated, consider using 'cargo_capacity_refit' with misc flag SHIP_FLAG_SIMPLE_REFIT_CAPACITY instead"}], # Depricated due to being complicated and inefficent

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{'type': 'cb', 'num': 0x36, 'var10': 0x0D, 'purchase': 'purchase_cargo_capacity', 'deprecate_message': "'cargo_capacity' is deprecated, consider using 'cargo_capacity_refit' with misc flag SHIP_FLAG_SIMPLE_REFIT_CAPACITY instead"}], # Depricated due to being complicated and inefficent
{'type': 'cb', 'num': 0x36, 'var10': 0x0D, 'purchase': 'purchase_cargo_capacity', 'deprecate_message': "'cargo_capacity' is deprecated, consider using 'cargo_capacity_refit' with misc flag SHIP_FLAG_SIMPLE_REFIT_CAPACITY instead"}], # Deprecated due to being complicated and inefficent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants