]>
Commit | Line | Data |
---|---|---|
1 | #ifndef TOPLIST_H | |
2 | #define TOPLIST_H | |
3 | ||
4 | #include <list> | |
5 | ||
6 | using namespace std; | |
7 | ||
8 | // Forward declaration | |
9 | class Player; | |
10 | ||
11 | class toplist { | |
12 | public: | |
13 | // Default Constructor | |
14 | toplist(); | |
15 | ||
16 | // Constructor with a parameter for the count | |
17 | toplist(int); | |
18 | ||
19 | // Destructor | |
20 | ~toplist(); | |
21 | ||
22 | // Insert the player into the top list if they make it | |
23 | void insertPlayer(Player *); | |
24 | ||
25 | // Set how many players should be in the toplist | |
26 | void setCount(int); | |
27 | int getCount() { return count; }; | |
28 | ||
29 | // Sort the list | |
30 | void sort(); | |
31 | ||
32 | // Prune the list so it's not larger than the count | |
33 | void prune(); | |
34 | ||
35 | list<Player>::iterator top(); | |
36 | ||
37 | private: | |
38 | ||
39 | // The actual list of players | |
40 | list<Player> myList; | |
41 | ||
42 | // The number of players to keep in the list | |
43 | int count; | |
44 | }; | |
45 | #endif |