Commit f54dcd0a authored by DailyShana's avatar DailyShana

fix MSG_SELECT_CHAIN

parent 64f6ff07
......@@ -37,9 +37,7 @@ public:
std::vector<ClientCard*> activatable_cards;
std::vector<ClientCard*> attackable_cards;
std::vector<ClientCard*> conti_cards;
std::vector<int> activatable_descs;
std::set<int> reset_descs;
std::set<int> conti_descs;
std::vector<std::pair<int,int>> activatable_descs;
std::vector<int> select_options;
std::vector<ChainInfo> chains;
int extra_p_count[2];
......
......@@ -943,7 +943,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
desc = BufferIO::ReadInt32(pbuf);
pcard = mainGame->dField.GetCard(con, loc, seq);
mainGame->dField.activatable_cards.push_back(pcard);
mainGame->dField.activatable_descs.push_back(desc);
mainGame->dField.activatable_descs.push_back(std::make_pair(desc,0));
pcard->cmdFlag |= COMMAND_ACTIVATE;
if (pcard->location == LOCATION_GRAVE)
mainGame->dField.grave_act = true;
......@@ -1057,7 +1057,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
desc = BufferIO::ReadInt32(pbuf);
pcard = mainGame->dField.GetCard(con, loc, seq);
mainGame->dField.activatable_cards.push_back(pcard);
mainGame->dField.activatable_descs.push_back(desc);
mainGame->dField.activatable_descs.push_back(std::make_pair(desc, 0));
pcard->cmdFlag |= COMMAND_ACTIVATE;
if (pcard->location == LOCATION_GRAVE)
mainGame->dField.grave_act = true;
......@@ -1204,8 +1204,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.activatable_cards.clear();
mainGame->dField.activatable_descs.clear();
mainGame->dField.conti_cards.clear();
mainGame->dField.reset_descs.clear();
mainGame->dField.conti_descs.clear();
for (int i = 0; i < count; ++i) {
int flag = BufferIO::ReadInt8(pbuf);
code = BufferIO::ReadInt32(pbuf);
......@@ -1216,22 +1214,19 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
desc = BufferIO::ReadInt32(pbuf);
pcard = mainGame->dField.GetCard(c, l, s, ss);
mainGame->dField.activatable_cards.push_back(pcard);
mainGame->dField.activatable_descs.push_back(desc);
mainGame->dField.activatable_descs.push_back(std::make_pair(desc, flag));
pcard->is_selected = false;
if(flag == 0x1) {
if(flag == EDESC_OPERATION) {
pcard->is_conti = true;
pcard->chain_code = code;
mainGame->dField.conti_cards.push_back(pcard);
mainGame->dField.conti_act = true;
mainGame->dField.conti_descs.insert(desc);
conti_exist = true;
} else {
pcard->chain_code = code;
pcard->is_selectable = true;
if(flag == 0x2) {
if(flag == EDESC_RESET)
pcard->cmdFlag |= COMMAND_RESET;
mainGame->dField.reset_descs.insert(desc);
}
else
pcard->cmdFlag |= COMMAND_ACTIVATE;
if(l == LOCATION_GRAVE)
......
......@@ -388,15 +388,15 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
DuelClient::SetResponseI(selected_option);
} else if (mainGame->dInfo.curMsg == MSG_SELECT_IDLECMD) {
int index = 0;
while(activatable_cards[index] != command_card || activatable_descs[index] != select_options[selected_option]) index++;
while(activatable_cards[index] != command_card || activatable_descs[index].first != select_options[selected_option]) index++;
DuelClient::SetResponseI((index << 16) + 5);
} else if (mainGame->dInfo.curMsg == MSG_SELECT_BATTLECMD) {
int index = 0;
while(activatable_cards[index] != command_card || activatable_descs[index] != select_options[selected_option]) index++;
while(activatable_cards[index] != command_card || activatable_descs[index].first != select_options[selected_option]) index++;
DuelClient::SetResponseI(index << 16);
} else {
int index = 0;
while(activatable_cards[index] != command_card || activatable_descs[index] != select_options[selected_option]) index++;
while(activatable_cards[index] != command_card || activatable_descs[index].first != select_options[selected_option]) index++;
DuelClient::SetResponseI(index);
}
mainGame->HideElement(mainGame->wOptions, true);
......@@ -430,14 +430,14 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
select_options.clear();
for (size_t i = 0; i < activatable_cards.size(); ++i) {
if (activatable_cards[i] == clicked_card) {
if(conti_descs.find(activatable_descs[i]) != conti_descs.end())
if(activatable_descs[i].second == EDESC_OPERATION)
continue;
if(reset_descs.find(activatable_descs[i]) != reset_descs.end()) {
if(activatable_descs[i].second == EDESC_RESET) {
if(id == BUTTON_CMD_ACTIVATE) continue;
} else {
if(id == BUTTON_CMD_RESET) continue;
}
select_options.push_back(activatable_descs[i]);
select_options.push_back(activatable_descs[i].first);
if (index == -1) index = i;
}
}
......@@ -708,12 +708,12 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
select_options.clear();
for (size_t i = 0; i < activatable_cards.size(); ++i) {
if (activatable_cards[i] == command_card) {
if(conti_descs.find(activatable_descs[i]) != conti_descs.end()) {
if(activatable_descs[i].second == EDESC_OPERATION) {
if(list_command == COMMAND_ACTIVATE) continue;
} else {
if(list_command == COMMAND_OPERATION) continue;
}
select_options.push_back(activatable_descs[i]);
select_options.push_back(activatable_descs[i].first);
if (index == -1) index = i;
}
}
......
Subproject commit 886141f3960660a10d1ecd99ccbc745b61a16b51
Subproject commit 9b3dbc2c28d1e4f37d24cd1779cac93f59674e45
Subproject commit 69d9a3241eb9841fb3433e45d2c43cf13d5f9412
Subproject commit caba7e1f82e5286e5ed165f9aea46cb798e019df
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