Commit 40d77767 authored by Chen Bill's avatar Chen Bill Committed by GitHub

fix ClientField::SetResponseSelectedCards (#2605)

parent 6a2deaac
...@@ -2480,11 +2480,14 @@ void ClientField::ShowCardInfoInList(ClientCard* pcard, irr::gui::IGUIElement* e ...@@ -2480,11 +2480,14 @@ void ClientField::ShowCardInfoInList(ClientCard* pcard, irr::gui::IGUIElement* e
} }
} }
void ClientField::SetResponseSelectedCards() const { void ClientField::SetResponseSelectedCards() const {
unsigned char respbuf[SIZE_RETURN_VALUE]; unsigned char respbuf[SIZE_RETURN_VALUE]{};
respbuf[0] = selected_cards.size(); int len = (int)selected_cards.size();
for (size_t i = 0; i < selected_cards.size(); ++i) if (len > UINT8_MAX)
len = UINT8_MAX;
respbuf[0] = (unsigned char)len;
for (int i = 0; i < len; ++i)
respbuf[i + 1] = selected_cards[i]->select_seq; respbuf[i + 1] = selected_cards[i]->select_seq;
DuelClient::SetResponseB(respbuf, selected_cards.size() + 1); DuelClient::SetResponseB(respbuf, len + 1);
} }
void ClientField::SetResponseSelectedOption() const { void ClientField::SetResponseSelectedOption() const {
if(mainGame->dInfo.curMsg == MSG_SELECT_OPTION) { if(mainGame->dInfo.curMsg == MSG_SELECT_OPTION) {
......
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