Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 9, 2017, 3:38:58 PM (7 years ago)
Author:
patricwi
Message:

merged space race with trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/LevelInfo.cc

    r11099 r11356  
    151151    }
    152152
     153    bool LevelInfoItem::addHighscore(const std::string& name, const int score)
     154    {
     155        std::stringstream stream;
     156        stream << name << "/:/" << score;
     157        bool success = this->highscores_.insert(stream.str()).second;
     158        if(success)
     159            this->highscoresUpdated();
     160        return success;
     161    }
     162
    153163    /**
    154164    @brief
     
    191201    }
    192202
     203    void LevelInfoItem::highscoresUpdated(void)
     204    {
     205        std::stringstream stream;
     206        std::set<std::string>::iterator temp;
     207        for(std::set<std::string>::iterator it = this->highscores_.begin(); it != this->highscores_.end(); )
     208        {
     209            temp = it;
     210            if(++it == this->highscores_.end()) // If this is the last tag we don't add a comma.
     211                stream << *temp;
     212            else
     213                stream << *temp << ", ";
     214        }
     215
     216        this->highscoresString_ = std::string(stream.str());
     217    }
    193218    /**
    194219    @brief
Note: See TracChangeset for help on using the changeset viewer.