OpenTTD

Tasklist

FS#4725 - Console: loan commands

Attached to Project: OpenTTD
Opened by aditsu (aditsu) - Sunday, 14 August 2011, 14:20 GMT
Last edited by andythenorth (andythenorth) - Thursday, 31 August 2017, 21:10 GMT
Type Feature Request
Category Core
Status With patch
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version 1.1.1
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 1
Private No

Details

When inflation goes very high, e.g. a Lev4 engine costs $180 million, borrowing and repaying through the finances window becomes very cumbersome.
Yes, there's ctrl-click, but it borrows or repays everything, and that either increases the interest too much, or sends the money into the negative in a fraction of a second with at least one running vehicle, requiring lots of clicks to keep it positive.
My suggestion is to add 2 commands that can be used in the console: borrow <amount> and repay <amount>
where amount can be a number, or a number with a suffix (k = thousands, m = millions)
This task depends upon

Comment by Matt D. (monoid) - Thursday, 15 September 2011, 14:13 GMT
I don't think the console is the appropriate place to put such manual-loan-amount-setting functionality; instead it should be added to the existing loan increase/decrease section of the company finance GUI.

Here are two patches that implement that.

The first patch merges together the two command handlers CMD_INCREASE_LOAN and CMD_DECREASE_LOAN, replacing them with CMD_SET_LOAN. This has the following advantages:
* Less (virtually duplicated) code
* Makes more sense than having two command handlers which take delta loan amounts instead of a direct loan amount (IMO!)
* The new command takes the new loan amount to set as a parameter, instead of the *change* in loan amount requested. This helps in the (admittedly, very) edge case where two users request loan amount changes in a single company at the same time. If i.e. both users request loan increases, the new command ensures that only one increase is made, instead of two, which was not either user's intent.

The second patch adds the 'set loan amount' button to the company finances GUI, and is reasonably self-explanatory. Clicking it produces a query string window, asking for the new desired loan amount, which will be rounded up to the nearest LOAN_INTERVAL and set (if a valid value).
Comment by Matt D. (monoid) - Thursday, 15 September 2011, 14:25 GMT
I really need to start using git properly, instead of SVN >_>

Fixed a few missing chunks in patch 2.

Loading...