MinigameServer.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #pragma once
  2. #include <Server.h>
  3. #include <Thread.h>
  4. #include <Datei.h>
  5. #include <Text.h>
  6. #include <InitDatei.h>
  7. #include "Datenbank.h"
  8. using namespace Framework;
  9. using namespace Network;
  10. class MSKlient;
  11. class MinigameServer : public Thread
  12. {
  13. private:
  14. Server* server;
  15. SSLServer* aServer;
  16. InitDatei* ini;
  17. MSDatenbank* db;
  18. CRITICAL_SECTION cs;
  19. RCArray< MSKlient >* klients;
  20. Text* fehler;
  21. int id;
  22. bool nichtPausiert;
  23. int empfangen;
  24. int gesendet;
  25. bool end;
  26. public:
  27. // Konstruktor
  28. MinigameServer(InitDatei* zIni);
  29. // Destruktor
  30. virtual ~MinigameServer();
  31. // nicht constant
  32. void runn();
  33. void thread();
  34. void close();
  35. bool serverStarten();
  36. bool serverPause();
  37. bool serverFortsetzen();
  38. bool serverBeenden();
  39. bool setMaxKlients(int mc);
  40. bool absturzKlient(int klientId);
  41. bool removeKlient(MSKlient* zKlient);
  42. void addGesendet(int bytes);
  43. void addEmpfangen(int bytes);
  44. // conatant
  45. bool istAn() const;
  46. Server* zServer() const;
  47. MSDatenbank* zDB() const;
  48. bool hatClients() const;
  49. int getId() const;
  50. const char* getLetzterFehler() const;
  51. InitDatei* zInit() const;
  52. };
  53. class MSAKlient : public Thread
  54. {
  55. private:
  56. SSLSKlient* klient;
  57. Text* name;
  58. Text* passwort;
  59. int adminId;
  60. MinigameServer* ms;
  61. int version;
  62. public:
  63. // Konstruktor
  64. MSAKlient(SSLSKlient* klient, MinigameServer* ls);
  65. // Destruktor
  66. virtual ~MSAKlient();
  67. // nicht constant
  68. void thread();
  69. void errorZuKlient(const char* nachricht) const; // sendet eine Fehlernachricht zum AKlient
  70. };
  71. class MSKlient : public Thread
  72. {
  73. private:
  74. SKlient* klient;
  75. unsigned int klientNummer;
  76. MinigameServer* ms;
  77. public:
  78. // Konstruktor
  79. MSKlient(SKlient* klient, MinigameServer* ls);
  80. // Destruktor
  81. virtual ~MSKlient();
  82. // nicht constant
  83. void absturz();
  84. void thread();
  85. // constant
  86. void errorZuKlient(const char* nachricht) const; // sendet eine Fehlernachricht zum Klient
  87. int getKlientNummer() const;
  88. };