summaryrefslogtreecommitdiff
path: root/economy.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-09-03 23:02:42 +0000
committerDarkvater <darkvater@openttd.org>2006-09-03 23:02:42 +0000
commit7ab6ae3a21454bf7eb51ed9fea3bed2362b85996 (patch)
tree01ce9615a9875cc5a3537e8d351978ee98ca9bf2 /economy.c
parentf5bda65b05328177340b843127ac05d79f3c33ea (diff)
downloadopenttd-7ab6ae3a21454bf7eb51ed9fea3bed2362b85996.tar.xz
(svn r6369) -Fix (r5886): On loading of game in scenario editor the player was given
the maximum amount of money so everything can be removed for sure. However if first rails are removed (or property in general that *gives* money when demolished, the player's money would overflow. Thanks for noticing Rubidium.
Diffstat (limited to 'economy.c')
-rw-r--r--economy.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/economy.c b/economy.c
index 30d8e8ae8..ec71ccdc4 100644
--- a/economy.c
+++ b/economy.c
@@ -246,9 +246,10 @@ void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player)
_current_player = old_player;
/* Temporarily increase the player's money, to be sure that
- * removing his/her property doesn't fail because of lack of money */
+ * removing his/her property doesn't fail because of lack of money.
+ * Not too drastically though, because it could overflow */
if (new_player == OWNER_SPECTATOR) {
- GetPlayer(old_player)->money64 = ((uint64)-1)>>1; // jackpot ;p
+ GetPlayer(old_player)->money64 = MAX_UVALUE(uint64) >>2; // jackpot ;p
UpdatePlayerMoney32(GetPlayer(old_player));
}