summaryrefslogtreecommitdiff
path: root/economy.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-10-14 22:31:18 +0000
committerDarkvater <darkvater@openttd.org>2006-10-14 22:31:18 +0000
commit6b6d908308c9aaf32f7b99500715319aaab1a51c (patch)
tree52f21281bd10b45ef340a15357a04bf130b9b554 /economy.c
parent9732c129c16dea48e69188b75c2e39f9faacf86f (diff)
downloadopenttd-6b6d908308c9aaf32f7b99500715319aaab1a51c.tar.xz
(svn r6776) -Codechange: Use IsValidPlayer() function to determine of a PlayerID is an
actual playable player (< MAX_PLAYERS) or not.
Diffstat (limited to 'economy.c')
-rw-r--r--economy.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/economy.c b/economy.c
index ef96f0893..e61556ed4 100644
--- a/economy.c
+++ b/economy.c
@@ -1543,7 +1543,7 @@ int32 CmdBuyShareInCompany(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
int64 cost;
/* Check if buying shares is allowed (protection against modified clients */
- if (p1 >= MAX_PLAYERS || !_patches.allow_shares) return CMD_ERROR;
+ if (!IsValidPlayer((PlayerID)p1) || !_patches.allow_shares) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_OTHER);
p = GetPlayer(p1);
@@ -1588,7 +1588,7 @@ int32 CmdSellShareInCompany(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
int64 cost;
/* Check if buying shares is allowed (protection against modified clients */
- if (p1 >= MAX_PLAYERS || !_patches.allow_shares) return CMD_ERROR;
+ if (!IsValidPlayer((PlayerID)p1) || !_patches.allow_shares) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_OTHER);
p = GetPlayer(p1);
@@ -1622,7 +1622,7 @@ int32 CmdBuyCompany(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Player *p;
/* Disable takeovers in multiplayer games */
- if (p1 >= MAX_PLAYERS || _networking) return CMD_ERROR;
+ if (!IsValidPlayer((PlayerID)p1) || _networking) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_OTHER);
p = GetPlayer(p1);