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

FindStationsAroundTiles with use_nearby=true returns no results for industry tiles #7372

Closed
JGRennison opened this issue Mar 13, 2019 · 3 comments

Comments

@JGRennison
Copy link
Contributor

@JGRennison JGRennison commented Mar 13, 2019

Version of OpenTTD

Since 8b1b3fd

Expected result

void FindStationsAroundTiles(const TileArea &location, StationList *stations, bool use_nearby) should fill *stations

Actual result

When use_nearby is true and IsTileType(location.tile, MP_INDUSTRY).
stations = &Industry::GetByTile(location.tile)->stations_near; changes the value of the stations parameter pointer.
This does not write to *stations, and the change of pointer is not visible to the caller.

Presumably it should be *stations = Industry::GetByTile(location.tile)->stations_near;

Steps to reproduce

@PeterN

This comment has been minimized.

Copy link
Member

@PeterN PeterN commented Mar 13, 2019

Weird, I remember seeing this but must have forgotten :-(

@PeterN

This comment has been minimized.

Copy link
Member

@PeterN PeterN commented Mar 13, 2019

Now that I look, the only affected caller of this is newgrf houses querying cargo acceptance history of nearby stations with var 0x64, and only if they provide an offset which points to an industry tile.

I'm not sure what the purpose of this check (with an offset) is, and I suspect providing the result of the industry's nearby stations is incorrect at this point.

@PeterN

This comment has been minimized.

Copy link
Member

@PeterN PeterN commented Mar 13, 2019

Okay, so it's for multi-tile buildings to check the for other possible stations of their other tiles. Basically this bug is a non-issue as checking an industry tile wouldn't produce useful results anyway.

PeterN added a commit to PeterN/OpenTTD that referenced this issue Mar 13, 2019
…esult for industry tiles.

This can only be triggered by NewGRF house tiles querying for cargo acceptance history
of nearby stations (var 0x64) with a tile offset. This serves no useful purpose.
PeterN added a commit to PeterN/OpenTTD that referenced this issue Mar 13, 2019
…esult for industry tiles.

Currently this can only be triggered by NewGRF house tiles querying for cargo acceptance history
of nearby stations (var 0x64) with a tile offset, and providing an offset that happens to point
to an industry tile. This serves no useful purpose.
@PeterN PeterN closed this in 6b92b83 Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.