Commit 7f8ff147 authored by VanillaSalt's avatar VanillaSalt

uniq conti_cards

parent ae29e5f2
...@@ -1183,11 +1183,10 @@ bool ClientField::ShowSelectSum(bool panelmode) { ...@@ -1183,11 +1183,10 @@ bool ClientField::ShowSelectSum(bool panelmode) {
} }
bool ClientField::CheckSelectSum() { bool ClientField::CheckSelectSum() {
std::set<ClientCard*> selable; std::set<ClientCard*> selable;
std::set<ClientCard*>::iterator sit; for(auto sit = selectsum_all.begin(); sit != selectsum_all.end(); ++sit) {
for(size_t i = 0; i < selectsum_all.size(); ++i) { (*sit)->is_selectable = false;
selectsum_all[i]->is_selectable = false; (*sit)->is_selected = false;
selectsum_all[i]->is_selected = false; selable.insert(*sit);
selable.insert(selectsum_all[i]);
} }
for(size_t i = 0; i < selected_cards.size(); ++i) { for(size_t i = 0; i < selected_cards.size(); ++i) {
if((int)i < must_select_count) if((int)i < must_select_count)
...@@ -1201,7 +1200,7 @@ bool ClientField::CheckSelectSum() { ...@@ -1201,7 +1200,7 @@ bool ClientField::CheckSelectSum() {
if (select_mode == 0) { if (select_mode == 0) {
bool ret = check_sel_sum_s(selable, 0, select_sumval); bool ret = check_sel_sum_s(selable, 0, select_sumval);
selectable_cards.clear(); selectable_cards.clear();
for(sit = selectsum_cards.begin(); sit != selectsum_cards.end(); ++sit) { for(auto sit = selectsum_cards.begin(); sit != selectsum_cards.end(); ++sit) {
(*sit)->is_selectable = true; (*sit)->is_selectable = true;
selectable_cards.push_back(*sit); selectable_cards.push_back(*sit);
} }
...@@ -1209,9 +1208,9 @@ bool ClientField::CheckSelectSum() { ...@@ -1209,9 +1208,9 @@ bool ClientField::CheckSelectSum() {
} else { } else {
int mm = -1, mx = -1, max = 0, sumc = 0; int mm = -1, mx = -1, max = 0, sumc = 0;
bool ret = false; bool ret = false;
for (size_t i = 0; i < selected_cards.size(); ++i) { for (auto sit = selected_cards.begin(); sit != selected_cards.end(); ++sit) {
int op1 = selected_cards[i]->opParam & 0xffff; int op1 = (*sit)->opParam & 0xffff;
int op2 = selected_cards[i]->opParam >> 16; int op2 = (*sit)->opParam >> 16;
int opmin = (op2 > 0 && op1 > op2) ? op2 : op1; int opmin = (op2 > 0 && op1 > op2) ? op2 : op1;
int opmax = op2 > op1 ? op2 : op1; int opmax = op2 > op1 ? op2 : op1;
if (mm == -1 || opmin < mm) if (mm == -1 || opmin < mm)
...@@ -1225,7 +1224,7 @@ bool ClientField::CheckSelectSum() { ...@@ -1225,7 +1224,7 @@ bool ClientField::CheckSelectSum() {
return true; return true;
if (select_sumval <= max && select_sumval > max - mx) if (select_sumval <= max && select_sumval > max - mx)
ret = true; ret = true;
for(sit = selable.begin(); sit != selable.end(); ++sit) { for(auto sit = selable.begin(); sit != selable.end(); ++sit) {
int op1 = (*sit)->opParam & 0xffff; int op1 = (*sit)->opParam & 0xffff;
int op2 = (*sit)->opParam >> 16; int op2 = (*sit)->opParam >> 16;
int m = op1; int m = op1;
...@@ -1262,14 +1261,14 @@ bool ClientField::CheckSelectSum() { ...@@ -1262,14 +1261,14 @@ bool ClientField::CheckSelectSum() {
} }
} }
selectable_cards.clear(); selectable_cards.clear();
for(sit = selectsum_cards.begin(); sit != selectsum_cards.end(); ++sit) { for(auto sit = selectsum_cards.begin(); sit != selectsum_cards.end(); ++sit) {
(*sit)->is_selectable = true; (*sit)->is_selectable = true;
selectable_cards.push_back(*sit); selectable_cards.push_back(*sit);
} }
return ret; return ret;
} }
} }
bool ClientField::check_min(std::set<ClientCard*>& left, std::set<ClientCard*>::iterator index, int min, int max) { bool ClientField::check_min(const std::set<ClientCard*>& left, std::set<ClientCard*>::const_iterator index, int min, int max) {
if (index == left.end()) if (index == left.end())
return false; return false;
int op1 = (*index)->opParam & 0xffff; int op1 = (*index)->opParam & 0xffff;
......
...@@ -102,7 +102,7 @@ public: ...@@ -102,7 +102,7 @@ public:
void FadeCard(ClientCard* pcard, int alpha, int frame); void FadeCard(ClientCard* pcard, int alpha, int frame);
bool ShowSelectSum(bool panelmode); bool ShowSelectSum(bool panelmode);
bool CheckSelectSum(); bool CheckSelectSum();
bool check_min(std::set<ClientCard*>& left, std::set<ClientCard*>::iterator index, int min, int max); bool check_min(const std::set<ClientCard*>& left, std::set<ClientCard*>::const_iterator index, int min, int max);
bool check_sel_sum_s(const std::set<ClientCard*>& left, int index, int acc); bool check_sel_sum_s(const std::set<ClientCard*>& left, int index, int acc);
void check_sel_sum_t(const std::set<ClientCard*>& left, int acc); void check_sel_sum_t(const std::set<ClientCard*>& left, int acc);
bool check_sum(std::set<ClientCard*>::const_iterator index, std::set<ClientCard*>::const_iterator end, int acc, int count); bool check_sum(std::set<ClientCard*>::const_iterator index, std::set<ClientCard*>::const_iterator end, int acc, int count);
......
...@@ -944,7 +944,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -944,7 +944,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
desc = BufferIO::ReadInt32(pbuf); desc = BufferIO::ReadInt32(pbuf);
pcard = mainGame->dField.GetCard(con, loc, seq); pcard = mainGame->dField.GetCard(con, loc, seq);
mainGame->dField.activatable_cards.push_back(pcard); mainGame->dField.activatable_cards.push_back(pcard);
mainGame->dField.activatable_descs.push_back(std::make_pair(desc,0)); mainGame->dField.activatable_descs.push_back(std::make_pair(desc, 0));
pcard->cmdFlag |= COMMAND_ACTIVATE; pcard->cmdFlag |= COMMAND_ACTIVATE;
if (pcard->location == LOCATION_GRAVE) if (pcard->location == LOCATION_GRAVE)
mainGame->dField.grave_act = true; mainGame->dField.grave_act = true;
......
...@@ -386,18 +386,16 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -386,18 +386,16 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case BUTTON_OPTION_OK: { case BUTTON_OPTION_OK: {
if (mainGame->dInfo.curMsg == MSG_SELECT_OPTION) { if (mainGame->dInfo.curMsg == MSG_SELECT_OPTION) {
DuelClient::SetResponseI(selected_option); DuelClient::SetResponseI(selected_option);
} else if (mainGame->dInfo.curMsg == MSG_SELECT_IDLECMD) {
int index = 0;
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].first != select_options[selected_option]) index++;
DuelClient::SetResponseI(index << 16);
} else { } else {
int index = 0; int index = 0;
while(activatable_cards[index] != command_card || activatable_descs[index].first != select_options[selected_option]) index++; while(activatable_cards[index] != command_card || activatable_descs[index].first != select_options[selected_option]) index++;
DuelClient::SetResponseI(index); if (mainGame->dInfo.curMsg == MSG_SELECT_IDLECMD) {
DuelClient::SetResponseI((index << 16) + 5);
} else if (mainGame->dInfo.curMsg == MSG_SELECT_BATTLECMD) {
DuelClient::SetResponseI(index << 16);
} else {
DuelClient::SetResponseI(index);
}
} }
mainGame->HideElement(mainGame->wOptions, true); mainGame->HideElement(mainGame->wOptions, true);
break; break;
...@@ -487,7 +485,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -487,7 +485,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case POSITION_HINT: { case POSITION_HINT: {
selectable_cards.insert(selectable_cards.end(), conti_cards.begin(), conti_cards.end()); selectable_cards = conti_cards;
std::sort(selectable_cards.begin(), selectable_cards.end());
auto eit = std::unique(selectable_cards.begin(), selectable_cards.end());
selectable_cards.erase(eit, selectable_cards.end());
conti_selecting = true; conti_selecting = true;
break; break;
} }
...@@ -1326,8 +1327,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1326,8 +1327,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
int command_flag = 0; int command_flag = 0;
if(conti_cards.size() == 0) if(conti_cards.size() == 0)
break; break;
if(conti_cards.size()) command_flag |= COMMAND_OPERATION;
command_flag |= COMMAND_OPERATION;
list_command = 1; list_command = 1;
ShowMenu(command_flag, x, y); ShowMenu(command_flag, x, y);
break; break;
......
Subproject commit 6a7087423c889bb51aa92c6bb836b476e9776cdb Subproject commit ccbe898dfe57f5c34e3c659a849255303776cc61
Subproject commit cf2966bca9eeab2dd275da5d2a20e59ac74f23fc Subproject commit 5f3149af08221ef1f8b7a255ec44d5e36e467c07
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