home *** CD-ROM | disk | FTP | other *** search
- #ifndef __HISCORE_H__
- #define __HISCORE_H__
-
- #include <vector>
- #include <String.hpp>
-
- class Hiscore
- {
- public:
- class Entry
- {
- int score;
- String player_name;
- public:
- Entry(const String & player_name, int score)
- : player_name( player_name ),
- score( score )
- {}
- Entry()
- : score( 0 )
- {}
- const String & get_player_name()const
- {
- return player_name;
- }
- int get_score()const
- {
- return score;
- }
- bool operator<(const Entry & entry)const
- {
- return score < entry.score;
- }
- };
- explicit Hiscore( int max_entries );
- virtual ~Hiscore();
- void add_entry( const Entry & entry );
- const Entry & get_entry( int number )const;
- int get_worst_score()const;
- private:
- void save()const;
- void load();
-
- const int max_entries;
- std::vector<Entry> entries;
- };
-
- #endif //__HISCORE_H__