level.num*Clients (in g_main.c:CalculateRanks) isn't very straight forward and has some bugs, I think. Anyway, I'll put patches related to level.num*Clients here.
Created attachment 1205[details]
new level.num*Clients counting
CalculateRanks
I think this is much more straight forward. It's also about 40% smaller.
Mostly what I did is changed team variables so the various things should be more accurate. I also removed level.follow1 and level.follow2 since they were unused (though, if I understand their purpose, having them working would be really cool).
I still don't like that
if( level.clients[ i ].sess.sessionTeam != TEAM_SPECTATOR )
but when I used
if( level.clients[ i ].pers.classSelection != PCL_NONE )
games would not end as a win on some systems. That rather discouraged me from trying to find another alternative, especially since this seems to work fine.
Created attachment 1206[details]
level.numConnectedClients -> level.numVotingClients
Currently, CheckTeamVote correctly uses level.numteamVotingClients, but CheckVote uses level.numConnectedClients. If we assume level.numConnectedClients != level.numVotingClients (normally spectators can't vote), this is wrong.
Changes level.numConnectedClients to level.numVotingClients in CheckVote.
Created attachment 1307[details]
updated CalculateRanks patch
It is possible that voting will be changed again in the future (or that someone wants to use their own way to figure out who can vote). Likewise, level.numVotingClients should be used instead of level.numConnectedClients even though they should currently have the same value (as this patch ensures). This patch is updated for the behavior in svn 925 (all connected players can vote) and fixes the level.numConnectedClients count.
Created attachment 1354[details]
fix a couple potential issues
This puts level.numConnectedClients back in the right spot, moves level.numVotingClients so that only players who are fully connected vote, and makes level.numNonSpectatorClients more literal. (It also makes checking if there are players who aren't fully connected as easy as level.numConnectedClients != level.numVotingClients.)
As far as I can tell, the only real issue is that !listplayers reports the wrong number.
Created attachment 1205 [details] new level.num*Clients counting CalculateRanks I think this is much more straight forward. It's also about 40% smaller. Mostly what I did is changed team variables so the various things should be more accurate. I also removed level.follow1 and level.follow2 since they were unused (though, if I understand their purpose, having them working would be really cool). I still don't like that if( level.clients[ i ].sess.sessionTeam != TEAM_SPECTATOR ) but when I used if( level.clients[ i ].pers.classSelection != PCL_NONE ) games would not end as a win on some systems. That rather discouraged me from trying to find another alternative, especially since this seems to work fine.
Created attachment 1206 [details] level.numConnectedClients -> level.numVotingClients Currently, CheckTeamVote correctly uses level.numteamVotingClients, but CheckVote uses level.numConnectedClients. If we assume level.numConnectedClients != level.numVotingClients (normally spectators can't vote), this is wrong. Changes level.numConnectedClients to level.numVotingClients in CheckVote.
Created attachment 1307 [details] updated CalculateRanks patch It is possible that voting will be changed again in the future (or that someone wants to use their own way to figure out who can vote). Likewise, level.numVotingClients should be used instead of level.numConnectedClients even though they should currently have the same value (as this patch ensures). This patch is updated for the behavior in svn 925 (all connected players can vote) and fixes the level.numConnectedClients count.
Created attachment 1354 [details] fix a couple potential issues This puts level.numConnectedClients back in the right spot, moves level.numVotingClients so that only players who are fully connected vote, and makes level.numNonSpectatorClients more literal. (It also makes checking if there are players who aren't fully connected as easy as level.numConnectedClients != level.numVotingClients.) As far as I can tell, the only real issue is that !listplayers reports the wrong number.