Minor tweaks to Mike's map of maps cache work on stats. Mostly these changes are stylistic changes that favor more terse code, but there was one bug where a double-delete was happening - GameStateDeckViewer used to allocate its own StatsWrapper, and deleted it as part of teardown - now that the allocation is owned by the deck stats instance, it's not allowed to do the deletion anymore.
I'll also note that the mods I did to getDeckMetaDataById() are completely unnecessary - pragmatically speaking, it's doing the same thing. The only difference is that I'm using std::find_if instead of brute iterator manipulation, and I'm using a predicate function. For a simple check like this, it's kind of pointless, but if you need to do more complex comparisons, predicate operators can become quite powerful.
This commit is contained in:
@@ -78,8 +78,7 @@ void SimplePopup::Update(DeckMetaData* selectedDeck)
|
||||
mDeckInformation = selectedDeck;
|
||||
|
||||
// get the information from the cache, if it doesn't exist create an entry
|
||||
DeckManager *deckManager = DeckManager::GetInstance();
|
||||
mStatsWrapper = deckManager->getExtendedDeckStats( mDeckInformation, mCollection, (mDeckInformation->getFilename().find("baka") != string::npos) );
|
||||
mStatsWrapper = DeckManager::GetInstance()->getExtendedDeckStats( mDeckInformation, mCollection, (mDeckInformation->getFilename().find("baka") != string::npos) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user