[colobot] 62/100: Add order= parameter for ScoreboardEndTakeRule

Didier Raboud odyx at moszumanska.debian.org
Thu Jun 1 18:10:19 UTC 2017


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch debian/master
in repository colobot.

commit 327eafddb7f1d20cf16f4f9ba9a08dde368cdc8d
Author: krzys-h <krzys_h at interia.pl>
Date:   Thu May 18 20:39:32 2017 +0200

    Add order= parameter for ScoreboardEndTakeRule
---
 src/level/scoreboard.cpp | 5 ++++-
 src/level/scoreboard.h   | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/level/scoreboard.cpp b/src/level/scoreboard.cpp
index bb78aae..dc86eee 100644
--- a/src/level/scoreboard.cpp
+++ b/src/level/scoreboard.cpp
@@ -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);
         }
diff --git a/src/level/scoreboard.h b/src/level/scoreboard.h
index c0c2512..17aa98e 100644
--- a/src/level/scoreboard.h
+++ b/src/level/scoreboard.h
@@ -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;
 };
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git



More information about the Pkg-games-commits mailing list