Commit 1e1b0da8 authored by Chen Bill's avatar Chen Bill Committed by GitHub

DuelClient: move protected members to private (#2630)

* DuelClient: move protected members to private

* use intptr_t
parent 49aa79af
...@@ -118,9 +118,9 @@ void DuelClient::ClientRead(bufferevent* bev, void* ctx) { ...@@ -118,9 +118,9 @@ void DuelClient::ClientRead(bufferevent* bev, void* ctx) {
} }
delete[] duel_client_read; delete[] duel_client_read;
} }
void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) { void DuelClient::ClientEvent(bufferevent* bev, short events, void* ctx) {
if (events & BEV_EVENT_CONNECTED) { if (events & BEV_EVENT_CONNECTED) {
bool create_game = (size_t)ctx != 0; bool create_game = (intptr_t)ctx;
CTOS_PlayerInfo cspi; CTOS_PlayerInfo cspi;
BufferIO::CopyCharArray(mainGame->ebNickName->getText(), cspi.name); BufferIO::CopyCharArray(mainGame->ebNickName->getText(), cspi.name);
SendPacketToServer(CTOS_PLAYER_INFO, cspi); SendPacketToServer(CTOS_PLAYER_INFO, cspi);
......
...@@ -31,13 +31,18 @@ private: ...@@ -31,13 +31,18 @@ private:
static unsigned int last_successful_msg_length; static unsigned int last_successful_msg_length;
static wchar_t event_string[256]; static wchar_t event_string[256];
static mt19937 rnd; static mt19937 rnd;
static bool is_refreshing;
static int match_kill;
static event* resp_event;
static std::set<std::pair<unsigned int, unsigned short>> remotes;
public: public:
static unsigned char selftype; static unsigned char selftype;
static bool StartClient(unsigned int ip, unsigned short port, bool create_game = true); static bool StartClient(unsigned int ip, unsigned short port, bool create_game = true);
static void ConnectTimeout(evutil_socket_t fd, short events, void* arg); static void ConnectTimeout(evutil_socket_t fd, short events, void* arg);
static void StopClient(bool is_exiting = false); static void StopClient(bool is_exiting = false);
static void ClientRead(bufferevent* bev, void* ctx); static void ClientRead(bufferevent* bev, void* ctx);
static void ClientEvent(bufferevent *bev, short events, void *ctx); static void ClientEvent(bufferevent* bev, short events, void* ctx);
static int ClientThread(); static int ClientThread();
static void HandleSTOCPacketLan(unsigned char* data, int len); static void HandleSTOCPacketLan(unsigned char* data, int len);
static int ClientAnalyze(unsigned char* msg, unsigned int len); static int ClientAnalyze(unsigned char* msg, unsigned int len);
...@@ -73,13 +78,7 @@ public: ...@@ -73,13 +78,7 @@ public:
std::memcpy(p, buffer, blen); std::memcpy(p, buffer, blen);
bufferevent_write(client_bev, duel_client_write, blen + 3); bufferevent_write(client_bev, duel_client_write, blen + 3);
} }
protected:
static bool is_refreshing;
static int match_kill;
static event* resp_event;
static std::set<std::pair<unsigned int, unsigned short>> remotes;
public:
static std::vector<HostPacket> hosts; static std::vector<HostPacket> hosts;
static void BeginRefreshHost(); static void BeginRefreshHost();
static int RefreshThread(event_base* broadev); static int RefreshThread(event_base* broadev);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment