News:

Use the "Forum Search"
It may help you to find anything in the forum ;).

Company suddenly thrown into administration

Started by Matthew, March 04, 2023, 05:29:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Matthew

Steps to reproduce

1. Load Huitsi's save from here
2. Switch to Inland Railways
3. Fast-forward to the start of the next month
 

Expected result

Company is indebted but solvent

Actual result

Company suddenly goes into administration

Observations

Here are Inland Railways' finances in the month following that save:



Their Credit and Solvency Limits decreased very rapidly at the start of this month (July 1835) and so they go into administration. I don't know why this was; they had not had any capital expenditure the previous month to suddenly change their position.

Messages appeared about being unable to cover the cost of way repairs, but I'd expect that was a consequence rather than a cause of the loss of credit.

Opinion

The company was heavily indebted and in real life you can imagine a sudden crisis of confidence bringing it down. I am not opposed to having companies going to administration against players' will. But from a game play perspective it's not ideal that the Credit and Solvency Limits changed so suddenly. The "Net Wealth warning" appeared in the Finances window the previous month, but there's no message about that, so you wouldn't know unless you visited the Finances window. And the company was fundamentally solvent anyway - it was covering its interest with operating profits, with some left over to repay the capital of the loan if it wished.


(Signature being tested) If you enjoy playing Simutrans, then you might also enjoy watching Japan Railway Journal
Available in English and simplified Chinese
如果您喜欢玩Simutrans的话,那么说不定就想看《日本铁路之旅》(英语也有简体中文字幕)。

TurfIt

-21013066.80  suspiciously like a 32bit int max negative with some scaling...

void finance_t::calc_credit_limits()
{

...

// The player gets the better of the two credit limits.  Remember that they are negative.
sint64 hard_credit_limit = min(hard_limit_by_profits, hard_limit_by_assets);

min() is using int, not sint64. Suggest std::min() instead. And completely excising the evil Simutrans min/max() functions.

jamespetts

Thank you for your report. I believe that I have now fixed this. I should be grateful if you could re-test with the next nightly build.

(And TurfIt was correct about the cause of the problem: changing to std::min() worked here).
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Huitsi

Than you everyone, I'm saved! IR has indeed regained the trust of it's creditors.

Matthew

Thank you for fixing this bug so quickly, James.

The code now correctly handles the original test case:



The save has been run for two months and has not gone into administration.

And if you continue a save from after Inland Railways went into administration, then the company will exit administration at the start of the next month:



Therefore the bug appears to have been completely fixed!  :thumbsup:
(Signature being tested) If you enjoy playing Simutrans, then you might also enjoy watching Japan Railway Journal
Available in English and simplified Chinese
如果您喜欢玩Simutrans的话,那么说不定就想看《日本铁路之旅》(英语也有简体中文字幕)。