economy.c
changeset 930 524b02923ede
parent 919 b0d6c7642f99
child 967 cd64c19d3de4
--- a/economy.c	Fri Jan 07 18:13:56 2005 +0000
+++ b/economy.c	Fri Jan 07 23:59:59 2005 +0000
@@ -1533,13 +1533,18 @@
 	SET_EXPENSES_TYPE(EXPENSES_OTHER);
 	p = DEREF_PLAYER(p1);
 
+	/* Check if buying shares is allowed (protection against modified clients */
+	if (!_patches.allow_shares)
+		return CMD_ERROR;
+
 	/* Those lines are here for network-protection (clients can be slow) */
 	if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 0)
 		return 0;
+
 	/* We can not buy out a real player in networking */
 	if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 1 && !p->is_ai)
 		return 0;
-
+	
 	cost = CalculateCompanyValue(p) >> 2;
 	if (flags & DC_EXEC) {
 		b = p->share_owners;
@@ -1567,6 +1572,10 @@
 	SET_EXPENSES_TYPE(EXPENSES_OTHER);
 	p = DEREF_PLAYER(p1);
 
+	/* Check if selling shares is allowed (protection against modified clients */
+	if (!_patches.allow_shares)
+		return CMD_ERROR;
+		
 	/* Those lines are here for network-protection (clients can be slow) */
 	if (GetAmountOwnedBy(p, _current_player) == 0)
 		return 0;