summaryrefslogtreecommitdiff
path: root/command.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
commit4c9d9a87f18191ae9ae4368176c96b89dd172c8f (patch)
tree52f21281bd10b45ef340a15357a04bf130b9b554 /command.c
parent2380bb56cd4a25eef126153bb6b5ccde8222fc5c (diff)
downloadopenttd-4c9d9a87f18191ae9ae4368176c96b89dd172c8f.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 'command.c')
-rw-r--r--command.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/command.c b/command.c
index 1e00b3183..17fa5490c 100644
--- a/command.c
+++ b/command.c
@@ -383,7 +383,7 @@ error:
if (--_docommand_recursive == 0) {
SubtractMoneyFromPlayer(res);
// XXX - Old AI hack which doesn't use DoCommandDP; update last build coord of player
- if (tile != 0 && _current_player < MAX_PLAYERS) {
+ if (tile != 0 && IsValidPlayer(_current_player)) {
GetPlayer(_current_player)->last_build_coordinate = tile;
}
}
@@ -395,7 +395,7 @@ error:
int32 GetAvailableMoneyForCommand(void)
{
PlayerID pid = _current_player;
- if (pid >= MAX_PLAYERS) return 0x7FFFFFFF; // max int
+ if (!IsValidPlayer(pid)) return 0x7FFFFFFF; // max int
return GetPlayer(pid)->player_money;
}
@@ -508,7 +508,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
#endif /* ENABLE_NETWORK */
// update last build coordinate of player.
- if (tile != 0 && _current_player < MAX_PLAYERS) {
+ if (tile != 0 && IsValidPlayer(_current_player)) {
GetPlayer(_current_player)->last_build_coordinate = tile;
}