summaryrefslogtreecommitdiff
path: root/economy.c
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2005-01-13 09:55:32 +0000
committercelestar <celestar@openttd.org>2005-01-13 09:55:32 +0000
commit9a287d932dc0faf2a7c71c4b638b6bbac3aefcf6 (patch)
treea218ffe27e662b0a4825f394ea30cc9f577897c8 /economy.c
parent3887cc2e90658e5aa68f5dedf1acd8aaad75c3dc (diff)
downloadopenttd-9a287d932dc0faf2a7c71c4b638b6bbac3aefcf6.tar.xz
(svn r1495) -Fix: Loan does not count against the company value
-Feature: New companies receive a 5-year protection period
Diffstat (limited to 'economy.c')
-rw-r--r--economy.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/economy.c b/economy.c
index b25e13cfa..018a5892c 100644
--- a/economy.c
+++ b/economy.c
@@ -105,10 +105,9 @@ int64 CalculateCompanyValue(Player *p) {
}
}
- if (p->player_money > 0)
- value += p->money64; // add real money value
-
- return value;
+ value += p->money64 - p->current_loan; // add real money value
+
+ return max(value, 1);
}
// if update is set to true, the economy is updated with this score
@@ -1533,6 +1532,12 @@ int32 CmdBuyShareInCompany(int x, int y, uint32 flags, uint32 p1, uint32 p2)
SET_EXPENSES_TYPE(EXPENSES_OTHER);
p = DEREF_PLAYER(p1);
+
+
+ if (_cur_year - p->inaugurated_year < 6) {
+ _error_message = STR_7080_PROTECTED;
+ return CMD_ERROR;
+ }
/* Check if buying shares is allowed (protection against modified clients */
if (!_patches.allow_shares)