- 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

@@ -126,7 +126,7 @@ void StoryReward::Update(float dt)
MTGCard * card = NULL;
if (value.size())
{
card = GameApp::collection->getCardByName(value);
card = MTGCollection()->getCardByName(value);
if (card)
{
cardId = card->getId();
@@ -134,15 +134,15 @@ void StoryReward::Update(float dt)
}
else
{
cardId = GameApp::collection->randomCardId();
card = GameApp::collection->getCardById(cardId);
cardId = MTGCollection()->randomCardId();
card = MTGCollection()->getCardById(cardId);
}
if (!cardId) break;
if (!collection)
{
collection = NEW MTGDeck(options.profileFile(PLAYER_COLLECTION).c_str(), GameApp::collection);
collection = NEW MTGDeck(options.profileFile(PLAYER_COLLECTION).c_str(), MTGCollection());
}
result = Credits::addCardToCollection(cardId, collection);
@@ -305,13 +305,13 @@ void StoryDuel::init()
sprintf(folder, JGE_GET_RES(CAMPAIGNS_FOLDER"%s/%s").c_str(), mParent->folder.c_str(), pageId.c_str());
sprintf(deckFile, "%s/deck.txt", folder);
MTGDeck * tempDeck = NEW MTGDeck(deckFile, GameApp::collection);
MTGDeck * tempDeck = NEW MTGDeck(deckFile, MTGCollection());
sprintf(deckFileSmall, "campaign_%s", mParent->folder.c_str());
players[0] = NEW HumanPlayer(tempDeck, deckFile, deckFileSmall);
SAFE_DELETE(tempDeck);
sprintf(deckFile, "%s/opponent_deck.txt", folder);
tempDeck = NEW MTGDeck(deckFile, GameApp::collection);
tempDeck = NEW MTGDeck(deckFile, MTGCollection());
sprintf(deckFileSmall, "campaign_ennemy_%s_%s", mParent->folder.c_str(), pageId.c_str());
players[1] = NEW AIPlayerBaka(tempDeck, deckFile, deckFileSmall, "baka.jpg");
SAFE_DELETE(tempDeck);