Get rid of two more member values

This commit is contained in:
Benau 2016-05-16 07:54:03 +08:00
parent b5345c8b31
commit 748051871c
2 changed files with 6 additions and 9 deletions

View File

@ -114,8 +114,6 @@ void SoccerWorld::reset()
}
else WorldStatus::setClockMode(CLOCK_CHRONO);
m_red_goal = 0;
m_blue_goal = 0;
m_red_scorers.clear();
m_red_score_times.clear();
m_blue_scorers.clear();
@ -194,10 +192,6 @@ void SoccerWorld::onCheckGoalTriggered(bool first_goal)
if (isRaceOver() || isStartPhase())
return;
// Notice: true first_goal means it's blue goal being shoot,
// so red team can score
(first_goal ? m_red_goal++ : m_blue_goal++);
setPhase(WorldStatus::GOAL_PHASE);
m_goal_sound->play();
if (m_ball_hitter != -1)
@ -220,6 +214,8 @@ void SoccerWorld::onCheckGoalTriggered(bool first_goal)
if (first_goal)
{
// Notice: true first_goal means it's blue goal being shoot,
// so red team can score
m_red_scorers.push_back(sd);
if (race_manager->hasTimeTarget())
{

View File

@ -262,8 +262,6 @@ private:
int m_ball_hitter;
/** Goals data of each team scored */
int m_red_goal;
int m_blue_goal;
std::vector<ScorerData> m_red_scorers;
std::vector<float> m_red_score_times;
std::vector<ScorerData> m_blue_scorers;
@ -331,7 +329,10 @@ public:
SoccerTeam getKartTeam(unsigned int kart_id) const;
// ------------------------------------------------------------------------
int getScore(SoccerTeam team) const
{ return (team == SOCCER_TEAM_BLUE ? m_blue_goal : m_red_goal); }
{
return (team == SOCCER_TEAM_BLUE ? m_blue_scorers.size() :
m_red_scorers.size());
}
// ------------------------------------------------------------------------
const std::vector<ScorerData>& getScorers(SoccerTeam team) const
{ return (team == SOCCER_TEAM_BLUE ? m_blue_scorers : m_red_scorers); }