Commit ac65734a authored by DailyShana's avatar DailyShana

fix swapping field when observing

parent 16219d2f
......@@ -23,6 +23,7 @@ bufferevent* DuelClient::client_bev = 0;
char DuelClient::duel_client_read[0x2000];
char DuelClient::duel_client_write[0x2000];
bool DuelClient::is_closing = false;
bool DuelClient::is_swapping = false;
int DuelClient::select_hint = 0;
int DuelClient::select_unselect_hint = 0;
int DuelClient::last_select_hint = 0;
......@@ -889,6 +890,12 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
if(mainGame->dInfo.time_player == 1)
mainGame->dInfo.time_player = 2;
if(is_swapping) {
mainGame->gMutex.Lock();
mainGame->dField.ReplaySwap();
mainGame->gMutex.Unlock();
is_swapping = false;
}
switch(mainGame->dInfo.curMsg) {
case MSG_RETRY: {
if(last_successful_msg_length) {
......@@ -3787,6 +3794,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
return true;
}
void DuelClient::SwapField() {
is_swapping = true;
}
void DuelClient::SetResponseI(int respI) {
*((int*)response_buf) = respI;
response_len = 4;
......
......@@ -29,6 +29,7 @@ private:
static char duel_client_read[0x2000];
static char duel_client_write[0x2000];
static bool is_closing;
static bool is_swapping;
static int select_hint;
static int select_unselect_hint;
static int last_select_hint;
......@@ -45,6 +46,7 @@ public:
static int ClientThread(void* param);
static void HandleSTOCPacketLan(char* data, unsigned int len);
static int ClientAnalyze(char* msg, unsigned int len);
static void SwapField();
static void SetResponseI(int respI);
static void SetResponseB(void* respB, unsigned char len);
static void SendResponse();
......
......@@ -91,8 +91,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
soundManager.PlaySoundEffect(SOUND_BUTTON);
if(mainGame->dInfo.isReplay)
ReplayMode::SwapField();
else if (mainGame->dInfo.player_type == 7)
mainGame->dField.ReplaySwap();
else if(mainGame->dInfo.player_type == 7)
DuelClient::SwapField();
break;
}
case BUTTON_REPLAY_UNDO: {
......
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