Jeck - Fix for booster pack purchases not saving.
This commit is contained in:
Binary file not shown.
@@ -30,7 +30,6 @@ class DeckDataWrapper: public WSrcDeck {
|
|||||||
int counts[Constants::MTG_NB_COLORS];
|
int counts[Constants::MTG_NB_COLORS];
|
||||||
|
|
||||||
DeckDataWrapper(MTGDeck * deck);
|
DeckDataWrapper(MTGDeck * deck);
|
||||||
~DeckDataWrapper();
|
|
||||||
|
|
||||||
int Add(MTGCard * c, int quantity=1);
|
int Add(MTGCard * c, int quantity=1);
|
||||||
int Remove(MTGCard * c, int quantity=1, bool erase=false);
|
int Remove(MTGCard * c, int quantity=1, bool erase=false);
|
||||||
|
|||||||
@@ -58,11 +58,8 @@ void DeckDataWrapper::updateCounts(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DeckDataWrapper::save(){
|
void DeckDataWrapper::save(){
|
||||||
Rebuild(parent);
|
if(parent){
|
||||||
parent->save();
|
Rebuild(parent);
|
||||||
|
parent->save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DeckDataWrapper::~DeckDataWrapper(){
|
|
||||||
SAFE_DELETE(parent);
|
|
||||||
}
|
|
||||||
@@ -70,16 +70,12 @@ void GameStateShop::Start(){
|
|||||||
booster = NULL;
|
booster = NULL;
|
||||||
srcCards = NEW WSrcUnlockedCards(.25);
|
srcCards = NEW WSrcUnlockedCards(.25);
|
||||||
srcCards->setElapsed(15);
|
srcCards->setElapsed(15);
|
||||||
WCFilterFactory * wff = WCFilterFactory::GetInstance();
|
|
||||||
|
|
||||||
//srcCards->addFilter(wff->Construct("c:red;&t:instant;"));
|
|
||||||
//srcCards->bakeFilters();
|
|
||||||
|
|
||||||
bigSync = 0;
|
bigSync = 0;
|
||||||
shopMenu = NEW WGuiMenu(PSP_CTRL_DOWN,PSP_CTRL_UP,true,&bigSync);
|
shopMenu = NEW WGuiMenu(PSP_CTRL_DOWN,PSP_CTRL_UP,true,&bigSync);
|
||||||
MTGAllCards * ac = GameApp::collection;
|
MTGAllCards * ac = GameApp::collection;
|
||||||
playerdata = NEW PlayerData(ac);;
|
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);
|
pricelist = NEW PriceList(RESPATH"/settings/prices.dat",ac);
|
||||||
for(int i=0;i<SHOP_SLOTS;i++){
|
for(int i=0;i<SHOP_SLOTS;i++){
|
||||||
WGuiCardDistort * dist;
|
WGuiCardDistort * dist;
|
||||||
@@ -230,7 +226,6 @@ void GameStateShop::purchaseCard(int controlId){
|
|||||||
MTGCard * c = srcCards->getCard(controlId-BOOSTER_SLOTS);
|
MTGCard * c = srcCards->getCard(controlId-BOOSTER_SLOTS);
|
||||||
if(!c || !c->data || playerdata->credits - mPrices[controlId] < 0)
|
if(!c || !c->data || playerdata->credits - mPrices[controlId] < 0)
|
||||||
return;
|
return;
|
||||||
playerdata->collection->add(c);
|
|
||||||
myCollection->Add(c);
|
myCollection->Add(c);
|
||||||
playerdata->credits -= mPrices[controlId];
|
playerdata->credits -= mPrices[controlId];
|
||||||
mCounts[controlId]++;
|
mCounts[controlId]++;
|
||||||
@@ -279,6 +274,7 @@ void GameStateShop::purchaseBooster(int controlId){
|
|||||||
myCollection->Add(booster);
|
myCollection->Add(booster);
|
||||||
makeDisplay(booster);
|
makeDisplay(booster);
|
||||||
|
|
||||||
|
mTouched = true;
|
||||||
save(true);
|
save(true);
|
||||||
SAFE_DELETE(pool);
|
SAFE_DELETE(pool);
|
||||||
menu->Close();
|
menu->Close();
|
||||||
@@ -333,10 +329,12 @@ void GameStateShop::load(){
|
|||||||
void GameStateShop::save(bool force)
|
void GameStateShop::save(bool force)
|
||||||
{
|
{
|
||||||
if(mTouched || force){
|
if(mTouched || force){
|
||||||
if(pricelist)
|
if(myCollection)
|
||||||
pricelist->save();
|
myCollection->Rebuild(playerdata->collection);
|
||||||
if(playerdata)
|
if(playerdata)
|
||||||
playerdata->save();
|
playerdata->save();
|
||||||
|
if(pricelist)
|
||||||
|
pricelist->save();
|
||||||
}
|
}
|
||||||
mTouched = false;
|
mTouched = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user