add assertion to catch too many players

This commit is contained in:
Eric House 2017-11-16 07:13:10 -08:00
parent 607567cd35
commit 9d02237f19

View file

@ -2284,6 +2284,7 @@ main( int argc, char** argv )
break;
case CMD_PLAYERNAME:
index = mainParams.pgi.nPlayers++;
XP_ASSERT( index < MAX_NUM_PLAYERS );
++mainParams.nLocalPlayers;
mainParams.pgi.players[index].robotIQ = 0; /* means human */
mainParams.pgi.players[index].isLocal = XP_TRUE;
@ -2292,6 +2293,7 @@ main( int argc, char** argv )
break;
case CMD_REMOTEPLAYER:
index = mainParams.pgi.nPlayers++;
XP_ASSERT( index < MAX_NUM_PLAYERS );
mainParams.pgi.players[index].isLocal = XP_FALSE;
++mainParams.info.serverInfo.nRemotePlayers;
break;
@ -2302,6 +2304,7 @@ main( int argc, char** argv )
case CMD_ROBOTNAME:
++robotCount;
index = mainParams.pgi.nPlayers++;
XP_ASSERT( index < MAX_NUM_PLAYERS );
++mainParams.nLocalPlayers;
mainParams.pgi.players[index].robotIQ = 1; /* real smart by default */
mainParams.pgi.players[index].isLocal = XP_TRUE;