summaryrefslogtreecommitdiff
path: root/economy.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2004-12-23 14:02:40 +0000
committertruelight <truelight@openttd.org>2004-12-23 14:02:40 +0000
commit3fa05f42b2f0cda6f62ab7191e96261106340e44 (patch)
treeeda177b6a5d8e6f4d0525b6098945e4e46c25ce0 /economy.c
parent2f2842ec05feb7927f97416d893cb8ce040d19b1 (diff)
downloadopenttd-3fa05f42b2f0cda6f62ab7191e96261106340e44.tar.xz
(svn r1247) -Fix: [ 1090313 ] Shares are now also sold when a company goes bankrupt
Diffstat (limited to 'economy.c')
-rw-r--r--economy.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/economy.c b/economy.c
index 2610ff314..87bfcb551 100644
--- a/economy.c
+++ b/economy.c
@@ -361,6 +361,24 @@ void ChangeOwnershipOfPlayerItems(byte old_player, byte new_player)
}
}
+ {
+ Player *p;
+ uint i;
+
+ /* Check for shares */
+ FOR_ALL_PLAYERS(p) {
+ for(i = 0; i < 4; i++) {
+ /* 'Sell' the share if this player has any */
+ if (p->share_owners[i] == _current_player)
+ p->share_owners[i] = 0xFF;
+ }
+ }
+ p = DEREF_PLAYER(_current_player);
+ /* Sell all the shares that people have on this company */
+ for(i = 0; i < 4; i++)
+ p->share_owners[i] = 0xFF;
+ }
+
_current_player = old;
MarkWholeScreenDirty();