(svn r1247) -Fix: [ 1090313 ] Shares are now also sold when a company goes bankrupt
authortruelight
Thu, 23 Dec 2004 14:02:40 +0000
changeset 780 f7d6976a1fc8
parent 779 1abefd084ffb
child 781 9717ff353c17
(svn r1247) -Fix: [ 1090313 ] Shares are now also sold when a company goes bankrupt
economy.c
--- a/economy.c	Thu Dec 23 13:53:05 2004 +0000
+++ b/economy.c	Thu Dec 23 14:02:40 2004 +0000
@@ -361,6 +361,24 @@
 		}
 	}
 
+	{
+		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();