Commit fcc2c697 authored by Chen Bill's avatar Chen Bill

update lambda in ClientCard::client_card_sort()

parent 08ad9137
...@@ -220,23 +220,26 @@ bool ClientCard::client_card_sort(ClientCard* c1, ClientCard* c2) { ...@@ -220,23 +220,26 @@ bool ClientCard::client_card_sort(ClientCard* c1, ClientCard* c2) {
return cp1 < cp2; return cp1 < cp2;
if(c1->location != c2->location) if(c1->location != c2->location)
return c1->location < c2->location; return c1->location < c2->location;
if(c1->location & LOCATION_OVERLAY) if (c1->location & LOCATION_OVERLAY) {
if(c1->overlayTarget != c2->overlayTarget) if (c1->overlayTarget != c2->overlayTarget)
return c1->overlayTarget->sequence < c2->overlayTarget->sequence; return c1->overlayTarget->sequence < c2->overlayTarget->sequence;
else return c1->sequence < c2->sequence; else
return c1->sequence < c2->sequence;
}
else { else {
if(c1->location & (LOCATION_DECK | LOCATION_GRAVE | LOCATION_REMOVED | LOCATION_EXTRA)) { if(c1->location & (LOCATION_DECK | LOCATION_GRAVE | LOCATION_REMOVED | LOCATION_EXTRA)) {
auto it1 = std::find_if(mainGame->dField.chains.rbegin(), mainGame->dField.chains.rend(), [c1](const auto& ch) { auto it1 = std::find_if(mainGame->dField.chains.rbegin(), mainGame->dField.chains.rend(), [c1](const ChainInfo& ch) {
return c1 == ch.chain_card || ch.target.find(c1) != ch.target.end(); return c1 == ch.chain_card || ch.target.find(c1) != ch.target.end();
}); });
auto it2 = std::find_if(mainGame->dField.chains.rbegin(), mainGame->dField.chains.rend(), [c2](const auto& ch) { auto it2 = std::find_if(mainGame->dField.chains.rbegin(), mainGame->dField.chains.rend(), [c2](const ChainInfo& ch) {
return c2 == ch.chain_card || ch.target.find(c2) != ch.target.end(); return c2 == ch.chain_card || ch.target.find(c2) != ch.target.end();
}); });
if(it1 != mainGame->dField.chains.rend() || it2 != mainGame->dField.chains.rend()) { if(it1 != mainGame->dField.chains.rend() || it2 != mainGame->dField.chains.rend()) {
return it1 < it2; return it1 < it2;
} }
return c1->sequence > c2->sequence; return c1->sequence > c2->sequence;
} else }
else
return c1->sequence < c2->sequence; return c1->sequence < c2->sequence;
} }
} }
......
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