Commit 4ef45c84 authored by Chen Bill's avatar Chen Bill Committed by GitHub

update DuelClient (#2634)

parent ced64065
......@@ -14,7 +14,7 @@ namespace ygo {
unsigned DuelClient::connect_state = 0;
unsigned char DuelClient::response_buf[SIZE_RETURN_VALUE];
unsigned int DuelClient::response_len = 0;
size_t DuelClient::response_len = 0;
unsigned int DuelClient::watching = 0;
unsigned char DuelClient::selftype = 0;
bool DuelClient::is_host = false;
......@@ -27,7 +27,7 @@ int DuelClient::select_hint = 0;
int DuelClient::select_unselect_hint = 0;
int DuelClient::last_select_hint = 0;
unsigned char DuelClient::last_successful_msg[0x2000];
unsigned int DuelClient::last_successful_msg_length = 0;
size_t DuelClient::last_successful_msg_length = 0;
wchar_t DuelClient::event_string[256];
mt19937 DuelClient::rnd;
......@@ -4000,11 +4000,11 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
void DuelClient::SwapField() {
is_swapping = true;
}
void DuelClient::SetResponseI(int respI) {
void DuelClient::SetResponseI(int32_t respI) {
std::memcpy(response_buf, &respI, sizeof respI);
response_len = 4;
response_len = sizeof respI;
}
void DuelClient::SetResponseB(void* respB, unsigned int len) {
void DuelClient::SetResponseB(void* respB, size_t len) {
if (len > SIZE_RETURN_VALUE)
len = SIZE_RETURN_VALUE;
std::memcpy(response_buf, respB, len);
......
......@@ -16,7 +16,7 @@ class DuelClient {
private:
static unsigned int connect_state;
static unsigned char response_buf[SIZE_RETURN_VALUE];
static unsigned int response_len;
static size_t response_len;
static unsigned int watching;
static bool is_host;
static event_base* client_base;
......@@ -28,7 +28,7 @@ private:
static int select_unselect_hint;
static int last_select_hint;
static unsigned char last_successful_msg[0x2000];
static unsigned int last_successful_msg_length;
static size_t last_successful_msg_length;
static wchar_t event_string[256];
static mt19937 rnd;
static bool is_refreshing;
......@@ -47,8 +47,8 @@ public:
static void HandleSTOCPacketLan(unsigned char* data, int len);
static int ClientAnalyze(unsigned char* msg, unsigned int len);
static void SwapField();
static void SetResponseI(int respI);
static void SetResponseB(void* respB, unsigned int len);
static void SetResponseI(int32_t respI);
static void SetResponseB(void* respB, size_t len);
static void SendResponse();
static void SendPacketToServer(unsigned char proto) {
auto p = duel_client_write;
......
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