00001
00002
00003
00004
00005
00006
00007
00008 #ifndef _CHATROOM_H_
00009 #define _CHATROOM_H_
00010
00011 #include <iostream>
00012 #include <list>
00013 #include "Game.h"
00014 #include "Player.h"
00015
00016 #ifdef CCXX_NAMESPACES
00017 using namespace std;
00018 using namespace ost;
00019 #endif
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 class ChatRoom : public Game {
00032 public:
00033 ChatRoom(void);
00034 ChatRoom(Player *);
00035 virtual ~ChatRoom(void);
00036 void init(void);
00037 void run(void);
00038 void final(void);
00039 void addPlayer (Player *);
00040 bool delPlayer (const string &);
00041 int getNumPlayers (void) const;
00042 void printPlayersList(iostream *);
00043 string getName(void) const;
00044
00045 protected:
00046 void sayToAll(const string&, Player * = NULL);
00047 void delPlayer (Player *);
00048
00049 private:
00050
00051 list<Player *> playerList;
00052
00053 Mutex mutex;
00054
00055 };
00056
00057
00058 #endif //_CHATROOM_H_