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

[Bug]: No descriptive error when hostile takeover fails due to vehicle limit #12594

Closed
davewthompson opened this issue Apr 29, 2024 · 2 comments · Fixed by #12676
Closed

[Bug]: No descriptive error when hostile takeover fails due to vehicle limit #12594

davewthompson opened this issue Apr 29, 2024 · 2 comments · Fixed by #12676
Labels
component: interface This is an interface issue good first issue Good for newcomers

Comments

@davewthompson
Copy link

Version of OpenTTD

14.0

Expected result

You can execute a hostile takeover of the company

Actual result

A message saying "Can't buy company..." appears, with no additional information.

Steps to reproduce

  1. Load attached savegame.
  2. Try and execute a hostile takeover of the "AAAHogEx" AI
  3. You will see a message saying the cost will be around £12m but on attempting to execute the takeover you just see a message labelled "Can't buy company..."
    Wutborough Market Transport, 1963-05-28.sav.zip
@James103
Copy link
Contributor

James103 commented Apr 29, 2024

Can reproduce on b852a3f on Windows 10, 64-bit.

This appears to be related to vehicle limits; increasing the maximum number of vehicles per company for each of the four vehicle types allows the hostile takeover to succeed.

As far as I know, the full error message was/should be "Can't buy company... Too many vehicles in game"

Caused by:

OpenTTD/src/economy.cpp

Lines 2065 to 2066 in cc6e476

/* Disable taking over when not allowed. */
if (!MayCompanyTakeOver(_current_company, target_company)) return CMD_ERROR;
where MayCompanyTakeOver is just a check that the combined vehicle counts don't exceed the currently set limits.

@davewthompson
Copy link
Author

davewthompson commented Apr 30, 2024

Thank you for looking, @James103 ! You're correct - if I increase the maximum vehicle count in the Settings dialog then the takeover works.

Gotta love that comment, too: /* Disable taking over when not allowed. */ !

@2TallTyler 2TallTyler changed the title [Bug]: Can't buy company... error dialog appears when trying to execute a hostile takeover with sufficient funds [Bug]: No descriptive error when hostile takeover fails due to vehicle limit Apr 30, 2024
@2TallTyler 2TallTyler added good first issue Good for newcomers component: interface This is an interface issue labels Apr 30, 2024
2TallTyler added a commit to 2TallTyler/OpenTTD that referenced this issue May 13, 2024
2TallTyler added a commit to 2TallTyler/OpenTTD that referenced this issue May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: interface This is an interface issue good first issue Good for newcomers
Projects
None yet
3 participants