(svn r8272) -Fix (r8038): signed/unsigned change - PlayerID is now enum (signed) and was byte so test for PlayerID validity needed to be updated (Darkvater)
authorKUDr
Thu, 18 Jan 2007 23:45:58 +0000
changeset 5729 8f03461d5706
parent 5728 a2169711cf23
child 5730 fee10dbec24d
(svn r8272) -Fix (r8038): signed/unsigned change - PlayerID is now enum (signed) and was byte so test for PlayerID validity needed to be updated (Darkvater)
src/player.h
--- a/src/player.h	Thu Jan 18 22:24:11 2007 +0000
+++ b/src/player.h	Thu Jan 18 23:45:58 2007 +0000
@@ -230,7 +230,7 @@
 
 static inline Player* GetPlayer(PlayerID i)
 {
-	assert(i < (PlayerID)lengthof(_players));
+	assert(IS_INSIDE_1D(i, PLAYER_FIRST, lengthof(_players)));
 	return &_players[i];
 }
 
@@ -241,7 +241,7 @@
 
 static inline bool IsValidPlayer(PlayerID pi)
 {
-	return pi < MAX_PLAYERS;
+	return IS_INSIDE_1D(pi, PLAYER_FIRST, MAX_PLAYERS);
 }
 
 byte GetPlayerRailtypes(PlayerID p);