New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix 11ab3c4ea2f: Vehicles could not be refitted to cargo IDs higher than 32. #7134
Conversation
PR fixes the vehicle refit bug found here: https://www.tt-forums.net/viewtopic.php?p=1217911#p1217911 I looked at the patch and it looks sane to me, but I didn't check if all the changes to bit counts are correct. |
@andythenorth Technically 8 bits is too many, however by specifying that many bits we will get an error message if CargoID is out of range, rather than it being silently wrapped at 32 (or 64) Additionally the scripting interface only provides for CargoID and subtype parameters, so is not affected by the shuffling. |
In the bit packing, the following changes are made:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, let's fix this bug :)
This is incomplete for autorefitting, however in trying to follow the flow for autorefit it seems it was buggy before. Trying to work out what values are valid :-) CT_AUTO_REFIT = 0xFD, which would have been truncated to cargo type 0x1D with the original bit packing, which may or may not be valid depending on NewGRFs in use. |
This shuffles the bit packing around to give more space to cargo ID.