]> jfr.im git - irc/gameservirc.git/blob - gameserv/toplist.h
Updated the TODO list to reflect changes
[irc/gameservirc.git] / gameserv / toplist.h
1 #ifndef TOPLIST_H
2 #define TOPLIST_H
3
4 #include <list>
5 #include <string>
6 #include "player.h"
7
8 using namespace std;
9
10 // Forward declaration
11 class Player;
12 class aClient;
13 class Monster;
14 class item;
15
16 class PlayerWrapper
17 {
18 public:
19 PlayerWrapper();
20 PlayerWrapper(Player *pl);
21 ~PlayerWrapper();
22
23 void setPlayer(Player *pl);
24
25 string getName() { return p->getName(); };
26 int getLevel() { return p->getLevel(); };
27 long int getExp() { return p->getExp(); };
28 long int getGold() { return p->getGold(); };
29 long int getBank() { return p->getBank(); };
30 int getHP() { return p->getHP(); };
31 int getMaxHP() { return p->getMaxHP(); };
32 int getStrength() { return p->getStrength(); };
33 int getDefense() { return p->getDefense(); };
34 int getForestFights() { return p->getForestFights(); };
35 int getPlayerFights() { return p->getPlayerFights(); };
36 string getPassword() { return p->getPassword(); };
37
38 aClient *getClient() { return p->getClient(); };
39 Monster *getMonster() { return p->getMonster(); };
40 Monster *getMaster() { return p->getMaster(); };
41 aClient *getBattle() { return p->getBattle(); };
42
43 bool operator < (PlayerWrapper &right);
44
45 private:
46 Player *p;
47 };
48
49 class toplist
50 {
51 public:
52 // Default Constructor
53 toplist();
54
55 // Constructor with a parameter for the count
56 toplist(int);
57
58 // Destructor
59 ~toplist();
60
61 // Insert the player into the top list if they make it
62 void insertPlayer(Player *);
63
64 // Set how many players should be in the toplist
65 void setCount(int);
66 int getCount() { return count; };
67
68 // Sort the list
69 void sort();
70
71 // Prune the list so it's not larger than the count
72 void prune();
73
74 void reverse();
75
76 list<PlayerWrapper>::iterator begin();
77 list<PlayerWrapper>::iterator end();
78 bool empty();
79
80 private:
81
82 // The actual list of players
83 list<PlayerWrapper> myList;
84
85 // The number of players to keep in the list
86 int count;
87 };
88
89
90
91 #endif