diff --git a/projects/mtg/bin/daily_build/template.exe b/projects/mtg/bin/daily_build/template.exe index f73e2f553..e956a86d6 100644 Binary files a/projects/mtg/bin/daily_build/template.exe and b/projects/mtg/bin/daily_build/template.exe differ diff --git a/projects/mtg/include/DeckDataWrapper.h b/projects/mtg/include/DeckDataWrapper.h index 935ffb338..d7eeb22a6 100644 --- a/projects/mtg/include/DeckDataWrapper.h +++ b/projects/mtg/include/DeckDataWrapper.h @@ -30,7 +30,6 @@ class DeckDataWrapper: public WSrcDeck { int counts[Constants::MTG_NB_COLORS]; DeckDataWrapper(MTGDeck * deck); - ~DeckDataWrapper(); int Add(MTGCard * c, int quantity=1); int Remove(MTGCard * c, int quantity=1, bool erase=false); diff --git a/projects/mtg/src/DeckDataWrapper.cpp b/projects/mtg/src/DeckDataWrapper.cpp index f414db526..ad84e99c7 100644 --- a/projects/mtg/src/DeckDataWrapper.cpp +++ b/projects/mtg/src/DeckDataWrapper.cpp @@ -58,11 +58,8 @@ void DeckDataWrapper::updateCounts(){ } } void DeckDataWrapper::save(){ - Rebuild(parent); - parent->save(); + if(parent){ + Rebuild(parent); + parent->save(); + } } - - -DeckDataWrapper::~DeckDataWrapper(){ - SAFE_DELETE(parent); -} \ No newline at end of file diff --git a/projects/mtg/src/GameStateShop.cpp b/projects/mtg/src/GameStateShop.cpp index 8984dbd84..0b008db6d 100644 --- a/projects/mtg/src/GameStateShop.cpp +++ b/projects/mtg/src/GameStateShop.cpp @@ -70,16 +70,12 @@ void GameStateShop::Start(){ booster = NULL; srcCards = NEW WSrcUnlockedCards(.25); srcCards->setElapsed(15); - WCFilterFactory * wff = WCFilterFactory::GetInstance(); - - //srcCards->addFilter(wff->Construct("c:red;&t:instant;")); - //srcCards->bakeFilters(); bigSync = 0; shopMenu = NEW WGuiMenu(PSP_CTRL_DOWN,PSP_CTRL_UP,true,&bigSync); MTGAllCards * ac = GameApp::collection; playerdata = NEW PlayerData(ac);; - myCollection = NEW DeckDataWrapper(NEW MTGDeck(options.profileFile(PLAYER_COLLECTION).c_str(), ac)); + myCollection = NEW DeckDataWrapper(playerdata->collection); pricelist = NEW PriceList(RESPATH"/settings/prices.dat",ac); for(int i=0;igetCard(controlId-BOOSTER_SLOTS); if(!c || !c->data || playerdata->credits - mPrices[controlId] < 0) return; - playerdata->collection->add(c); myCollection->Add(c); playerdata->credits -= mPrices[controlId]; mCounts[controlId]++; @@ -279,6 +274,7 @@ void GameStateShop::purchaseBooster(int controlId){ myCollection->Add(booster); makeDisplay(booster); + mTouched = true; save(true); SAFE_DELETE(pool); menu->Close(); @@ -333,10 +329,12 @@ void GameStateShop::load(){ void GameStateShop::save(bool force) { if(mTouched || force){ - if(pricelist) - pricelist->save(); + if(myCollection) + myCollection->Rebuild(playerdata->collection); if(playerdata) playerdata->save(); + if(pricelist) + pricelist->save(); } mTouched = false; }