FS#6679 - Check Bankruptcy Before Infrastructure Costs

Attached to Project: OpenTTD
Opened by Ricardo (Samu) - Monday, 26 February 2018, 19:39 GMT
Last edited by frosch (frosch) - Sunday, 11 March 2018, 12:46 GMT
Type Patch
Category Core
Status Closed
Assigned To No-one
Operating System All
Severity Very Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Copy paste from

This patch is aimed to prevent very profitable AIs from triggering a bankrupt warning, due to working very close to the loan limit right before entering the new month.

The monthly calculation for infrastructure costs was being done before doing the bankruptcy check. This patch swaps the checking order so that the infrastrucure costs are done after the bankruptcy check. This will avoid many false AI bankrupts.

There is, of course, an impact for human controlled companies as well, but I'm not too sure yet if it's going to adversedly impact competitive games.
This task depends upon

Closed by  frosch (frosch)
Sunday, 11 March 2018, 12:46 GMT
Reason for closing:  Implemented
Additional comments about closing:  in r27981. Thanks for the patch.