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

Industry tiles - extended prop 12 with special flag INDTILE_SPECIAL_DONT_BUILD #3602

Closed
DorpsGek opened this issue Feb 7, 2010 · 9 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

DorpsGek commented Feb 7, 2010

andythenorth opened the ticket and wrote:

This extends industry tile prop 12, and the tile building routine. If prop 12 bit 1 is set, the tile won't be built, but will be available for use in layout checks etc.

Attachments

Reported version: trunk
Operating system: All


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

DorpsGek commented Feb 7, 2010

frosch wrote:

The hardest part is missing :(
The location in the industry layout should be signed just as for type 0xFF.

Edit:
Also "/* it->gfx is stored in the map. But the translated ID cur_gfx is the interesting one */" might need some care.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3602#comment7555

@DorpsGek
Copy link
Member Author

DorpsGek commented Feb 7, 2010

andythenorth wrote:

I modified newgrf.cpp to allow signed offsets. Currently all tiles can be built with signed offset, which will cause problems. I need to prevent a tile with signed offset from being constructed, I haven't figured that out yet.
There was also some exciting irc debate about the format of itt[k].ti.x = (int8)GB(itt[k].ti.x, 0, 8);

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/3602#comment7556

@DorpsGek
Copy link
Member Author

DorpsGek commented Feb 7, 2010

andythenorth wrote:

I've modified industry_cmd.cpp further to prevent tiles with signed offsets being built.
I also moved a couple of lines as suggested by frosch in resp. of /* it->gfx is stored in the map. But the translated ID cur_gfx is the interesting one */

Not building is handled silently - no errors are reported.
IMO the newgrf author has done something stupid if they use negative offsets without prop 12 bit 1 set (i.e. don't build this tile).

EDIT: I wonder if CheckIfIndustryTilesAreFree needs to exclude tiles with negative offsets unless prop 12 bit 1 is set for tile?

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/3602#comment7557

@DorpsGek
Copy link
Member Author

DorpsGek commented Feb 8, 2010

andythenorth wrote:

Update - CheckIfIndustryTilesAreFree now returns false if offsets are < 0 and tile prop 12 bit 1 is not set. (This is now checked in two places which seems redundant)

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/3602#comment7560

@DorpsGek
Copy link
Member Author

DorpsGek commented Feb 9, 2010

andythenorth wrote:

frosch was pretty adamant that negative offsets need checking in a better way with AfterLoadGRFs

This is my attempt to do that. It doesn't quite work, and I'm not sure why. It's not reading the special flag for tile prop 12 bit 1 correctly. I think I'm probably checking the wrong tile?

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/3602#comment7564

@DorpsGek
Copy link
Member Author

DorpsGek commented Feb 9, 2010

Yexo wrote:

The latest change in src/industry_cmd.cpp is wrong. GetIndustryTileSpec(GFX_WATERTILE_SPECIALCHECK) is not valid, it's never done in trunk because the check for GFX_WATERTILE_SPECIALCHECK is first, but you move those calls around so GetIndustryTileSpec is called for that id.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3602#comment7565

@DorpsGek
Copy link
Member Author

DorpsGek commented Feb 9, 2010

andythenorth wrote:

Yexo - I've added some conditional code to check tile id before calling GetIndustryTileSpec. Also seemed easiest to set a little flag to control wherever the tile is built or not.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/3602#comment7566

@DorpsGek
Copy link
Member Author

DorpsGek commented Feb 9, 2010

andythenorth wrote:

For some reason I had ruled out using industry tile cb 2F and industry tile var 60 to solve this. That was a mistake.

Using cb 2F and var 60, I can simply check the contents of a tile's 8 neighbours. If they contain another industry (or other unremovable object), then I can prevent the industry from being built.

This should render my patch attempts for this redundant.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3602#comment7567

@DorpsGek
Copy link
Member Author

Rubidium closed the ticket.

Reason for closing: Won't implement

Not needed; can be done using other callback/variable.


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

@DorpsGek DorpsGek added NewIndustries 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