switch (stat_no)
{
case 0:
- caption_buf = _("Max coins collected:");
- stat_buf = coins_to_string(coins, total_coins);
- break;
+ caption_buf = _("Max coins collected:");
+ stat_buf = coins_to_string(coins, total_coins);
+ break;
case 1:
- caption_buf = _("Max fragging:");
- stat_buf = frags_to_string(badguys, total_badguys);
- break;
+ caption_buf = _("Max fragging:");
+ stat_buf = frags_to_string(badguys, total_badguys);
+ break;
case 2:
- caption_buf = _("Min time needed:");
- stat_buf = time_to_string(time);
- break;
+ caption_buf = _("Min time needed:");
+ stat_buf = time_to_string(time);
+ break;
case 3:
- caption_buf = _("Max secrets found:");
- stat_buf = secrets_to_string(secrets, total_secrets);
- break;
+ caption_buf = _("Max secrets found:");
+ stat_buf = secrets_to_string(secrets, total_secrets);
+ break;
default:
- log_debug << "Invalid stat requested to be drawn" << std::endl;
- break;
+ log_debug << "Invalid stat requested to be drawn" << std::endl;
+ break;
}
context.draw_text(white_small_text, caption_buf, Vector(WMAP_INFO_LEFT_X, posy), ALIGN_LEFT, LAYER_GUI);
}
void
-Statistics::merge(Statistics& s2)
+Statistics::merge(const Statistics& s2)
{
if (!s2.valid) return;
coins = std::max(coins, s2.coins);
}
std::string
-Statistics::coins_to_string(int coins, int total_coins) const {
+Statistics::coins_to_string(int coins, int total_coins) {
std::ostringstream os;
os << std::min(coins, 999) << "/" << std::min(total_coins, 999);
return os.str();
}
std::string
-Statistics::frags_to_string(int badguys, int total_badguys) const {
+Statistics::frags_to_string(int badguys, int total_badguys) {
std::ostringstream os;
os << std::min(badguys, 999) << "/" << std::min(total_badguys, 999);
return os.str();
}
std::string
-Statistics::time_to_string(float time) const {
+Statistics::time_to_string(float time) {
int time_csecs = std::min(static_cast<int>(time * 100), 99 * 6000 + 9999);
int mins = (time_csecs / 6000);
int secs = (time_csecs % 6000) / 100;
}
std::string
-Statistics::secrets_to_string(int secrets, int total_secrets) const {
+Statistics::secrets_to_string(int secrets, int total_secrets) {
std::ostringstream os;
os << std::min(secrets, 999) << "/" << std::min(total_secrets, 999);
return os.str();