Commit dc609b68 authored by Chen Bill's avatar Chen Bill

fix ranged-based for loop

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