Advertisement
Guest User

waitlist.h

a guest
Apr 14th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. ////////////////////////////////////////////////////////////////////////
  2. // OpenTibia - an opensource roleplaying game
  3. ////////////////////////////////////////////////////////////////////////
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. ////////////////////////////////////////////////////////////////////////
  17.  
  18. #ifndef __WAITLIST__
  19. #define __WAITLIST__
  20.  
  21. struct Wait
  22. {
  23. uint32_t ip;
  24. std::string name;
  25. bool premium;
  26. int64_t timeout;
  27. };
  28. typedef std::list<Wait*> WaitList;
  29.  
  30. class Player;
  31. class WaitingList
  32. {
  33. public:
  34. virtual ~WaitingList() {waitList.clear();}
  35. static WaitingList* getInstance()
  36. {
  37. static WaitingList waitingList;
  38. return &waitingList;
  39. }
  40.  
  41. bool login(const Player* player);
  42. int32_t getSlot(const Player* player);
  43.  
  44. static int32_t getTime(int32_t slot);
  45.  
  46. protected:
  47. WaitingList() {}
  48. void cleanup();
  49.  
  50. WaitList::iterator find(const Player* player, uint32_t& slot);
  51. int32_t getTimeout(int32_t slot) {return getTime(slot) + 15;}
  52.  
  53. WaitList waitList;
  54. };
  55. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement