File tree Expand file tree Collapse file tree 2 files changed +8
-18
lines changed
GeneralsMD/Code/GameEngine/Source/GameNetwork
Generals/Code/GameEngine/Source/GameNetwork Expand file tree Collapse file tree 2 files changed +8
-18
lines changed Original file line number Diff line number Diff line change @@ -907,16 +907,11 @@ void NAT::processManglerResponse(UnsignedShort mangledPort) {
907907// check to see if we've completed all the rounds
908908// this is kind of a cheesy way to check, but it works.
909909Bool NAT::allConnectionsDone () {
910- if ((m_numNodes == 2 && m_connectionRound >= 1 ) ||
911- (m_numNodes == 3 && m_connectionRound >= 3 ) ||
912- (m_numNodes == 4 && m_connectionRound >= 3 ) ||
913- (m_numNodes == 5 && m_connectionRound >= 5 ) ||
914- (m_numNodes == 6 && m_connectionRound >= 5 ) ||
915- (m_numNodes == 7 && m_connectionRound >= 7 ) ||
916- (m_numNodes == 8 && m_connectionRound >= 7 )) {
917- return TRUE ;
910+ if (m_numNodes < 2 ) {
911+ return FALSE ;
918912 }
919- return FALSE ;
913+ const Int requiredRounds = (m_numNodes & 1 ) ? m_numNodes : m_numNodes - 1 ;
914+ return m_connectionRound >= requiredRounds;
920915}
921916
922917Bool NAT::allConnectionsDoneThisRound () {
Original file line number Diff line number Diff line change @@ -907,16 +907,11 @@ void NAT::processManglerResponse(UnsignedShort mangledPort) {
907907// check to see if we've completed all the rounds
908908// this is kind of a cheesy way to check, but it works.
909909Bool NAT::allConnectionsDone () {
910- if ((m_numNodes == 2 && m_connectionRound >= 1 ) ||
911- (m_numNodes == 3 && m_connectionRound >= 3 ) ||
912- (m_numNodes == 4 && m_connectionRound >= 3 ) ||
913- (m_numNodes == 5 && m_connectionRound >= 5 ) ||
914- (m_numNodes == 6 && m_connectionRound >= 5 ) ||
915- (m_numNodes == 7 && m_connectionRound >= 7 ) ||
916- (m_numNodes == 8 && m_connectionRound >= 7 )) {
917- return TRUE ;
910+ if (m_numNodes < 2 ) {
911+ return FALSE ;
918912 }
919- return FALSE ;
913+ const Int requiredRounds = (m_numNodes & 1 ) ? m_numNodes : m_numNodes - 1 ;
914+ return m_connectionRound >= requiredRounds;
920915}
921916
922917Bool NAT::allConnectionsDoneThisRound () {
You can’t perform that action at this time.
0 commit comments