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

Bankrupcy counter update does not trigger company update admin message #7491

Closed
Xaroth opened this issue Apr 9, 2019 · 0 comments · Fixed by #7492
Closed

Bankrupcy counter update does not trigger company update admin message #7491

Xaroth opened this issue Apr 9, 2019 · 0 comments · Fixed by #7492

Comments

@Xaroth
Copy link
Contributor

Xaroth commented Apr 9, 2019

Version of OpenTTD

1.9.1

Expected result

NetworkAdminCompanyUpdate to be called (via CompanyAdminUpdate when the bankrupcy counter updates)

Actual result

Nothing

Steps to reproduce

  1. Listen on admin port, request ADMIN_UPDATE_COMPANY_INFO with frequency ADMIN_FREQUENCY_AUTOMATIC
  2. Create a company (this sends a ADMIN_PACKET_SERVER_COMPANY_NEW and ADMIN_PACKET_SERVER_COMPANY_INFO)
  3. Change the company name (this sends a ADMIN_PACKET_SERVER_COMPANY_UPDATE )
    3b. Changing the primary color, president name or password also triggers this
  4. Spend all the company's money, have some monthly expenses to trigger the bankrupcy counter
  5. Do not receive any ADMIN_PACKET_SERVER_COMPANY_UPDATE until the company goes bankrupt
    5b. Optionally, send an ADMIN_POLL for ADMIN_UPDATE_COMPANY_INFO with the extra flag set to the company id or UINT32_MAX, and you will recive a new ADMIN_PACKET_SERVER_COMPANY_INFO, but with the correct bankruptcy counter filled. This indicates that the value is updated, just not sent when it updates.

Judging from https://github.com/OpenTTD/OpenTTD/blob/master/src/economy.cpp#L569-L647 I see that the counter gets updated (and processed) there, but CompanyAdminUpdate is not called there. The most sane locations would be in the case 4 and case 7, together with normal processing. (There really is no need to send an update message when the counter sent in the update only updates every 3 months).

PeterN added a commit to PeterN/OpenTTD that referenced this issue Apr 9, 2019
PeterN added a commit to PeterN/OpenTTD that referenced this issue May 2, 2019
douiwby pushed a commit to douiwby/OpenTTD that referenced this issue Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant