Commit b3940207 authored by mercury233's avatar mercury233 Committed by GitHub

cancel MSG_SELECT_PLACE (#2320)

parent 54a5be68
......@@ -1690,7 +1690,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
case MSG_SELECT_PLACE:
case MSG_SELECT_DISFIELD: {
int selecting_player = BufferIO::ReadInt8(pbuf);
mainGame->dField.select_min = BufferIO::ReadInt8(pbuf);
int count = BufferIO::ReadInt8(pbuf);
mainGame->dField.select_min = count > 0 ? count : 1;
mainGame->dField.select_ready = false;
mainGame->dField.select_cancelable = count == 0;
mainGame->dField.selectable_field = ~BufferIO::ReadInt32(pbuf);
if(selecting_player == mainGame->LocalPlayer(1))
mainGame->dField.selectable_field = (mainGame->dField.selectable_field >> 16) | (mainGame->dField.selectable_field << 16);
......@@ -1765,6 +1768,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
DuelClient::SendResponse();
return true;
}
if(mainGame->dField.select_cancelable) {
mainGame->dField.ShowCancelOrFinishButton(1);
}
return false;
}
case MSG_SELECT_POSITION: {
......
......@@ -1335,6 +1335,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
selected_field = 0;
DuelClient::SetResponseB(respbuf, p);
DuelClient::SendResponse();
ShowCancelOrFinishButton(0);
}
}
}
......@@ -2513,6 +2514,19 @@ void ClientField::CancelOrFinish() {
}
break;
}
case MSG_SELECT_PLACE: {
if(select_cancelable) {
unsigned char respbuf[3];
respbuf[0] = mainGame->LocalPlayer(0);
respbuf[1] = 0;
respbuf[2] = 0;
mainGame->dField.selectable_field = 0;
DuelClient::SetResponseB(respbuf, 3);
DuelClient::SendResponse();
ShowCancelOrFinishButton(0);
}
break;
}
}
}
}
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