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

Fix #9281: acquire a company uses special bookkeeping to make you rich #9300

Merged
merged 1 commit into from May 29, 2021

Conversation

TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented May 27, 2021

Fixes #9281

Motivation / Problem

Company buy-out is a bit weird. See #9281 for my analysis on the subject.

Description

When you buy-out a company, you got your shares back. This is
based on company-value, which includes values for the vehicles etc.
In other words, you not only got the vehicles, but you also got
paid to get them back.

Additionally, you also got the loan of the company, but not the
money for the loan (as that is subtracted from the company-value).

Solve this by changing the rules of a buy-out: don't sell your
shares, get the loan AND the balance and get the infrastructure.

Limitations

This might surprise existing players, as their current tricks to get rich fast no longer work.

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@James103
Copy link
Contributor

Theoretically, this could mean that you could bankrupt yourself by buying out a company that was already going to bankrupt soon, as you could take on their debt causing your company's net worth to fall below negative the max loan. Are there any real examples of that happening?

@rubidium42
Copy link
Contributor

I agree with not repaying shares, as you "paid" that money to get the shares from some other share holder.

The other change with getting the bank balance and repaying the loan definitely sounds right to me. However, I agree with James that we might want to make it slightly less dangerous for players. After all, if you buy a company for cheap with huge debts, then you are in real problems if your cash flow is not enough. This command would then be the only command which allows you to get into a negative bank balance.

It can be solved by adding/"subtracting" the loan and bank balance to the cost of the merger. Something along the lines of https://gist.github.com/rubidium42/6d4ce350095f2fcb4435feb3ac4e581f will prevent you from getting broke attempting to buy out a company with a lot of debt. The difference does end up in the EXPENSES_OTHER category of the finance window, so that might have some repercussions somewhere else.

@TrueBrain
Copy link
Member Author

It can be solved by adding/"subtracting" the loan and bank balance to the cost of the merger. Something along the lines of https://gist.github.com/rubidium42/6d4ce350095f2fcb4435feb3ac4e581f will prevent you from getting broke attempting to buy out a company with a lot of debt. The difference does end up in the EXPENSES_OTHER category of the finance window, so that might have some repercussions somewhere else.

Mostly as reminder to myself, the above patch uses the company balance too soon: a company can have shares in other companies, which have to be sold off first and can alter the company balance. It simply means there is some more refactoring to do.
I also think that a solution like this would make it really unclear if you are short in money how it got to that amount, so I think we need to split this up into two errors .. 1 about not having the money to buy the shares, and 1 about not having the money to buy off the company.
I will thinker with this some more soon :)

@rubidium42
Copy link
Contributor

.... a company can have shares in other companies, which have to be sold off first and can alter the company balance...

Why do the shares in other companies need to be sold? Aren't you buying all assets, including shares the other company has?
Granted, when thinking about it the problem still holds for the shares the company you buy out has in your company. Though that quickly gets into a weird infinite feedback loop with valuations and the likes, which might be exploited in some other manner.
So maybe the "easier" solution would be that you may only buy/have shares of companies that do not have a share in you? Though possibly not really part of this PR.

@TrueBrain
Copy link
Member Author

Why do the shares in other companies need to be sold? Aren't you buying all assets, including shares the other company has?
Granted, when thinking about it the problem still holds for the shares the company you buy out has in your company. Though that quickly gets into a weird infinite feedback loop with valuations and the likes, which might be exploited in some other manner.
So maybe the "easier" solution would be that you may only buy/have shares of companies that do not have a share in you? Though possibly not really part of this PR.

I am happy you went through these motions ;)

We have to sell the shares, as indeed otherwise you all of a sudden can have shares to your own company. Not allowing to buy shares in a company that has shares in yours is rather odd, as that would mean the best way to prevent any players from buying your company if you go bankrupt is ensuring you have 25% shares in them .. which becomes really hard to explain to players :P

The other issue is recursion: it otherwise means that buying company A can also leads you to buy company B, C, D, etc, because your total shares are now 100%. This becomes .. "difficult", especially to check if you have the money to buy all those .. and explaining that to the user will be a field-day.

So no, I like the current system, where it simply sells the shares the company that is being acquired has. Simple, efficient, a lot less explaining to the user :D So yeah, if anything, not for this PR :D

@TrueBrain
Copy link
Member Author

Okay, after some fiddling, I figured out this is a much deeper rabbit hole than I would like. So I went back to an easier solution.

The only thing this PR now changes is that instead of selling back your shares, you get the balance of the company you bought. This means you can get a loan over the max-loan after taking over a company (but that was already the case, so not a regression of this PR).

If we want to fix this properly, we really need to fix several UI elements. For example, when buying shares it is unclear what it will cost you or how it comes up with the number. You need to understand it is a % of the company value, but that is not clear. Next, when you buy 100%, we could use a small GUI that tells you what is going to happen: shares being sold, paying off the loan, what is left over for you. And that you can accept that or not.

Personally I have no problem with that you can buy a company that is nearly bankrupt; it might have a lot of infrastructure you plan to sell, for example.

But all this work is a lot more than the effort I am currently willing to spend on this PR, so I focused on addressing the issue presented, and that is a much smaller and easier fix :)

…you rich

When you buy-out a company, you got your shares back. This is
based on company-value, which includes values for the vehicles etc.
In other words, you not only got the vehicles, but you also got
paid to get them back.

Additionally, you also got the loan of the company, but not the
money for the loan (as that is subtracted from the company-value).

Solve this by changing the rules of a buy-out: don't sell your
shares, get the loan AND the balance and get the infrastructure.
@TrueBrain TrueBrain merged commit 4d74e51 into OpenTTD:master May 29, 2021
@TrueBrain TrueBrain deleted the dont-transfer-loan branch May 29, 2021 09:21
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 this pull request may close these issues.

Company Takeover Maths not correct.
3 participants