Commit dc609b68 authored by Chen Bill's avatar Chen Bill

fix ranged-based for loop

parent f00a8704
......@@ -19,39 +19,39 @@ ClientField::ClientField() {
}
ClientField::~ClientField() {
for (int i = 0; i < 2; ++i) {
for (auto card : deck[i]) {
for (auto& card : deck[i]) {
delete card;
}
deck[i].clear();
for (auto card : hand[i]) {
for (auto& card : hand[i]) {
delete card;
}
hand[i].clear();
for (auto card : mzone[i]) {
for (auto& card : mzone[i]) {
if (card)
delete card;
card = nullptr;
}
for (auto card : szone[i]) {
for (auto& card : szone[i]) {
if (card)
delete card;
card = nullptr;
}
for (auto card : grave[i]) {
for (auto& card : grave[i]) {
delete card;
}
grave[i].clear();
for (auto card : remove[i]) {
for (auto& card : remove[i]) {
delete card;
}
remove[i].clear();
for (auto card : extra[i]) {
for (auto& card : extra[i]) {
delete card;
}
extra[i].clear();
}
for (auto card : overlay_cards) {
for (auto& card : overlay_cards) {
delete card;
}
overlay_cards.clear();
......
......@@ -1225,7 +1225,7 @@ void Game::RefreshDeck(irr::gui::IGUIComboBox* cbCategory, irr::gui::IGUIComboBo
}
void Game::RefreshDeck(const wchar_t* deckpath, const std::function<void(const wchar_t*)>& additem) {
if(!mywcsncasecmp(deckpath, L"./pack", 6)) {
for(auto pack : deckBuilder.expansionPacks) {
for(auto& pack : deckBuilder.expansionPacks) {
additem(pack.substr(5, pack.size() - 9).c_str());
}
}
......
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