1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #pragma once
- #include <Array.h>
- #include <Critical.h>
- #include <InMemoryBuffer.h>
- #include <Thread.h>
- class Player;
- class FCKlient;
- class NetworkMessage;
- class GameClient : public Framework::Thread
- {
- private:
- Player* zPlayer;
- FCKlient* client;
- Framework::Critical background;
- Framework::Critical foreground;
- Framework::Critical other;
- Framework::RCArray<Framework::InMemoryBuffer> requests;
- Framework::RCArray<NetworkMessage> backgroundQueue;
- Framework::RCArray<NetworkMessage> foregroundQueue;
- Framework::Synchronizer foregroundQueueSync;
- Framework::Synchronizer backgroundQueueSync;
- Framework::Critical queueCs;
- Framework::Synchronizer emptyForegroundQueueSync;
- Framework::Synchronizer emptyBackgroundQueueSync;
- int viewDistance;
- bool first;
- bool online;
- bool finished;
- bool backgroundFinished;
- bool foregroundFinished;
- public:
- GameClient(Player* zPlayer, FCKlient* client);
- ~GameClient();
- void thread() override;
- void reply();
- void logout();
- void addMessage(Framework::StreamReader* reader);
- bool isOnline() const;
- void sendResponse(NetworkMessage* response);
- Player* zEntity() const;
- void sendTypes();
- class Message
- {
- public:
- inline static const unsigned char TERMINATE = 1;
- inline static const unsigned char WORLD_UPDATE = 2;
- inline static const unsigned char API_MESSAGE = 3;
- inline static const unsigned char POSITION_UPDATE = 4;
- };
- };
|