Server.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 "Game.h"
  8. using namespace Framework;
  9. using namespace Network;
  10. class FCKlient;
  11. class GameClient;
  12. class FactoryCraftServer : virtual public ReferenceCounter
  13. {
  14. private:
  15. SSLServer *server;
  16. InitDatei *ini;
  17. CRITICAL_SECTION cs;
  18. RCArray< FCKlient > *klients;
  19. Game *game;
  20. int klientAnzahl;
  21. int id;
  22. int empfangen;
  23. int gesendet;
  24. public:
  25. // Konstruktor
  26. FactoryCraftServer( InitDatei *zIni );
  27. // Destruktor
  28. virtual ~FactoryCraftServer();
  29. // nicht constant
  30. void run();
  31. void close();
  32. bool absturzKlient( int accountId );
  33. bool removeKlient( FCKlient *zKlient );
  34. void addGesendet( int bytes );
  35. void addEmpfangen( int bytes );
  36. bool hatClients() const;
  37. Game *zGame() const;
  38. };
  39. class FCKlient : public Thread
  40. {
  41. private:
  42. SSLSKlient *klient;
  43. unsigned int accountId;
  44. FactoryCraftServer *ls;
  45. GameClient *zGameClient;
  46. NetworkReader *reader;
  47. NetworkWriter *writer;
  48. public:
  49. // Konstruktor
  50. FCKlient( SSLSKlient *klient, FactoryCraftServer *ls );
  51. // Destruktor
  52. virtual ~FCKlient();
  53. // nicht constant
  54. void absturz();
  55. void thread();
  56. // constant
  57. int getAccountId() const;
  58. SSLSKlient *zClient() const;
  59. NetworkWriter *zWriter() const;
  60. };