- Moved the card collection out of the GameApp class to clean up the dependencies

- Added method to build a card collection independently of the GUI to ease my unitary test application
- Added part of some network GUI I'm working on, it's #ifdef out, I'm only committing this part to ease later merges
- Added the beginning of a serialization code of the Player and related classes used for network support
- various other minor cleanup
This commit is contained in:
Xawotihs
2011-02-06 11:35:40 +00:00
parent 91a2cb9c90
commit b7b584113b
26 changed files with 268 additions and 137 deletions

View File

@@ -511,7 +511,7 @@ void GameSettings::automaticStyle(Player * p1, Player * p2)
MTGDeck * decks[2];
for (int i = 0; i < 2; i++)
{
decks[i] = new MTGDeck(GameApp::collection);
decks[i] = new MTGDeck(MTGCollection());
Player * p;
if (i == 0)
p = p1;
@@ -677,7 +677,7 @@ void GameSettings::checkProfile()
}
//Validation of collection, etc, only happens if the game is up.
if (theGame == NULL || theGame->collection == NULL)
if (theGame == NULL || MTGCollection() == NULL)
return;
string pcFile = profileFile(PLAYER_COLLECTION, "", false);
@@ -707,7 +707,7 @@ void GameSettings::checkProfile()
int ok = 0;
for (int i = 0; i < setlist.size(); i++)
{
int value = theGame->collection->countBySet(i);
int value = MTGCollection()->countBySet(i);
if (value > maxcards)
{
maxcards = value;
@@ -734,10 +734,10 @@ void GameSettings::checkProfile()
void GameSettings::createUsersFirstDeck(int setId)
{
if (theGame == NULL || theGame->collection == NULL)
if (theGame == NULL || MTGCollection() == NULL)
return;
MTGDeck *mCollection = NEW MTGDeck(options.profileFile(PLAYER_COLLECTION, "", false).c_str(), theGame->collection);
MTGDeck *mCollection = NEW MTGDeck(options.profileFile(PLAYER_COLLECTION, "", false).c_str(), MTGCollection());
if (mCollection->totalCards() > 0)
return;