Ignore:
Timestamp:
10/03/2008 07:39:43 AM (4 years ago)
Author:
guyru
Message:
  • Add "Clear", "Configure" buttons to Highscores Dialog, add ability to resize the Highscores list and clear it.

Fix the date formatting when submitting to Highscores list.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/configuration.cpp

    r163 r167  
    2121#include <iostream> 
    2222#include <cstdlib> // used in the back-compatibility code 
     23#include <sstream> 
    2324#include "configuration.h" 
    2425#include "../config.h" 
     
    103104        string date,hour,name; 
    104105        HighscoreItem temp_item; 
     106 
     107        temp_chr = file->get(); 
     108        file->unget(); 
     109 
    105110        while(file->good()) { 
    106111                temp_chr = file->get(); 
     
    323328                return 0; 
    324329        } 
     330        save(); 
    325331        return place; 
    326332} 
     
    331337        return ptr; 
    332338} 
     339 
     340void Configuration::clearHighscores() 
     341{ 
     342        m_highscores.clear(); 
     343        save(); 
     344} 
     345 
     346void Configuration::setHighscoresSize(int size) 
     347{ 
     348 
     349        std::ostringstream o; 
     350        o << size; 
     351        m_settings["highscore-list-size"] = o.str(); 
     352 
     353        while (m_highscores.size()>size) { 
     354                m_highscores.pop_back(); 
     355        } 
     356 
     357        save(); 
     358} 
Note: See TracChangeset for help on using the changeset viewer.