Add order= parameter for ScoreboardEndTakeRule

master
krzys-h 2017-05-18 20:39:32 +02:00
parent 6bebbb3f70
commit 327eafddb7
2 changed files with 6 additions and 1 deletions

View File

@ -47,6 +47,7 @@ void CScoreboard::CScoreboardEndTakeRule::Read(CLevelParserLine* line)
{
CScoreboardRule::Read(line);
this->team = line->GetParam("team")->AsInt(0);
this->order = line->GetParam("order")->AsInt(0);
}
void CScoreboard::AddKillRule(std::unique_ptr<CScoreboardKillRule> rule)
@ -75,9 +76,11 @@ void CScoreboard::ProcessKill(CObject* target, CObject* killer)
void CScoreboard::ProcessEndTake(int team)
{
m_finishCounter++;
for (auto& rule : m_rulesEndTake)
{
if (rule->team == team || rule->team == 0)
if ((rule->team == team || rule->team == 0) &&
(rule->order == m_finishCounter || rule->order == 0))
{
AddPoints(team, rule->score);
}

View File

@ -94,6 +94,7 @@ public:
{
public:
int team = 0;
int order = 0;
//! Read from line in scene file
void Read(CLevelParserLine* line) override;
@ -117,4 +118,5 @@ private:
std::vector<std::unique_ptr<CScoreboardKillRule>> m_rulesKill = {};
std::vector<std::unique_ptr<CScoreboardEndTakeRule>> m_rulesEndTake = {};
std::map<int, int> m_score;
int m_finishCounter = 0;
};