added random avatar fetching for game modes in which you don't fight a specific deck...
fixed a crash from random deck game modes where it was trying to check against a selected deck...but there is no selected deck in random. (side effect of this is that i can not bypass this, the stat still need to be run through without causing choas so i set it to deckname "" and id 0...we *might* need to find a different id...though it didn't seem to effect deck 0 as the name does not match)
This commit is contained in:
@@ -2209,6 +2209,20 @@ AIPlayerBaka::AIPlayerBaka(GameObserver *observer, string file, string fileSmall
|
||||
}
|
||||
mAvatarName = avatarFile;
|
||||
}
|
||||
else //load a random avatar.
|
||||
{
|
||||
avatarFile = "avatar";
|
||||
char buffer[3];
|
||||
sprintf(buffer, "%i", int(rand()%100));
|
||||
avatarFile.append(buffer);
|
||||
avatarFile.append(".jpg");
|
||||
if(!loadAvatar(avatarFile, "bakaAvatar"))
|
||||
{
|
||||
avatarFile = "baka.jpg";
|
||||
loadAvatar(avatarFile, "bakaAvatar");
|
||||
}
|
||||
mAvatarName = avatarFile;
|
||||
}
|
||||
|
||||
if (fileSmall == "ai_baka_eviltwin")
|
||||
mAvatar->SetHFlip(true);
|
||||
|
||||
@@ -185,8 +185,8 @@ StatsWrapper * DeckManager::getExtendedDeckStats( DeckMetaData *selectedDeck, MT
|
||||
{
|
||||
StatsWrapper* stats = NULL;
|
||||
|
||||
string deckName = selectedDeck->getFilename();
|
||||
int deckId = selectedDeck->getDeckId();
|
||||
string deckName = selectedDeck?selectedDeck->getFilename():"";
|
||||
int deckId = selectedDeck?selectedDeck->getDeckId():0;
|
||||
|
||||
map<string, StatsWrapper*>* statsMap = isAI ? &aiDeckStatsMap : &playerDeckStatsMap;
|
||||
if ( statsMap->find(deckName) == statsMap->end())
|
||||
|
||||
Reference in New Issue
Block a user