summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorplanetmaker <planetmaker@openttd.org>2012-10-20 21:58:48 +0000
committerplanetmaker <planetmaker@openttd.org>2012-10-20 21:58:48 +0000
commitb446780f01bdf4b01c43204503d38eb191613741 (patch)
tree3895d1f36fa9bc022cc2f7737a619fbcc50b8df7 /src
parent4075b006a0f07099cd43cebb4d38b1e79e57acd6 (diff)
downloadopenttd-b446780f01bdf4b01c43204503d38eb191613741.tar.xz
(svn r24618) -Feature: Pay interest also on a negative cash value (ZxBioHazardZx)
Diffstat (limited to 'src')
-rw-r--r--src/economy.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index 0e7f99b18..2483d7b69 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -774,8 +774,14 @@ static void CompaniesPayInterest()
* what (total) should have been paid up to this month and you subtract
* whatever has been paid in the previous months. This will mean one month
* it'll be a bit more and the other it'll be a bit less than the average
- * monthly fee, but on average it will be exact. */
+ * monthly fee, but on average it will be exact.
+ * In order to prevent cheating or abuse (just not paying interest by not
+ * taking a loan we make companies pay interest on negative cash as well
+ */
Money yearly_fee = c->current_loan * _economy.interest_rate / 100;
+ if (c->money < 0) {
+ yearly_fee += -c->money *_economy.interest_rate / 100;
+ }
Money up_to_previous_month = yearly_fee * _cur_month / 12;
Money up_to_this_month = yearly_fee * (_cur_month + 1) / 12;