Fix PlayerStageStats::SetLifeRecordAt to broadcast correct message for the player. Also adds Message::Message(MessageID) constructor.

This commit is contained in:
Kyzentun
2014-08-06 04:41:05 -06:00
parent 84a8d3adfb
commit 6be879f06d
6 changed files with 51 additions and 4 deletions
+21 -2
View File
@@ -25,8 +25,12 @@ const float LESSON_PASS_THRESHOLD = 0.8f;
Grade GetGradeFromPercent( float fPercent );
void PlayerStageStats::Init()
void PlayerStageStats::InternalInit()
{
m_for_multiplayer= false;
m_player_number= PLAYER_1;
m_multiplayer_number= MultiPlayer_P1;
m_bPlayerCanAchieveFullCombo = true;
m_bJoined = false;
m_vpPossibleSteps.clear();
@@ -67,6 +71,18 @@ void PlayerStageStats::Init()
m_HighScore = HighScore();
}
void PlayerStageStats::Init(PlayerNumber pn)
{
m_for_multiplayer= false;
m_player_number= pn;
}
void PlayerStageStats::Init(MultiPlayer pn)
{
m_for_multiplayer= true;
m_multiplayer_number= pn;
}
void PlayerStageStats::AddStats( const PlayerStageStats& other )
{
m_bJoined = other.m_bJoined;
@@ -353,7 +369,10 @@ void PlayerStageStats::SetLifeRecordAt( float fLife, float fStepsSecond )
// fSecond will always be greater than any value already in the map.
m_fLifeRecord[fStepsSecond] = fLife;
MESSAGEMAN->Broadcast( Message_LifeMeterChangedP1 );
Message msg(static_cast<MessageID>(Message_LifeMeterChangedP1+m_player_number));
msg.SetParam("Life", fLife);
msg.SetParam("StepsSecond", fStepsSecond);
MESSAGEMAN->Broadcast(msg);
// Memory optimization:
// If we have three consecutive records A, B, and C all with the same fLife,