Commit f00a8704 authored by Chen Bill's avatar Chen Bill

fix ClientCard destructor

parent 5592489c
...@@ -7,9 +7,13 @@ namespace ygo { ...@@ -7,9 +7,13 @@ namespace ygo {
ClientCard::~ClientCard() { ClientCard::~ClientCard() {
ClearTarget(); ClearTarget();
if (equipTarget) if (equipTarget) {
equipTarget->is_showequip = false;
equipTarget->equipped.erase(this); equipTarget->equipped.erase(this);
for (auto card : equipped) { equipTarget = nullptr;
}
for (auto& card : equipped) {
card->is_showequip = false;
card->equipTarget = nullptr; card->equipTarget = nullptr;
} }
equipped.clear(); equipped.clear();
...@@ -21,8 +25,9 @@ ClientCard::~ClientCard() { ...@@ -21,8 +25,9 @@ ClientCard::~ClientCard() {
else else
++it; ++it;
} }
overlayTarget = nullptr;
} }
for (auto card : overlayed) { for (auto& card : overlayed) {
card->overlayTarget = nullptr; card->overlayTarget = nullptr;
} }
overlayed.clear(); overlayed.clear();
...@@ -206,10 +211,6 @@ void ClientCard::ClearData() { ...@@ -206,10 +211,6 @@ void ClientCard::ClearData() {
rscstring[0] = 0; rscstring[0] = 0;
lscstring[0] = 0; lscstring[0] = 0;
counters.clear(); counters.clear();
for (auto card : equipped) {
card->equipTarget = nullptr;
}
equipped.clear();
} }
bool ClientCard::client_card_sort(ClientCard* c1, ClientCard* c2) { bool ClientCard::client_card_sort(ClientCard* c1, ClientCard* c2) {
if(c1->is_selected != c2->is_selected) if(c1->is_selected != c2->is_selected)
......
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