Improve documentation of PLAYER.allocated field. Improve asserts for indexing into some player methods.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7826 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
5b45d1ac9c
commit
b86f0f85cc
|
@ -188,7 +188,7 @@ typedef struct
|
|||
char name[StringSize]; ///< Player name
|
||||
int32_t position; ///< Map starting position
|
||||
int32_t colour; ///< Which colour slot this player is using
|
||||
BOOL allocated; ///< Active?
|
||||
BOOL allocated; ///< Allocated as a human player
|
||||
uint32_t heartattacktime; ///< Time cardiac arrest started
|
||||
BOOL heartbeat; ///< If we are still alive or not
|
||||
BOOL kick; ///< If we should kick them
|
||||
|
|
|
@ -433,7 +433,7 @@ BASE_OBJECT *IdToPointer(UDWORD id,UDWORD player)
|
|||
// return a players name.
|
||||
const char* getPlayerName(unsigned int player)
|
||||
{
|
||||
ASSERT(player < MAX_PLAYERS , "Wrong player index: %u", player);
|
||||
ASSERT_OR_RETURN(NULL, player < MAX_PLAYERS , "Wrong player index: %u", player);
|
||||
|
||||
if (game.type != CAMPAIGN)
|
||||
{
|
||||
|
@ -454,14 +454,8 @@ const char* getPlayerName(unsigned int player)
|
|||
|
||||
BOOL setPlayerName(UDWORD player, const char *sName)
|
||||
{
|
||||
if(player > MAX_PLAYERS)
|
||||
{
|
||||
ASSERT(false, "setPlayerName: wrong player index (%d)", player);
|
||||
return false;
|
||||
}
|
||||
|
||||
strcpy(playerName[player],sName);
|
||||
|
||||
ASSERT_OR_RETURN(false, player < MAX_PLAYERS, "Player index (%u) out of range", player);
|
||||
sstrcpy(playerName[player], sName);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -469,11 +463,7 @@ BOOL setPlayerName(UDWORD player, const char *sName)
|
|||
// to determine human/computer players and responsibilities of each..
|
||||
BOOL isHumanPlayer(UDWORD player)
|
||||
{
|
||||
if (player >= MAX_PLAYERS)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ASSERT_OR_RETURN(false, player < MAX_PLAYERS, "Player index (%u) out of range", player);
|
||||
return NetPlay.players[player].allocated;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue