fixed bug with saving brand new AI decks.

This commit is contained in:
techdragon.nguyen@gmail.com
2010-10-22 09:22:25 +00:00
parent e2de03d987
commit 34bdfab36f
4 changed files with 13 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ class DeckDataWrapper: public WSrcDeck {
bool next() {currentPos++; return true;};
bool prev() {currentPos--; return true;};
void save();
void save(string filepath, bool useExpandedCardNames);
};
#endif

View File

@@ -150,7 +150,7 @@ class MTGDeck{
int add(MTGCard * card);
int remove(MTGCard * card);
int save();
int save(string destFileName, bool useExpandedDescriptions, string deckName, string deckDesc);
int save(string destFileName, bool useExpandedDescriptions);
MTGCard * getCardById(int id);
};

View File

@@ -15,3 +15,10 @@ void DeckDataWrapper::save(){
parent->save();
}
}
void DeckDataWrapper::save(string filepath, bool useExpandedCardNames){
if(parent){
Rebuild(parent);
parent->save(filepath, useExpandedCardNames);
}
}

View File

@@ -282,7 +282,10 @@ void GameStateDeckViewer::saveAsAIDeck( string deckName )
string filepath = RESPATH;
filepath.append("/ai/baka/").append( defaultAiDeckName ).append( ".txt" );
DebugTrace("saving AI deck " << filepath << endl );
myDeck->parent->save( filepath, true, deckName, deckDesc );
myDeck->parent->meta_desc = deckDesc;
myDeck->parent->meta_name = deckName;
myDeck->save( filepath, true);
oss.clear();
delete deckManager;
}