simplechatgame.h 1.3 KB

1234567891011121314151617181920212223242526272829
  1. #ifndef __SIMPLECHATGAME_H
  2. #define __SIMPLECHATGAME_H
  3. #include "datablock.h"
  4. #include "biglist.h"
  5. #include "chatclient.h"
  6. #include "message.h"
  7. #include "simplechatgameuser.h"
  8. class chatclient;
  9. class simplechatgame:public idisposable
  10. {
  11. public:
  12. simplechatgame();
  13. ~simplechatgame();
  14. biglist<simplechatgameuser *> users; // Users who are using this game.
  15. datablock *gameid; // Used for users to tell each other the game id to join the game.
  16. datablock *gamedata; // Common data for the game such as whose turn it is or where the game pieces are.
  17. biglist_item<simplechatgameuser *> *add_user(chatclient *client,datastring username); // Adds a user to users. Returns true if successful.
  18. bool add_client(chatclient *client,datastring username); // Adds a client. Returns true if the client was added.
  19. void send_message_to_clients(message *message,chatclient *me);
  20. biglist_item<simplechatgameuser *> *getuser(chatclient *client); // Search user by client.
  21. biglist_item<simplechatgameuser *> *getuser(datastring username); // Search user by username.
  22. int usercount(bool withclient); // Returns the number of users. If withclient is true then only count users that are connected.
  23. void send_user_list_to_clients(); // Sends the list of users to all the clients.
  24. simplechatgame *clone();
  25. };
  26. #endif