Skip to content
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

Unaffect type 8, m1, bit 4 for MakeIndustry #6235

Closed
DorpsGek opened this issue Feb 25, 2015 · 4 comments
Closed

Unaffect type 8, m1, bit 4 for MakeIndustry #6235

DorpsGek opened this issue Feb 25, 2015 · 4 comments
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay

Comments

@DorpsGek
Copy link
Member

Samu opened the ticket and wrote:

This patch prevents MakeIndustry from setting m1 bit 4 to 0, by preserving it's extracted value.

According to both landscape and landscape grid documentation, I believe that bit location was free to be used and never touched for anything related to industry tiles. I discovered the issue when I was searching for free, unused bits. For me, it would be preferrible if that bit value was preserved, hence this patch.

Issue:
MakeIndustry in industry_map.h is setting all bit values for m1 to 0

Refer:
http://hg.openttd.org/openttd/trunk.hg/file/53f10edbd7f1/src/industry_map.h# l283
http://hg.openttd.org/openttd/trunk.hg/raw-file/53f10edbd7f1/docs/landscape.html
http://hg.openttd.org/openttd/trunk.hg/raw-file/53f10edbd7f1/docs/landscape_grid.html

Attachments

Reported version: 1.5.0-beta1
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/6235
@DorpsGek
Copy link
Member Author

Samu wrote:

I'm sorry, this patch is introducing a "bug".

Upon loading an old save game, the old bit 4 information is not being converted to the new bit 4 information. It affects all Industries.

I intend to fix that.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6235#comment13783

@DorpsGek
Copy link
Member Author

Alberth wrote:

You cannot have a bit that is both free to use and never touched.

A bit 'free to use' means its use can start at any time. As such, you cannot use it for any purpose, and preserving the bit is useless (no-one cares what the value is anyway).
A bit 'never to touch' means it effectively has a use, but it is not documented.

Unused bits can be changed at will. When it gets a use, all code will be checked to do the right thing for the bit.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6235#comment13784

@DorpsGek
Copy link
Member Author

Samu wrote:

This version converts the old bit 4 information, as well as preserving the bit value that is also inadvertently modified during a DoCommand, just before MakeIndustry.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/6235#comment13789

@DorpsGek
Copy link
Member Author

peter1138 closed the ticket.

Reason for closing: Invalid

Incorrect assumptions about map array


This comment was imported from FlySpray: https://bugs.openttd.org/task/6235

@DorpsGek DorpsGek added Core flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay labels Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay
Projects
None yet
Development

No branches or pull requests

1 participant