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

Disasters: wrong location shown in factory/refinery destroyed message #8956

Closed
LC-Zorg opened this issue Apr 5, 2021 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@LC-Zorg
Copy link

LC-Zorg commented Apr 5, 2021

Version of OpenTTD

1.11.0

Expected result

The message shows the correct location of the incident

Actual result

The shown location of the incident is incorrect - it always shows the top left edge of the map.
Wrong localisation of disaster 1

Steps to reproduce

The bug always appears, just start the game with disasters.

@2TallTyler
Copy link
Member

Sounds like #8810.

@James103
Copy link
Contributor

James103 commented Apr 6, 2021

From some of my own testing (and looking at the code), it appears that the news message is likely using the industry's ID as the tile ID to display in the news message, and not the actual location of the (northernmost) corner of the industry itself. See the following code segments for a likely backtrace:

AddTileNewsItem(news_message, NT_ACCIDENT, v->dest_tile);

IndustryID ind = GetIndustryIndex(tile);
v->dest_tile = ind;

static inline IndustryID GetIndustryIndex(TileIndex t)
{
assert(IsTileType(t, MP_INDUSTRY));
return _m[t].m2;
}

OpenTTD/src/industry_map.h

Lines 278 to 282 in 825867f

static inline void MakeIndustry(TileIndex t, IndustryID index, IndustryGfx gfx, uint8 random, WaterClass wc)
{
SetTileType(t, MP_INDUSTRY);
_m[t].m1 = 0;
_m[t].m2 = index;

LordAro added a commit to LordAro/OpenTTD that referenced this issue Apr 10, 2021
LordAro added a commit to LordAro/OpenTTD that referenced this issue Apr 10, 2021
@TrueBrain TrueBrain added the bug Something isn't working label Apr 10, 2021
LordAro added a commit to LordAro/OpenTTD that referenced this issue Apr 10, 2021
LordAro added a commit to LordAro/OpenTTD that referenced this issue Apr 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants