From: <pat...@us...> - 2014-07-06 05:21:13
|
Revision: 384 http://sourceforge.net/p/simspark/svn/384 Author: patmac369 Date: 2014-07-06 05:21:04 +0000 (Sun, 06 Jul 2014) Log Message: ----------- Fixing a bug where rules such as too many players in their own penalty area was not being enforced. Modified Paths: -------------- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2014-06-24 20:58:27 UTC (rev 383) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2014-07-06 05:21:04 UTC (rev 384) @@ -548,27 +548,26 @@ for(int unum=1; unum<=11; unum++) { TPlayMode playMode = mGameState->GetPlayMode(); - if ((playMode == PM_KickOff_Left && idx != TI_LEFT) - || (playMode == PM_KickOff_Right && idx != TI_RIGHT) - || (playMode != PM_KickOff_Left && playMode != PM_KickOff_Right)) + bool checkCrowding = (playMode == PM_KickOff_Left && idx != TI_LEFT) + || (playMode == PM_KickOff_Right && idx != TI_RIGHT) + || (playMode != PM_KickOff_Left && playMode != PM_KickOff_Right); + + // I am the third closest player but i am too near the ball (and not the goalie) + if (checkCrowding && unum != 1 && closestPlayerDist[idx2] < mMinOppDistance + && (distArr[unum][idx] <= mMin3PlDistance + 0.01 + && ordArr[unum][idx] == 3)) { - // I am the third closest player but i am too near the ball (and not the goalie) - if (unum != 1 && closestPlayerDist[idx2] < mMinOppDistance - && (distArr[unum][idx] <= mMin3PlDistance + 0.01 - && ordArr[unum][idx] == 3)) - { playerFoulTime[unum][idx]++; playerLastFoul[unum][idx] = FT_Crowding; - } - // I am the second closest player but i am too near the ball (and not the goalie) - else if (unum != 1 && closestPlayerDist[idx2] < mMinOppDistance - && distArr[unum][idx] <= mMin2PlDistance + 0.01 - && ordArr[unum][idx] == 2) - { + } + // I am the second closest player but i am too near the ball (and not the goalie) + else if (checkCrowding && unum != 1 && closestPlayerDist[idx2] < mMinOppDistance + && distArr[unum][idx] <= mMin2PlDistance + 0.01 + && ordArr[unum][idx] == 2) + { playerFoulTime[unum][idx]++; playerLastFoul[unum][idx] = FT_Crowding; - } - } + } // Too many players inside my own penalty area and Im am the last one to enter or // the last one to enter was the goalie and I am the one further away from own goal else if((numPlInsideOwnArea[idx] > mMaxPlayersInsideOwnArea && unum != 1 && playerInsideOwnArea[unum][idx] == 1 && This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |