- 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:
@@ -2797,7 +2797,7 @@ public:
|
|||||||
ActivatedAbility(_id, _source, _cost, 0, _doTap), tokenId(tokenId), starfound(starfound),multiplier(multiplier), who(who),aLivingWeapon(aLivingWeapon)
|
ActivatedAbility(_id, _source, _cost, 0, _doTap), tokenId(tokenId), starfound(starfound),multiplier(multiplier), who(who),aLivingWeapon(aLivingWeapon)
|
||||||
{
|
{
|
||||||
if (!multiplier) this->multiplier = NEW WParsedInt(1);
|
if (!multiplier) this->multiplier = NEW WParsedInt(1);
|
||||||
MTGCard * card = GameApp::collection->getCardById(tokenId);
|
MTGCard * card = MTGCollection()->getCardById(tokenId);
|
||||||
if (card) name = card->data->getName();
|
if (card) name = card->data->getName();
|
||||||
battleReady = false;
|
battleReady = false;
|
||||||
}
|
}
|
||||||
@@ -2868,7 +2868,7 @@ public:
|
|||||||
//MTGCardInstance * myToken;
|
//MTGCardInstance * myToken;
|
||||||
if (tokenId)
|
if (tokenId)
|
||||||
{
|
{
|
||||||
MTGCard * card = GameApp::collection->getCardById(tokenId);
|
MTGCard * card = MTGCollection()->getCardById(tokenId);
|
||||||
myToken = NEW MTGCardInstance(card, source->controller()->game);
|
myToken = NEW MTGCardInstance(card, source->controller()->game);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,9 +23,12 @@
|
|||||||
|
|
||||||
#include "CardEffect.h"
|
#include "CardEffect.h"
|
||||||
|
|
||||||
#define PLAYER_TYPE_CPU 0
|
enum
|
||||||
#define PLAYER_TYPE_HUMAN 1
|
{
|
||||||
#define PLAYER_TYPE_TESTSUITE 2
|
PLAYER_TYPE_CPU = 0,
|
||||||
|
PLAYER_TYPE_HUMAN=1,
|
||||||
|
PLAYER_TYPE_TESTSUITE=2
|
||||||
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@@ -78,7 +81,6 @@ public:
|
|||||||
static JMusic* music;
|
static JMusic* music;
|
||||||
static string currentMusicFile;
|
static string currentMusicFile;
|
||||||
static void playMusic(string filename, bool loop = true);
|
static void playMusic(string filename, bool loop = true);
|
||||||
static MTGAllCards * collection;
|
|
||||||
static int players[2];
|
static int players[2];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ private:
|
|||||||
JGuiController* mGuiController;
|
JGuiController* mGuiController;
|
||||||
SimpleMenu* subMenuController;
|
SimpleMenu* subMenuController;
|
||||||
SimpleMenu* gameTypeMenu;
|
SimpleMenu* gameTypeMenu;
|
||||||
int hasChosenGameType;
|
bool hasChosenGameType;
|
||||||
JQuadPtr mIcons[10];
|
JQuadPtr mIcons[10];
|
||||||
JTexture * bgTexture;
|
JTexture * bgTexture;
|
||||||
JQuadPtr mBg;
|
JQuadPtr mBg;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "MTGDefinitions.h"
|
#include "MTGDefinitions.h"
|
||||||
#include "GameApp.h"
|
#include "GameApp.h"
|
||||||
#include "WResourceManager.h"
|
#include "WResourceManager.h"
|
||||||
|
#include <dirent.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@@ -94,13 +95,18 @@ private:
|
|||||||
MTGCard * tempCard; //used by parser
|
MTGCard * tempCard; //used by parser
|
||||||
CardPrimitive * tempPrimitive; //used by parser
|
CardPrimitive * tempPrimitive; //used by parser
|
||||||
int currentGrade; //used by Parser (we don't want an additional attribute for the primitives for that as it is only used at load time)
|
int currentGrade; //used by Parser (we don't want an additional attribute for the primitives for that as it is only used at load time)
|
||||||
|
static MTGAllCards* instance;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int conf_read_mode;
|
int conf_read_mode;
|
||||||
int colorsCount[Constants::MTG_NB_COLORS];
|
int colorsCount[Constants::MTG_NB_COLORS];
|
||||||
int total_cards;
|
int total_cards;
|
||||||
GameApp * parent;
|
|
||||||
void init();
|
void init();
|
||||||
void initCounters();
|
void initCounters();
|
||||||
|
MTGAllCards();
|
||||||
|
MTGAllCards(const char * config_file, const char * set_name);
|
||||||
|
~MTGAllCards();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@@ -111,11 +117,7 @@ public:
|
|||||||
vector<int> ids;
|
vector<int> ids;
|
||||||
map<int, MTGCard *> collection;
|
map<int, MTGCard *> collection;
|
||||||
map<string, CardPrimitive *> primitives;
|
map<string, CardPrimitive *> primitives;
|
||||||
MTGAllCards();
|
|
||||||
~MTGAllCards();
|
|
||||||
MTGCard * _(int id);
|
MTGCard * _(int id);
|
||||||
void destroyAllCards();
|
|
||||||
MTGAllCards(const char * config_file, const char * set_name);
|
|
||||||
MTGCard * getCardById(int id);
|
MTGCard * getCardById(int id);
|
||||||
MTGCard * getCardByName(string name);
|
MTGCard * getCardByName(string name);
|
||||||
int load(const char * config_file, const char * setName = NULL, int autoload = 1);
|
int load(const char * config_file, const char * setName = NULL, int autoload = 1);
|
||||||
@@ -124,6 +126,13 @@ public:
|
|||||||
int countBySet(int setId);
|
int countBySet(int setId);
|
||||||
int totalCards();
|
int totalCards();
|
||||||
int randomCardId();
|
int randomCardId();
|
||||||
|
|
||||||
|
static void loadPrimitives(const char *root_directory);
|
||||||
|
static void loadSets(const char *root_directory, const char* filename);
|
||||||
|
static void loadInstance();
|
||||||
|
static void unloadAll();
|
||||||
|
static inline MTGAllCards* getInstance() { return instance; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
map<string, MTGCard *> mtgCardByNameCache;
|
map<string, MTGCard *> mtgCardByNameCache;
|
||||||
int processConfLine(string &s, MTGCard* card, CardPrimitive * primitive);
|
int processConfLine(string &s, MTGCard* card, CardPrimitive * primitive);
|
||||||
@@ -131,6 +140,8 @@ private:
|
|||||||
CardPrimitive * addPrimitive(CardPrimitive * primitive, MTGCard * card = NULL);
|
CardPrimitive * addPrimitive(CardPrimitive * primitive, MTGCard * card = NULL);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define MTGCollection() MTGAllCards::getInstance()
|
||||||
|
|
||||||
class MTGDeck
|
class MTGDeck
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class MTGGameZone {
|
|||||||
static int zoneStringToId(string zoneName);
|
static int zoneStringToId(string zoneName);
|
||||||
static MTGGameZone *intToZone(int zoneId, MTGCardInstance * source = NULL,MTGCardInstance * target = NULL);
|
static MTGGameZone *intToZone(int zoneId, MTGCardInstance * source = NULL,MTGCardInstance * target = NULL);
|
||||||
bool needShuffle;
|
bool needShuffle;
|
||||||
virtual const char * getName(){return "zone";};
|
virtual const char * getName(){return "zone";};
|
||||||
virtual ostream& toString(ostream&) const;
|
virtual ostream& toString(ostream&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -156,6 +156,7 @@ class MTGPlayerCards {
|
|||||||
MTGGameZone * garbage;
|
MTGGameZone * garbage;
|
||||||
MTGGameZone * temp;
|
MTGGameZone * temp;
|
||||||
|
|
||||||
|
MTGPlayerCards();
|
||||||
MTGPlayerCards(int * idList, int idListSize);
|
MTGPlayerCards(int * idList, int idListSize);
|
||||||
MTGPlayerCards(MTGDeck * deck);
|
MTGPlayerCards(MTGDeck * deck);
|
||||||
~MTGPlayerCards();
|
~MTGPlayerCards();
|
||||||
@@ -178,5 +179,7 @@ class MTGPlayerCards {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ostream& operator<<(ostream&, const MTGGameZone&);
|
ostream& operator<<(ostream&, const MTGGameZone&);
|
||||||
|
ostream& operator<<(ostream&, const MTGPlayerCards&);
|
||||||
|
istream& operator>>(istream&, MTGPlayerCards&);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -116,5 +116,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
ostream& operator<<(ostream&, const Player&);
|
ostream& operator<<(ostream&, const Player&);
|
||||||
|
istream& operator>>(istream& in, Player& p);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ void AIStats::Render()
|
|||||||
AIStat * stat = *it;
|
AIStat * stat = *it;
|
||||||
if (stat->value > 0)
|
if (stat->value > 0)
|
||||||
{
|
{
|
||||||
MTGCard * card = GameApp::collection->getCardById(stat->source);
|
MTGCard * card = MTGCollection()->getCardById(stat->source);
|
||||||
if (card)
|
if (card)
|
||||||
{
|
{
|
||||||
sprintf(buffer, "%s %i", card->data->getName().c_str(), stat->value);
|
sprintf(buffer, "%s %i", card->data->getName().c_str(), stat->value);
|
||||||
|
|||||||
@@ -1384,7 +1384,7 @@ AACloner::AACloner(int _id, MTGCardInstance * _source, MTGCardInstance * _target
|
|||||||
if (_target)
|
if (_target)
|
||||||
{
|
{
|
||||||
MTGCardInstance * myClone = NULL;
|
MTGCardInstance * myClone = NULL;
|
||||||
MTGCard* clone = (_target->isToken ? _target: GameApp::collection->getCardByName(_target->name));
|
MTGCard* clone = (_target->isToken ? _target: MTGCollection()->getCardByName(_target->name));
|
||||||
if (who != 1)
|
if (who != 1)
|
||||||
{
|
{
|
||||||
myClone = NEW MTGCardInstance(clone, source->controller()->game);
|
myClone = NEW MTGCardInstance(clone, source->controller()->game);
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ void Credits::compute(Player * _p1, Player * _p2, GameApp * _app)
|
|||||||
GameObserver * g = GameObserver::GetInstance();
|
GameObserver * g = GameObserver::GetInstance();
|
||||||
if (!g->turn)
|
if (!g->turn)
|
||||||
return;
|
return;
|
||||||
PlayerData * playerdata = NEW PlayerData(app->collection);
|
PlayerData * playerdata = NEW PlayerData(MTGCollection());
|
||||||
if (!p1->isAI() && p2->isAI() && p1 != g->gameOver)
|
if (!p1->isAI() && p2->isAI() && p1 != g->gameOver)
|
||||||
{
|
{
|
||||||
gameLength = time(0) - g->startedAt;
|
gameLength = time(0) - g->startedAt;
|
||||||
@@ -383,8 +383,7 @@ int Credits::addCardToCollection(int cardId, MTGDeck * collection)
|
|||||||
*/
|
*/
|
||||||
int Credits::addCardToCollection(int cardId)
|
int Credits::addCardToCollection(int cardId)
|
||||||
{
|
{
|
||||||
MTGAllCards * ac = GameApp::collection;
|
PlayerData * playerdata = NEW PlayerData(MTGCollection());
|
||||||
PlayerData * playerdata = NEW PlayerData(ac);
|
|
||||||
int result = addCardToCollection(cardId, playerdata->collection);
|
int result = addCardToCollection(cardId, playerdata->collection);
|
||||||
playerdata->collection->save();
|
playerdata->collection->save();
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
#define DEFAULT_DURATION .25
|
#define DEFAULT_DURATION .25
|
||||||
|
|
||||||
MTGAllCards * GameApp::collection = NULL;
|
|
||||||
int GameApp::players[] = { 0, 0 };
|
int GameApp::players[] = { 0, 0 };
|
||||||
int GameApp::HasMusic = 1;
|
int GameApp::HasMusic = 1;
|
||||||
JMusic * GameApp::music = NULL;
|
JMusic * GameApp::music = NULL;
|
||||||
@@ -67,7 +66,6 @@ GameApp::GameApp() :
|
|||||||
|
|
||||||
mCurrentState = NULL;
|
mCurrentState = NULL;
|
||||||
mNextState = NULL;
|
mNextState = NULL;
|
||||||
collection = NULL;
|
|
||||||
|
|
||||||
music = NULL;
|
music = NULL;
|
||||||
}
|
}
|
||||||
@@ -215,7 +213,7 @@ void GameApp::Create()
|
|||||||
jq = WResourceManager::Instance()->RetrieveQuad("phasebar.png", 0, 0, 0, 0, "phasebar", RETRIEVE_MANAGE);
|
jq = WResourceManager::Instance()->RetrieveQuad("phasebar.png", 0, 0, 0, 0, "phasebar", RETRIEVE_MANAGE);
|
||||||
|
|
||||||
LOG("Init Collection");
|
LOG("Init Collection");
|
||||||
collection = NEW MTGAllCards();
|
MTGAllCards::loadInstance();
|
||||||
|
|
||||||
LOG("Creating Game States");
|
LOG("Creating Game States");
|
||||||
mGameStates[GAME_STATE_DECK_VIEWER] = NEW GameStateDeckViewer(this);
|
mGameStates[GAME_STATE_DECK_VIEWER] = NEW GameStateDeckViewer(this);
|
||||||
@@ -271,11 +269,7 @@ void GameApp::Destroy()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (collection)
|
MTGAllCards::unloadAll();
|
||||||
{
|
|
||||||
collection->destroyAllCards();
|
|
||||||
SAFE_DELETE(collection);
|
|
||||||
}
|
|
||||||
|
|
||||||
DeckManager::EndInstance();
|
DeckManager::EndInstance();
|
||||||
DeckStats::EndInstance();
|
DeckStats::EndInstance();
|
||||||
|
|||||||
@@ -511,7 +511,7 @@ void GameSettings::automaticStyle(Player * p1, Player * p2)
|
|||||||
MTGDeck * decks[2];
|
MTGDeck * decks[2];
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
decks[i] = new MTGDeck(GameApp::collection);
|
decks[i] = new MTGDeck(MTGCollection());
|
||||||
Player * p;
|
Player * p;
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
p = p1;
|
p = p1;
|
||||||
@@ -677,7 +677,7 @@ void GameSettings::checkProfile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Validation of collection, etc, only happens if the game is up.
|
//Validation of collection, etc, only happens if the game is up.
|
||||||
if (theGame == NULL || theGame->collection == NULL)
|
if (theGame == NULL || MTGCollection() == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string pcFile = profileFile(PLAYER_COLLECTION, "", false);
|
string pcFile = profileFile(PLAYER_COLLECTION, "", false);
|
||||||
@@ -707,7 +707,7 @@ void GameSettings::checkProfile()
|
|||||||
int ok = 0;
|
int ok = 0;
|
||||||
for (int i = 0; i < setlist.size(); i++)
|
for (int i = 0; i < setlist.size(); i++)
|
||||||
{
|
{
|
||||||
int value = theGame->collection->countBySet(i);
|
int value = MTGCollection()->countBySet(i);
|
||||||
if (value > maxcards)
|
if (value > maxcards)
|
||||||
{
|
{
|
||||||
maxcards = value;
|
maxcards = value;
|
||||||
@@ -734,10 +734,10 @@ void GameSettings::checkProfile()
|
|||||||
void GameSettings::createUsersFirstDeck(int setId)
|
void GameSettings::createUsersFirstDeck(int setId)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (theGame == NULL || theGame->collection == NULL)
|
if (theGame == NULL || MTGCollection() == NULL)
|
||||||
return;
|
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)
|
if (mCollection->totalCards() > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ bool GameStateAwards::enterSet(int setid)
|
|||||||
|
|
||||||
setSrc = NEW WSrcCards();
|
setSrc = NEW WSrcCards();
|
||||||
setSrc->addFilter(NEW WCFilterSet(setid));
|
setSrc->addFilter(NEW WCFilterSet(setid));
|
||||||
setSrc->loadMatches(mParent->collection);
|
setSrc->loadMatches(MTGCollection());
|
||||||
setSrc->bakeFilters();
|
setSrc->bakeFilters();
|
||||||
setSrc->Sort(WSrcCards::SORT_COLLECTOR);
|
setSrc->Sort(WSrcCards::SORT_COLLECTOR);
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ bool GameStateAwards::enterStats(int option)
|
|||||||
{
|
{
|
||||||
if (option != Options::AWARD_COLLECTOR)
|
if (option != Options::AWARD_COLLECTOR)
|
||||||
return false;
|
return false;
|
||||||
DeckDataWrapper* ddw = NEW DeckDataWrapper(NEW MTGDeck(options.profileFile(PLAYER_COLLECTION).c_str(), mParent->collection));
|
DeckDataWrapper* ddw = NEW DeckDataWrapper(NEW MTGDeck(options.profileFile(PLAYER_COLLECTION).c_str(), MTGCollection()));
|
||||||
if (!ddw)
|
if (!ddw)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@@ -216,8 +216,8 @@ void GameStateDeckViewer::Start()
|
|||||||
lastPos = 0;
|
lastPos = 0;
|
||||||
lastTotal = 0;
|
lastTotal = 0;
|
||||||
|
|
||||||
pricelist = NEW PriceList(JGE_GET_RES("settings/prices.dat").c_str(), mParent->collection);
|
pricelist = NEW PriceList(JGE_GET_RES("settings/prices.dat").c_str(), MTGCollection());
|
||||||
playerdata = NEW PlayerData(mParent->collection);
|
playerdata = NEW PlayerData(MTGCollection());
|
||||||
myCollection = NEW DeckDataWrapper(playerdata->collection);
|
myCollection = NEW DeckDataWrapper(playerdata->collection);
|
||||||
myCollection->Sort(WSrcCards::SORT_ALPHA);
|
myCollection->Sort(WSrcCards::SORT_ALPHA);
|
||||||
displayed_deck = myCollection;
|
displayed_deck = myCollection;
|
||||||
@@ -1415,14 +1415,14 @@ int GameStateDeckViewer::loadDeck(int deckid)
|
|||||||
if (!stw)
|
if (!stw)
|
||||||
{
|
{
|
||||||
DeckManager *deckManager = DeckManager::GetInstance();
|
DeckManager *deckManager = DeckManager::GetInstance();
|
||||||
stw = deckManager->getExtendedStatsForDeckId( deckid, mParent->collection, false );
|
stw = deckManager->getExtendedStatsForDeckId( deckid, MTGCollection(), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
stw->currentPage = 0;
|
stw->currentPage = 0;
|
||||||
stw->pageCount = 9;
|
stw->pageCount = 9;
|
||||||
stw->needUpdate = true;
|
stw->needUpdate = true;
|
||||||
|
|
||||||
if (!playerdata) playerdata = NEW PlayerData(mParent->collection);
|
if (!playerdata) playerdata = NEW PlayerData(MTGCollection());
|
||||||
SAFE_DELETE(myCollection);
|
SAFE_DELETE(myCollection);
|
||||||
myCollection = NEW DeckDataWrapper(playerdata->collection);
|
myCollection = NEW DeckDataWrapper(playerdata->collection);
|
||||||
myCollection->Sort(WSrcCards::SORT_ALPHA);
|
myCollection->Sort(WSrcCards::SORT_ALPHA);
|
||||||
@@ -1435,7 +1435,7 @@ int GameStateDeckViewer::loadDeck(int deckid)
|
|||||||
SAFE_DELETE(myDeck->parent);
|
SAFE_DELETE(myDeck->parent);
|
||||||
SAFE_DELETE(myDeck);
|
SAFE_DELETE(myDeck);
|
||||||
}
|
}
|
||||||
myDeck = NEW DeckDataWrapper(NEW MTGDeck(options.profileFile(deckname, "", false, false).c_str(), mParent->collection));
|
myDeck = NEW DeckDataWrapper(NEW MTGDeck(options.profileFile(deckname, "", false, false).c_str(), MTGCollection()));
|
||||||
|
|
||||||
// Check whether the cards in the deck are actually available in the player's collection:
|
// Check whether the cards in the deck are actually available in the player's collection:
|
||||||
int cheatmode = options[Options::CHEATMODE].number;
|
int cheatmode = options[Options::CHEATMODE].number;
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ void GameStateDuel::Start()
|
|||||||
|
|
||||||
#ifdef TESTSUITE
|
#ifdef TESTSUITE
|
||||||
SAFE_DELETE(testSuite);
|
SAFE_DELETE(testSuite);
|
||||||
testSuite = NEW TestSuite(JGE_GET_RES("test/_tests.txt").c_str(),mParent->collection);
|
testSuite = NEW TestSuite(JGE_GET_RES("test/_tests.txt").c_str(),MTGCollection());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mGamePhase = DUEL_STATE_CHOOSE_DECK1;
|
mGamePhase = DUEL_STATE_CHOOSE_DECK1;
|
||||||
@@ -169,7 +169,7 @@ void GameStateDuel::loadPlayer(int playerId, int decknb, int isAI)
|
|||||||
sprintf(deckFile, "%s/deck%i.txt", options.profileFile().c_str(), decknb);
|
sprintf(deckFile, "%s/deck%i.txt", options.profileFile().c_str(), decknb);
|
||||||
char deckFileSmall[255];
|
char deckFileSmall[255];
|
||||||
sprintf(deckFileSmall, "player_deck%i", decknb);
|
sprintf(deckFileSmall, "player_deck%i", decknb);
|
||||||
MTGDeck * tempDeck = NEW MTGDeck(deckFile, mParent->collection);
|
MTGDeck * tempDeck = NEW MTGDeck(deckFile, MTGCollection());
|
||||||
mPlayers[playerId] = NEW HumanPlayer(tempDeck, deckFile, deckFileSmall);
|
mPlayers[playerId] = NEW HumanPlayer(tempDeck, deckFile, deckFileSmall);
|
||||||
SAFE_DELETE( tempDeck );
|
SAFE_DELETE( tempDeck );
|
||||||
}
|
}
|
||||||
@@ -178,7 +178,7 @@ void GameStateDuel::loadPlayer(int playerId, int decknb, int isAI)
|
|||||||
AIPlayerFactory playerCreator;
|
AIPlayerFactory playerCreator;
|
||||||
Player * opponent = NULL;
|
Player * opponent = NULL;
|
||||||
if (playerId == 1) opponent = mPlayers[0];
|
if (playerId == 1) opponent = mPlayers[0];
|
||||||
mPlayers[playerId] = playerCreator.createAIPlayer(mParent->collection, opponent, decknb);
|
mPlayers[playerId] = playerCreator.createAIPlayer(MTGCollection(), opponent, decknb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -186,7 +186,7 @@ void GameStateDuel::loadPlayer(int playerId, int decknb, int isAI)
|
|||||||
AIPlayerFactory playerCreator;
|
AIPlayerFactory playerCreator;
|
||||||
Player * opponent = NULL;
|
Player * opponent = NULL;
|
||||||
if (playerId == 1) opponent = mPlayers[0];
|
if (playerId == 1) opponent = mPlayers[0];
|
||||||
mPlayers[playerId] = playerCreator.createAIPlayer(mParent->collection, opponent);
|
mPlayers[playerId] = playerCreator.createAIPlayer(MTGCollection(), opponent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,7 +213,7 @@ void GameStateDuel::loadTestSuitePlayers()
|
|||||||
game->startGame(rules);
|
game->startGame(rules);
|
||||||
if (mParent->gameType == GAME_TYPE_MOMIR)
|
if (mParent->gameType == GAME_TYPE_MOMIR)
|
||||||
{
|
{
|
||||||
game->addObserver(NEW MTGMomirRule(-1, mParent->collection));
|
game->addObserver(NEW MTGMomirRule(-1, MTGCollection()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -228,8 +228,8 @@ void GameStateDuel::End()
|
|||||||
mPlayers[0]->End();
|
mPlayers[0]->End();
|
||||||
if (mParent->players[1] != PLAYER_TYPE_TESTSUITE)
|
if (mParent->players[1] != PLAYER_TYPE_TESTSUITE)
|
||||||
{
|
{
|
||||||
DeckManager::GetInstance()->saveDeck( mPlayers[1]->deckFile, mParent->collection);
|
DeckManager::GetInstance()->saveDeck( mPlayers[1]->deckFile, MTGCollection());
|
||||||
DeckManager::GetInstance()->saveDeck( mPlayers[0]->deckFile, mParent->collection);
|
DeckManager::GetInstance()->saveDeck( mPlayers[0]->deckFile, MTGCollection());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( !mPlayers[1] && mPlayers[0] )
|
else if ( !mPlayers[1] && mPlayers[0] )
|
||||||
@@ -405,7 +405,7 @@ void GameStateDuel::Update(float dt)
|
|||||||
game->startGame(rules);
|
game->startGame(rules);
|
||||||
if (mParent->gameType == GAME_TYPE_MOMIR)
|
if (mParent->gameType == GAME_TYPE_MOMIR)
|
||||||
{
|
{
|
||||||
game->addObserver(NEW MTGMomirRule(-1, mParent->collection));
|
game->addObserver(NEW MTGMomirRule(-1, MTGCollection()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//start of in game music code
|
//start of in game music code
|
||||||
@@ -493,7 +493,7 @@ void GameStateDuel::Update(float dt)
|
|||||||
menu->Update(dt);
|
menu->Update(dt);
|
||||||
if (menu->isClosed())
|
if (menu->isClosed())
|
||||||
{
|
{
|
||||||
PlayerData * playerdata = NEW PlayerData(mParent->collection);
|
PlayerData * playerdata = NEW PlayerData(MTGCollection());
|
||||||
playerdata->taskList->passOneDay();
|
playerdata->taskList->passOneDay();
|
||||||
playerdata->taskList->save();
|
playerdata->taskList->save();
|
||||||
SAFE_DELETE(playerdata);
|
SAFE_DELETE(playerdata);
|
||||||
@@ -672,7 +672,7 @@ void GameStateDuel::ButtonPressed(int controllerId, int controlId)
|
|||||||
if (!popupScreen)
|
if (!popupScreen)
|
||||||
{
|
{
|
||||||
popupScreen = NEW SimplePopup(DUEL_MENU_DETAILED_DECK2_INFO, this, Fonts::MAIN_FONT, "Detailed Information",
|
popupScreen = NEW SimplePopup(DUEL_MENU_DETAILED_DECK2_INFO, this, Fonts::MAIN_FONT, "Detailed Information",
|
||||||
selectedDeck, mParent->collection);
|
selectedDeck, MTGCollection());
|
||||||
popupScreen->Render();
|
popupScreen->Render();
|
||||||
selectedAIDeckId = selectedDeck->getDeckId();
|
selectedAIDeckId = selectedDeck->getDeckId();
|
||||||
}
|
}
|
||||||
@@ -721,7 +721,7 @@ void GameStateDuel::ButtonPressed(int controllerId, int controlId)
|
|||||||
if (!popupScreen)
|
if (!popupScreen)
|
||||||
{
|
{
|
||||||
popupScreen = NEW SimplePopup(DUEL_MENU_DETAILED_DECK1_INFO, this, Fonts::MAIN_FONT, "Detailed Information",
|
popupScreen = NEW SimplePopup(DUEL_MENU_DETAILED_DECK1_INFO, this, Fonts::MAIN_FONT, "Detailed Information",
|
||||||
selectedDeck, mParent->collection);
|
selectedDeck, MTGCollection());
|
||||||
popupScreen->Render();
|
popupScreen->Render();
|
||||||
selectedPlayerDeckId = deckmenu->getSelectedDeckId();
|
selectedPlayerDeckId = deckmenu->getSelectedDeckId();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,9 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "WFont.h"
|
#include "WFont.h"
|
||||||
#include <JLogger.h>
|
#include <JLogger.h>
|
||||||
|
#ifdef NETWORK_SUPPORT
|
||||||
|
#include <JNetwork.h>
|
||||||
|
#endif//NETWORK_SUPPORT
|
||||||
|
|
||||||
static const char* GAME_VERSION = "WTH?! 0.14.1 - wololo.net";
|
static const char* GAME_VERSION = "WTH?! 0.14.1 - wololo.net";
|
||||||
|
|
||||||
@@ -57,14 +60,17 @@ enum
|
|||||||
MENUITEM_OPTIONS,
|
MENUITEM_OPTIONS,
|
||||||
MENUITEM_EXIT,
|
MENUITEM_EXIT,
|
||||||
SUBMENUITEM_1PLAYER,
|
SUBMENUITEM_1PLAYER,
|
||||||
SUBMENUITEM_2PLAYER,
|
#ifdef NETWORK_SUPPORT
|
||||||
|
SUBMENUITEM_2PLAYER_SERVER,
|
||||||
|
SUBMENUITEM_2PLAYER_CLIENT,
|
||||||
|
#endif //NETWORK_SUPPORT
|
||||||
SUBMENUITEM_DEMO,
|
SUBMENUITEM_DEMO,
|
||||||
SUBMENUITEM_TESTSUITE,
|
SUBMENUITEM_TESTSUITE,
|
||||||
SUBMENUITEM_MOMIR,
|
SUBMENUITEM_MOMIR,
|
||||||
SUBMENUITEM_CLASSIC,
|
SUBMENUITEM_CLASSIC,
|
||||||
SUBMENUITEM_RANDOM1,
|
SUBMENUITEM_RANDOM1,
|
||||||
SUBMENUITEM_RANDOM2,
|
SUBMENUITEM_RANDOM2,
|
||||||
SUBMENUITEM_STORY,
|
SUBMENUITEM_STORY
|
||||||
};
|
};
|
||||||
|
|
||||||
GameStateMenu::GameStateMenu(GameApp* parent) :
|
GameStateMenu::GameStateMenu(GameApp* parent) :
|
||||||
@@ -147,7 +153,7 @@ void GameStateMenu::Start()
|
|||||||
|
|
||||||
GameApp::playMusic("Track0.mp3");
|
GameApp::playMusic("Track0.mp3");
|
||||||
|
|
||||||
hasChosenGameType = 0;
|
hasChosenGameType = false;
|
||||||
mParent->gameType = GAME_TYPE_CLASSIC;
|
mParent->gameType = GAME_TYPE_CLASSIC;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -169,14 +175,14 @@ void GameStateMenu::Start()
|
|||||||
void GameStateMenu::genNbCardsStr()
|
void GameStateMenu::genNbCardsStr()
|
||||||
{
|
{
|
||||||
//How many cards total ?
|
//How many cards total ?
|
||||||
PlayerData * playerdata = NEW PlayerData(mParent->collection);
|
PlayerData * playerdata = NEW PlayerData(MTGCollection());
|
||||||
if (playerdata && !options[Options::ACTIVE_PROFILE].isDefault())
|
if (playerdata && !options[Options::ACTIVE_PROFILE].isDefault())
|
||||||
sprintf(nbcardsStr, _("%s: %i cards (%i) (%i unique)").c_str(), options[Options::ACTIVE_PROFILE].str.c_str(),
|
sprintf(nbcardsStr, _("%s: %i cards (%i) (%i unique)").c_str(), options[Options::ACTIVE_PROFILE].str.c_str(),
|
||||||
playerdata->collection->totalCards(), mParent->collection->totalCards(),
|
playerdata->collection->totalCards(), MTGCollection()->totalCards(),
|
||||||
mParent->collection->primitives.size());
|
MTGCollection()->primitives.size());
|
||||||
else
|
else
|
||||||
sprintf(nbcardsStr, _("%i cards (%i unique)").c_str(), mParent->collection->totalCards(),
|
sprintf(nbcardsStr, _("%i cards (%i unique)").c_str(), MTGCollection()->totalCards(),
|
||||||
mParent->collection->primitives.size());
|
MTGCollection()->primitives.size());
|
||||||
|
|
||||||
SAFE_DELETE(playerdata);
|
SAFE_DELETE(playerdata);
|
||||||
}
|
}
|
||||||
@@ -238,7 +244,7 @@ void GameStateMenu::fillScroller()
|
|||||||
sprintf(buff2, _("You have unlocked %i expansions out of %i").c_str(), nbunlocked, setlist.size());
|
sprintf(buff2, _("You have unlocked %i expansions out of %i").c_str(), nbunlocked, setlist.size());
|
||||||
scroller->Add(buff2);
|
scroller->Add(buff2);
|
||||||
|
|
||||||
PlayerData * playerdata = NEW PlayerData(mParent->collection);
|
PlayerData * playerdata = NEW PlayerData(MTGCollection());
|
||||||
int totalCards = playerdata->collection->totalCards();
|
int totalCards = playerdata->collection->totalCards();
|
||||||
if (totalCards)
|
if (totalCards)
|
||||||
{
|
{
|
||||||
@@ -466,14 +472,14 @@ void GameStateMenu::Update(float dt)
|
|||||||
}
|
}
|
||||||
if (primitivesLoadCounter < (int) (primitives.size()))
|
if (primitivesLoadCounter < (int) (primitives.size()))
|
||||||
{
|
{
|
||||||
mParent->collection->load(primitives[primitivesLoadCounter].c_str());
|
MTGCollection()->load(primitives[primitivesLoadCounter].c_str());
|
||||||
primitivesLoadCounter++;
|
primitivesLoadCounter++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
primitivesLoadCounter = primitives.size() + 1;
|
primitivesLoadCounter = primitives.size() + 1;
|
||||||
if (mReadConf)
|
if (mReadConf)
|
||||||
{
|
{
|
||||||
mParent->collection->load(mCurrentSetFileName, mCurrentSetName);
|
MTGCollection()->load(mCurrentSetFileName, mCurrentSetName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -485,8 +491,8 @@ void GameStateMenu::Update(float dt)
|
|||||||
Translator::GetInstance()->tempValues.clear();
|
Translator::GetInstance()->tempValues.clear();
|
||||||
|
|
||||||
DebugTrace(std::endl << "==" << std::endl <<
|
DebugTrace(std::endl << "==" << std::endl <<
|
||||||
"Total MTGCards: " << mParent->collection->collection.size() << std::endl <<
|
"Total MTGCards: " << MTGCollection()->collection.size() << std::endl <<
|
||||||
"Total CardPrimitives: " << mParent->collection->primitives.size() << std::endl << "==");
|
"Total CardPrimitives: " << MTGCollection()->primitives.size() << std::endl << "==");
|
||||||
|
|
||||||
//Force default, if necessary.
|
//Force default, if necessary.
|
||||||
if (options[Options::ACTIVE_PROFILE].str == "")
|
if (options[Options::ACTIVE_PROFILE].str == "")
|
||||||
@@ -719,6 +725,8 @@ void GameStateMenu::Render()
|
|||||||
|
|
||||||
void GameStateMenu::ButtonPressed(int controllerId, int controlId)
|
void GameStateMenu::ButtonPressed(int controllerId, int controlId)
|
||||||
{
|
{
|
||||||
|
int deckId;
|
||||||
|
int result;
|
||||||
|
|
||||||
DebugTrace("GameStateMenu: controllerId " << controllerId << " selected");
|
DebugTrace("GameStateMenu: controllerId " << controllerId << " selected");
|
||||||
switch (controllerId)
|
switch (controllerId)
|
||||||
@@ -743,7 +751,10 @@ void GameStateMenu::ButtonPressed(int controllerId, int controlId)
|
|||||||
subMenuController->Add(SUBMENUITEM_1PLAYER, "1 Player");
|
subMenuController->Add(SUBMENUITEM_1PLAYER, "1 Player");
|
||||||
// TODO Put 2 players mode back
|
// TODO Put 2 players mode back
|
||||||
// This requires to fix the hand (to accept 2 players) OR to implement network game
|
// This requires to fix the hand (to accept 2 players) OR to implement network game
|
||||||
//subMenuController->Add(SUBMENUITEM_2PLAYER, "2 Players");
|
#ifdef NETWORK_SUPPORT
|
||||||
|
subMenuController->Add(SUBMENUITEM_2PLAYER_SERVER, "2 Players - server");
|
||||||
|
subMenuController->Add(SUBMENUITEM_2PLAYER_CLIENT, "2 Players - client");
|
||||||
|
#endif //NETWORK_SUPPORT
|
||||||
subMenuController->Add(SUBMENUITEM_DEMO, "Demo");
|
subMenuController->Add(SUBMENUITEM_DEMO, "Demo");
|
||||||
subMenuController->Add(SUBMENUITEM_CANCEL, "Cancel");
|
subMenuController->Add(SUBMENUITEM_CANCEL, "Cancel");
|
||||||
#ifdef TESTSUITE
|
#ifdef TESTSUITE
|
||||||
@@ -770,12 +781,24 @@ void GameStateMenu::ButtonPressed(int controllerId, int controlId)
|
|||||||
subMenuController->Close();
|
subMenuController->Close();
|
||||||
currentState = MENU_STATE_MAJOR_DUEL | MENU_STATE_MINOR_SUBMENU_CLOSING;
|
currentState = MENU_STATE_MAJOR_DUEL | MENU_STATE_MINOR_SUBMENU_CLOSING;
|
||||||
break;
|
break;
|
||||||
case SUBMENUITEM_2PLAYER:
|
#ifdef NETWORK_SUPPORT
|
||||||
|
case SUBMENUITEM_2PLAYER_SERVER:
|
||||||
mParent->players[0] = PLAYER_TYPE_HUMAN;
|
mParent->players[0] = PLAYER_TYPE_HUMAN;
|
||||||
mParent->players[1] = PLAYER_TYPE_HUMAN;
|
mParent->players[1] = PLAYER_TYPE_HUMAN;
|
||||||
|
this->hasChosenGameType = true;
|
||||||
|
mParent->gameType = GAME_TYPE_CLASSIC;
|
||||||
subMenuController->Close();
|
subMenuController->Close();
|
||||||
currentState = MENU_STATE_MAJOR_DUEL | MENU_STATE_MINOR_SUBMENU_CLOSING;
|
currentState = MENU_STATE_MAJOR_DUEL | MENU_STATE_MINOR_SUBMENU_CLOSING;
|
||||||
break;
|
break;
|
||||||
|
case SUBMENUITEM_2PLAYER_CLIENT:
|
||||||
|
mParent->players[0] = PLAYER_TYPE_HUMAN;
|
||||||
|
mParent->players[1] = PLAYER_TYPE_HUMAN;
|
||||||
|
this->hasChosenGameType = true;
|
||||||
|
mParent->gameType = GAME_TYPE_CLASSIC;
|
||||||
|
subMenuController->Close();
|
||||||
|
currentState = MENU_STATE_MAJOR_DUEL | MENU_STATE_MINOR_SUBMENU_CLOSING;
|
||||||
|
break;
|
||||||
|
#endif //NETWORK_SUPPORT
|
||||||
case SUBMENUITEM_DEMO:
|
case SUBMENUITEM_DEMO:
|
||||||
mParent->players[0] = PLAYER_TYPE_CPU;
|
mParent->players[0] = PLAYER_TYPE_CPU;
|
||||||
mParent->players[1] = PLAYER_TYPE_CPU;
|
mParent->players[1] = PLAYER_TYPE_CPU;
|
||||||
@@ -791,35 +814,35 @@ void GameStateMenu::ButtonPressed(int controllerId, int controlId)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SUBMENUITEM_CLASSIC:
|
case SUBMENUITEM_CLASSIC:
|
||||||
this->hasChosenGameType = 1;
|
this->hasChosenGameType = true;
|
||||||
mParent->gameType = GAME_TYPE_CLASSIC;
|
mParent->gameType = GAME_TYPE_CLASSIC;
|
||||||
subMenuController->Close();
|
subMenuController->Close();
|
||||||
currentState = MENU_STATE_MAJOR_DUEL | MENU_STATE_MINOR_SUBMENU_CLOSING;
|
currentState = MENU_STATE_MAJOR_DUEL | MENU_STATE_MINOR_SUBMENU_CLOSING;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SUBMENUITEM_MOMIR:
|
case SUBMENUITEM_MOMIR:
|
||||||
this->hasChosenGameType = 1;
|
this->hasChosenGameType = true;
|
||||||
mParent->gameType = GAME_TYPE_MOMIR;
|
mParent->gameType = GAME_TYPE_MOMIR;
|
||||||
subMenuController->Close();
|
subMenuController->Close();
|
||||||
currentState = MENU_STATE_MAJOR_DUEL | MENU_STATE_MINOR_SUBMENU_CLOSING;
|
currentState = MENU_STATE_MAJOR_DUEL | MENU_STATE_MINOR_SUBMENU_CLOSING;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SUBMENUITEM_RANDOM1:
|
case SUBMENUITEM_RANDOM1:
|
||||||
this->hasChosenGameType = 1;
|
this->hasChosenGameType = true;
|
||||||
mParent->gameType = GAME_TYPE_RANDOM1;
|
mParent->gameType = GAME_TYPE_RANDOM1;
|
||||||
subMenuController->Close();
|
subMenuController->Close();
|
||||||
currentState = MENU_STATE_MAJOR_DUEL | MENU_STATE_MINOR_SUBMENU_CLOSING;
|
currentState = MENU_STATE_MAJOR_DUEL | MENU_STATE_MINOR_SUBMENU_CLOSING;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SUBMENUITEM_RANDOM2:
|
case SUBMENUITEM_RANDOM2:
|
||||||
this->hasChosenGameType = 1;
|
this->hasChosenGameType = true;
|
||||||
mParent->gameType = GAME_TYPE_RANDOM2;
|
mParent->gameType = GAME_TYPE_RANDOM2;
|
||||||
subMenuController->Close();
|
subMenuController->Close();
|
||||||
currentState = MENU_STATE_MAJOR_DUEL | MENU_STATE_MINOR_SUBMENU_CLOSING;
|
currentState = MENU_STATE_MAJOR_DUEL | MENU_STATE_MINOR_SUBMENU_CLOSING;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SUBMENUITEM_STORY:
|
case SUBMENUITEM_STORY:
|
||||||
this->hasChosenGameType = 1;
|
this->hasChosenGameType = true;
|
||||||
mParent->gameType = GAME_TYPE_STORY;
|
mParent->gameType = GAME_TYPE_STORY;
|
||||||
subMenuController->Close();
|
subMenuController->Close();
|
||||||
currentState = MENU_STATE_MAJOR_DUEL | MENU_STATE_MINOR_SUBMENU_CLOSING;
|
currentState = MENU_STATE_MAJOR_DUEL | MENU_STATE_MINOR_SUBMENU_CLOSING;
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ void GameStateShop::Start()
|
|||||||
|
|
||||||
bigSync = 0;
|
bigSync = 0;
|
||||||
shopMenu = NEW WGuiMenu(JGE_BTN_DOWN, JGE_BTN_UP, true, &bigSync);
|
shopMenu = NEW WGuiMenu(JGE_BTN_DOWN, JGE_BTN_UP, true, &bigSync);
|
||||||
MTGAllCards * ac = GameApp::collection;
|
MTGAllCards * ac = MTGCollection();
|
||||||
playerdata = NEW PlayerData(ac);
|
playerdata = NEW PlayerData(ac);
|
||||||
myCollection = NEW DeckDataWrapper(playerdata->collection);
|
myCollection = NEW DeckDataWrapper(playerdata->collection);
|
||||||
pricelist = NEW PriceList(JGE_GET_RES("settings/prices.dat").c_str(), ac);
|
pricelist = NEW PriceList(JGE_GET_RES("settings/prices.dat").c_str(), ac);
|
||||||
@@ -310,7 +310,7 @@ void GameStateShop::purchaseBooster(int controlId)
|
|||||||
mInventory[controlId]--;
|
mInventory[controlId]--;
|
||||||
SAFE_DELETE(booster);
|
SAFE_DELETE(booster);
|
||||||
deleteDisplay();
|
deleteDisplay();
|
||||||
booster = NEW MTGDeck(mParent->collection);
|
booster = NEW MTGDeck(MTGCollection());
|
||||||
boosterDisplay = NEW BoosterDisplay(12, NULL, SCREEN_WIDTH - 200, SCREEN_HEIGHT / 2, this, NULL, 5);
|
boosterDisplay = NEW BoosterDisplay(12, NULL, SCREEN_WIDTH - 200, SCREEN_HEIGHT / 2, this, NULL, 5);
|
||||||
mBooster[controlId].addToDeck(booster, srcCards);
|
mBooster[controlId].addToDeck(booster, srcCards);
|
||||||
|
|
||||||
@@ -950,7 +950,7 @@ void ShopBooster::addToDeck(MTGDeck * d, WSrcCards * srcCards)
|
|||||||
bool ShopBooster::unitTest()
|
bool ShopBooster::unitTest()
|
||||||
{
|
{
|
||||||
//this tests the default random pack creation.
|
//this tests the default random pack creation.
|
||||||
MTGDeck * d = NEW MTGDeck(GameApp::collection);
|
MTGDeck * d = NEW MTGDeck(MTGCollection());
|
||||||
char result[1024];
|
char result[1024];
|
||||||
|
|
||||||
randomStandard();
|
randomStandard();
|
||||||
|
|||||||
@@ -1696,7 +1696,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
}
|
}
|
||||||
if (tokenId)
|
if (tokenId)
|
||||||
{
|
{
|
||||||
MTGCard * safetycard = GameApp::collection->getCardById(tokenId);
|
MTGCard * safetycard = MTGCollection()->getCardById(tokenId);
|
||||||
if (safetycard)
|
if (safetycard)
|
||||||
{//contenue
|
{//contenue
|
||||||
ATokenCreator * tok = NEW ATokenCreator(id, card,target, NULL, tokenId, 0, starfound, multiplier, who);
|
ATokenCreator * tok = NEW ATokenCreator(id, card,target, NULL, tokenId, 0, starfound, multiplier, who);
|
||||||
@@ -2969,7 +2969,7 @@ int AbilityFactory::getAbilities(vector<MTGAbility *> * v, Spell * spell, MTGCar
|
|||||||
}
|
}
|
||||||
if (card->alias && magicText.size() == 0 && !dest)
|
if (card->alias && magicText.size() == 0 && !dest)
|
||||||
{
|
{
|
||||||
MTGCard * c = GameApp::collection->getCardById(card->alias);
|
MTGCard * c = MTGCollection()->getCardById(card->alias);
|
||||||
if (!c)
|
if (!c)
|
||||||
return 0;
|
return 0;
|
||||||
magicText = c->data->magicText;
|
magicText = c->data->magicText;
|
||||||
|
|||||||
@@ -366,6 +366,41 @@ void MTGAllCards::init()
|
|||||||
initCounters();
|
initCounters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MTGAllCards::loadPrimitives(const char *root_directory)
|
||||||
|
{
|
||||||
|
DIR *dir = opendir(root_directory);
|
||||||
|
struct dirent *dit;
|
||||||
|
|
||||||
|
while ((dit = readdir(dir)))
|
||||||
|
{
|
||||||
|
char fullname[1000];
|
||||||
|
sprintf(fullname, "%s/%s", root_directory, dit->d_name);
|
||||||
|
wagic::ifstream file(fullname);
|
||||||
|
if (!file)
|
||||||
|
continue;
|
||||||
|
file.close();
|
||||||
|
MTGCollection()->load(fullname);
|
||||||
|
}
|
||||||
|
closedir(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MTGAllCards::loadSets(const char *root_directory, const char* filename)
|
||||||
|
{
|
||||||
|
DIR *dir = opendir(root_directory);
|
||||||
|
struct dirent *dit;
|
||||||
|
|
||||||
|
while ((dit = readdir(dir)))
|
||||||
|
{
|
||||||
|
char fullname[1000];
|
||||||
|
sprintf(fullname, "%s/%s/%s", root_directory, dit->d_name, filename);
|
||||||
|
wagic::ifstream file(fullname);
|
||||||
|
if (!file)
|
||||||
|
continue;
|
||||||
|
file.close();
|
||||||
|
MTGCollection()->load(fullname, dit->d_name);
|
||||||
|
}
|
||||||
|
closedir(dir);}
|
||||||
|
|
||||||
int MTGAllCards::load(const char * config_file, const char * set_name, int autoload)
|
int MTGAllCards::load(const char * config_file, const char * set_name, int autoload)
|
||||||
{
|
{
|
||||||
conf_read_mode = 0;
|
conf_read_mode = 0;
|
||||||
@@ -445,19 +480,21 @@ int MTGAllCards::load(const char * config_file, const char * set_name, int autol
|
|||||||
return total_cards;
|
return total_cards;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MTGAllCards* MTGAllCards::instance = NULL;
|
||||||
|
|
||||||
MTGAllCards::MTGAllCards()
|
MTGAllCards::MTGAllCards()
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
MTGAllCards::~MTGAllCards()
|
MTGAllCards::MTGAllCards(const char * config_file, const char * set_name)
|
||||||
{
|
{
|
||||||
//Why don't we call destroyAllCards from here ???
|
init();
|
||||||
|
load(config_file, set_name, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MTGAllCards::destroyAllCards()
|
MTGAllCards::~MTGAllCards()
|
||||||
{
|
{
|
||||||
|
|
||||||
for (map<int, MTGCard *>::iterator it = collection.begin(); it != collection.end(); it++)
|
for (map<int, MTGCard *>::iterator it = collection.begin(); it != collection.end(); it++)
|
||||||
delete (it->second);
|
delete (it->second);
|
||||||
collection.clear();
|
collection.clear();
|
||||||
@@ -466,13 +503,20 @@ void MTGAllCards::destroyAllCards()
|
|||||||
for (map<string, CardPrimitive *>::iterator it = primitives.begin(); it != primitives.end(); it++)
|
for (map<string, CardPrimitive *>::iterator it = primitives.begin(); it != primitives.end(); it++)
|
||||||
delete (it->second);
|
delete (it->second);
|
||||||
primitives.clear();
|
primitives.clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MTGAllCards::MTGAllCards(const char * config_file, const char * set_name)
|
void MTGAllCards::loadInstance()
|
||||||
{
|
{
|
||||||
init();
|
if(!instance)
|
||||||
load(config_file, set_name, 0);
|
instance = new MTGAllCards();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MTGAllCards::unloadAll()
|
||||||
|
{
|
||||||
|
if(instance) {
|
||||||
|
delete instance;
|
||||||
|
instance = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int MTGAllCards::randomCardId()
|
int MTGAllCards::randomCardId()
|
||||||
@@ -687,7 +731,7 @@ MTGDeck::MTGDeck(MTGAllCards * _allcards)
|
|||||||
int MTGDeck::totalPrice()
|
int MTGDeck::totalPrice()
|
||||||
{
|
{
|
||||||
int total = 0;
|
int total = 0;
|
||||||
PriceList * pricelist = NEW PriceList(JGE_GET_RES("settings/prices.dat").c_str(), GameApp::collection);
|
PriceList * pricelist = NEW PriceList(JGE_GET_RES("settings/prices.dat").c_str(), MTGCollection());
|
||||||
map<int, int>::iterator it;
|
map<int, int>::iterator it;
|
||||||
for (it = cards.begin(); it != cards.end(); it++)
|
for (it = cards.begin(); it != cards.end(); it++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,13 +14,18 @@
|
|||||||
//Players Game
|
//Players Game
|
||||||
//------------------------------
|
//------------------------------
|
||||||
|
|
||||||
|
MTGPlayerCards::MTGPlayerCards()
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
MTGPlayerCards::MTGPlayerCards(int * idList, int idListSize)
|
MTGPlayerCards::MTGPlayerCards(int * idList, int idListSize)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < idListSize; i++)
|
for (i = 0; i < idListSize; i++)
|
||||||
{
|
{
|
||||||
MTGCard * card = GameApp::collection->getCardById(idList[i]);
|
MTGCard * card = MTGCollection()->getCardById(idList[i]);
|
||||||
if (card)
|
if (card)
|
||||||
{
|
{
|
||||||
MTGCardInstance * newCard = NEW MTGCardInstance(card, this);
|
MTGCardInstance * newCard = NEW MTGCardInstance(card, this);
|
||||||
@@ -845,29 +850,64 @@ ostream& MTGGameZone::toString(ostream& out) const
|
|||||||
}
|
}
|
||||||
ostream& MTGLibrary::toString(ostream& out) const
|
ostream& MTGLibrary::toString(ostream& out) const
|
||||||
{
|
{
|
||||||
return out << "Library " << *owner;
|
return out << "Library " << owner->getDisplayName();
|
||||||
}
|
}
|
||||||
ostream& MTGGraveyard::toString(ostream& out) const
|
ostream& MTGGraveyard::toString(ostream& out) const
|
||||||
{
|
{
|
||||||
return out << "Graveyard " << *owner;
|
return out << "Graveyard " << owner->getDisplayName();
|
||||||
}
|
}
|
||||||
ostream& MTGHand::toString(ostream& out) const
|
ostream& MTGHand::toString(ostream& out) const
|
||||||
{
|
{
|
||||||
return out << "Hand " << *owner;
|
return out << "Hand " << owner->getDisplayName();
|
||||||
}
|
}
|
||||||
ostream& MTGRemovedFromGame::toString(ostream& out) const
|
ostream& MTGRemovedFromGame::toString(ostream& out) const
|
||||||
{
|
{
|
||||||
return out << "RemovedFromGame " << *owner;
|
return out << "RemovedFromGame " << owner->getDisplayName();
|
||||||
}
|
}
|
||||||
ostream& MTGStack::toString(ostream& out) const
|
ostream& MTGStack::toString(ostream& out) const
|
||||||
{
|
{
|
||||||
return out << "Stack " << *owner;
|
return out << "Stack " << owner->getDisplayName();
|
||||||
}
|
}
|
||||||
ostream& MTGInPlay::toString(ostream& out) const
|
ostream& MTGInPlay::toString(ostream& out) const
|
||||||
{
|
{
|
||||||
return out << "InPlay " << *owner;
|
return out << "InPlay " << owner->getDisplayName();
|
||||||
}
|
}
|
||||||
ostream& operator<<(ostream& out, const MTGGameZone& z)
|
ostream& operator<<(ostream& out, const MTGGameZone& z)
|
||||||
{
|
{
|
||||||
return z.toString(out);
|
return z.toString(out);
|
||||||
}
|
}
|
||||||
|
ostream& operator<<(ostream& out, const MTGPlayerCards& z)
|
||||||
|
{
|
||||||
|
out << z.library->nb_cards << endl;
|
||||||
|
for (int i = 0; i < z.library->nb_cards; i++)
|
||||||
|
out << z.library->cards[i]->getMTGId() << " ";
|
||||||
|
|
||||||
|
out << endl;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
istream& operator>>(istream& in, MTGPlayerCards& z)
|
||||||
|
{
|
||||||
|
int nb, mtgid;
|
||||||
|
in >> nb;
|
||||||
|
|
||||||
|
for (int i = 0; i < z.library->nb_cards; i++)
|
||||||
|
{
|
||||||
|
SAFE_DELETE( z.library->cards[i] );
|
||||||
|
}
|
||||||
|
z.library->cards.clear();
|
||||||
|
z.library->cardsMap.clear();
|
||||||
|
|
||||||
|
for (int i = 0; i < nb; i++)
|
||||||
|
{
|
||||||
|
in >> mtgid;
|
||||||
|
MTGCard * card = MTGCollection()->getCardById(mtgid);
|
||||||
|
if (card)
|
||||||
|
{
|
||||||
|
MTGCardInstance * newCard = NEW MTGCardInstance(card, &z);
|
||||||
|
z.library->addCard(newCard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|||||||
@@ -85,11 +85,11 @@ WSrcCards * MTGPack::getPool(string poolstr)
|
|||||||
if (sub.size())
|
if (sub.size())
|
||||||
{
|
{
|
||||||
mySrc->addFilter(ff->Construct(sub));
|
mySrc->addFilter(ff->Construct(sub));
|
||||||
mySrc->loadMatches(GameApp::collection);
|
mySrc->loadMatches(MTGCollection());
|
||||||
mySrc->bakeFilters();
|
mySrc->bakeFilters();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mySrc->loadMatches(GameApp::collection);
|
mySrc->loadMatches(MTGCollection());
|
||||||
}
|
}
|
||||||
mySrc->Shuffle();
|
mySrc->Shuffle();
|
||||||
return mySrc;
|
return mySrc;
|
||||||
@@ -223,7 +223,7 @@ void MTGPack::load(string filename)
|
|||||||
es->copies = atoi(holder);
|
es->copies = atoi(holder);
|
||||||
else
|
else
|
||||||
es->copies = 1;
|
es->copies = 1;
|
||||||
es->card = GameApp::collection->getCardByName(pEntry->Value());
|
es->card = MTGCollection()->getCardByName(pEntry->Value());
|
||||||
s->addEntry(es);
|
s->addEntry(es);
|
||||||
}
|
}
|
||||||
else if (tag == "random_card")
|
else if (tag == "random_card")
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ void OptionProfile::populate()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
options[Options::ACTIVE_PROFILE].str = selections[value];
|
options[Options::ACTIVE_PROFILE].str = selections[value];
|
||||||
PlayerData * pdata = NEW PlayerData(app->collection);
|
PlayerData * pdata = NEW PlayerData(MTGCollection());
|
||||||
|
|
||||||
int unlocked = 0, sets = setlist.size();
|
int unlocked = 0, sets = setlist.size();
|
||||||
wagic::ifstream file(options.profileFile(PLAYER_SETTINGS).c_str());
|
wagic::ifstream file(options.profileFile(PLAYER_SETTINGS).c_str());
|
||||||
|
|||||||
@@ -8,35 +8,36 @@
|
|||||||
Player::Player(MTGDeck * deck, string file, string fileSmall) :
|
Player::Player(MTGDeck * deck, string file, string fileSmall) :
|
||||||
Damageable(20)
|
Damageable(20)
|
||||||
{
|
{
|
||||||
deckFile = file;
|
game = NULL;
|
||||||
deckFileSmall = fileSmall;
|
deckFile = file;
|
||||||
manaPool = NEW ManaPool(this);
|
deckFileSmall = fileSmall;
|
||||||
canPutLandsIntoPlay = true;
|
manaPool = NEW ManaPool(this);
|
||||||
landsPlayerCanStillPlay = 1;
|
canPutLandsIntoPlay = true;
|
||||||
nomaxhandsize = false;
|
landsPlayerCanStillPlay = 1;
|
||||||
castedspellsthisturn = 0;
|
nomaxhandsize = false;
|
||||||
castrestrictedspell = false;
|
castedspellsthisturn = 0;
|
||||||
castrestrictedcreature = false;
|
castrestrictedspell = false;
|
||||||
bothrestrictedspell = false;
|
castrestrictedcreature = false;
|
||||||
bothrestrictedcreature = false;
|
bothrestrictedspell = false;
|
||||||
onlyoneboth = false;
|
bothrestrictedcreature = false;
|
||||||
onlyonecast = false;
|
onlyoneboth = false;
|
||||||
castcount = 0;
|
onlyonecast = false;
|
||||||
nocreatureinstant = false;
|
castcount = 0;
|
||||||
nospellinstant = false;
|
nocreatureinstant = false;
|
||||||
onlyoneinstant = false;
|
nospellinstant = false;
|
||||||
poisonCount = 0;
|
onlyoneinstant = false;
|
||||||
damageCount = 0;
|
poisonCount = 0;
|
||||||
preventable = 0;
|
damageCount = 0;
|
||||||
mAvatarTex = NULL;
|
preventable = 0;
|
||||||
type_as_damageable = DAMAGEABLE_PLAYER;
|
mAvatarTex = NULL;
|
||||||
playMode = MODE_HUMAN;
|
type_as_damageable = DAMAGEABLE_PLAYER;
|
||||||
if (deck != NULL)
|
playMode = MODE_HUMAN;
|
||||||
{
|
if (deck != NULL)
|
||||||
game = NEW MTGPlayerCards(deck);
|
{
|
||||||
game->setOwner(this);
|
game = NEW MTGPlayerCards(deck);
|
||||||
deckName = deck->meta_name;
|
game->setOwner(this);
|
||||||
}
|
deckName = deck->meta_name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Method to call at the end of a game, before all objects involved in the game are destroyed */
|
/*Method to call at the end of a game, before all objects involved in the game are destroyed */
|
||||||
@@ -201,7 +202,20 @@ std::string Player::GetCurrentDeckStatsFile()
|
|||||||
return options.profileFile(filename.str());
|
return options.profileFile(filename.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ostream& operator<<(ostream& out, const Player& p)
|
ostream& operator<<(ostream& out, const Player& p)
|
||||||
{
|
{
|
||||||
return out << p.getDisplayName();
|
return out << *(p.game);
|
||||||
|
}
|
||||||
|
|
||||||
|
istream& operator>>(istream& in, Player& p)
|
||||||
|
{
|
||||||
|
if(!p.game)
|
||||||
|
{
|
||||||
|
p.game = new MTGPlayerCards();
|
||||||
|
}
|
||||||
|
|
||||||
|
in >> *(p.game);
|
||||||
|
|
||||||
|
return in;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ int Rules::getMTGId(string cardName)
|
|||||||
int cardnb = atoi(cardName.c_str());
|
int cardnb = atoi(cardName.c_str());
|
||||||
if (cardnb) return cardnb;
|
if (cardnb) return cardnb;
|
||||||
if (cardName.compare("*") == 0) return -1; //Any card
|
if (cardName.compare("*") == 0) return -1; //Any card
|
||||||
MTGCard * card = GameApp::collection->getCardByName(cardName);
|
MTGCard * card = MTGCollection()->getCardByName(cardName);
|
||||||
if (card) return card->getMTGId();
|
if (card) return card->getMTGId();
|
||||||
DebugTrace("RULES: Can't find card:" << cardName.c_str());
|
DebugTrace("RULES: Can't find card:" << cardName.c_str());
|
||||||
return 0;
|
return 0;
|
||||||
@@ -259,7 +259,7 @@ Player * Rules::loadPlayerMomir(int isAI)
|
|||||||
string deckFileSmall = "momir";
|
string deckFileSmall = "momir";
|
||||||
char empty[] = "";
|
char empty[] = "";
|
||||||
|
|
||||||
MTGDeck * tempDeck = NEW MTGDeck(GameApp::collection); //Autogenerate a momir deck. Leave the "momir.txt" bits below for stats.
|
MTGDeck * tempDeck = NEW MTGDeck(MTGCollection()); //Autogenerate a momir deck. Leave the "momir.txt" bits below for stats.
|
||||||
tempDeck->addRandomCards(12, 0, 0, Constants::RARITY_L, "Forest");
|
tempDeck->addRandomCards(12, 0, 0, Constants::RARITY_L, "Forest");
|
||||||
tempDeck->addRandomCards(12, 0, 0, Constants::RARITY_L, "Plains");
|
tempDeck->addRandomCards(12, 0, 0, Constants::RARITY_L, "Plains");
|
||||||
tempDeck->addRandomCards(12, 0, 0, Constants::RARITY_L, "Swamp");
|
tempDeck->addRandomCards(12, 0, 0, Constants::RARITY_L, "Swamp");
|
||||||
@@ -287,7 +287,7 @@ Player * Rules::loadPlayerRandom(int isAI, int mode)
|
|||||||
|
|
||||||
string lands[] = { "forest", "forest", "island", "mountain", "swamp", "plains", "forest" };
|
string lands[] = { "forest", "forest", "island", "mountain", "swamp", "plains", "forest" };
|
||||||
|
|
||||||
MTGDeck * tempDeck = NEW MTGDeck(GameApp::collection);
|
MTGDeck * tempDeck = NEW MTGDeck(MTGCollection());
|
||||||
tempDeck->addRandomCards(9, 0, 0, -1, lands[color1].c_str());
|
tempDeck->addRandomCards(9, 0, 0, -1, lands[color1].c_str());
|
||||||
tempDeck->addRandomCards(9, 0, 0, -1, lands[color2].c_str());
|
tempDeck->addRandomCards(9, 0, 0, -1, lands[color2].c_str());
|
||||||
tempDeck->addRandomCards(1, 0, 0, 'U', "land");
|
tempDeck->addRandomCards(1, 0, 0, 'U', "land");
|
||||||
@@ -337,7 +337,7 @@ Player * Rules::initPlayer(int playerId)
|
|||||||
MTGDeck * Rules::buildDeck(int playerId)
|
MTGDeck * Rules::buildDeck(int playerId)
|
||||||
{
|
{
|
||||||
int nbcards = 0;
|
int nbcards = 0;
|
||||||
MTGDeck * deck = NEW MTGDeck(GameApp::collection);
|
MTGDeck * deck = NEW MTGDeck(MTGCollection());
|
||||||
for (int j = 0; j < 4; j++)
|
for (int j = 0; j < 4; j++)
|
||||||
{
|
{
|
||||||
for (size_t k = 0; k < initState.playerData[playerId].zones[j].cards.size(); k++)
|
for (size_t k = 0; k < initState.playerData[playerId].zones[j].cards.size(); k++)
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ void StoryReward::Update(float dt)
|
|||||||
MTGCard * card = NULL;
|
MTGCard * card = NULL;
|
||||||
if (value.size())
|
if (value.size())
|
||||||
{
|
{
|
||||||
card = GameApp::collection->getCardByName(value);
|
card = MTGCollection()->getCardByName(value);
|
||||||
if (card)
|
if (card)
|
||||||
{
|
{
|
||||||
cardId = card->getId();
|
cardId = card->getId();
|
||||||
@@ -134,15 +134,15 @@ void StoryReward::Update(float dt)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cardId = GameApp::collection->randomCardId();
|
cardId = MTGCollection()->randomCardId();
|
||||||
card = GameApp::collection->getCardById(cardId);
|
card = MTGCollection()->getCardById(cardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cardId) break;
|
if (!cardId) break;
|
||||||
|
|
||||||
if (!collection)
|
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);
|
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(folder, JGE_GET_RES(CAMPAIGNS_FOLDER"%s/%s").c_str(), mParent->folder.c_str(), pageId.c_str());
|
||||||
|
|
||||||
sprintf(deckFile, "%s/deck.txt", folder);
|
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());
|
sprintf(deckFileSmall, "campaign_%s", mParent->folder.c_str());
|
||||||
players[0] = NEW HumanPlayer(tempDeck, deckFile, deckFileSmall);
|
players[0] = NEW HumanPlayer(tempDeck, deckFile, deckFileSmall);
|
||||||
SAFE_DELETE(tempDeck);
|
SAFE_DELETE(tempDeck);
|
||||||
|
|
||||||
sprintf(deckFile, "%s/opponent_deck.txt", folder);
|
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());
|
sprintf(deckFileSmall, "campaign_ennemy_%s_%s", mParent->folder.c_str(), pageId.c_str());
|
||||||
players[1] = NEW AIPlayerBaka(tempDeck, deckFile, deckFileSmall, "baka.jpg");
|
players[1] = NEW AIPlayerBaka(tempDeck, deckFile, deckFileSmall, "baka.jpg");
|
||||||
SAFE_DELETE(tempDeck);
|
SAFE_DELETE(tempDeck);
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ void StyleManager::determineActive(MTGDeck * p1, MTGDeck * p2)
|
|||||||
topRule = -1;
|
topRule = -1;
|
||||||
topSize = 0;
|
topSize = 0;
|
||||||
|
|
||||||
MTGDeck * tempDeck = NEW MTGDeck(GameApp::collection);
|
MTGDeck * tempDeck = NEW MTGDeck(MTGCollection());
|
||||||
if (p1 && playerSrc != 2) tempDeck->add(p1);
|
if (p1 && playerSrc != 2) tempDeck->add(p1);
|
||||||
if (p2 && playerSrc != 1) tempDeck->add(p2);
|
if (p2 && playerSrc != 1) tempDeck->add(p2);
|
||||||
WCFilterFactory * ff = WCFilterFactory::GetInstance();
|
WCFilterFactory * ff = WCFilterFactory::GetInstance();
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ void WSrcCards::Sort(int method)
|
|||||||
WSrcUnlockedCards::WSrcUnlockedCards(float delay) :
|
WSrcUnlockedCards::WSrcUnlockedCards(float delay) :
|
||||||
WSrcCards(delay)
|
WSrcCards(delay)
|
||||||
{
|
{
|
||||||
MTGAllCards * ac = GameApp::collection;
|
MTGAllCards * ac = MTGCollection();
|
||||||
map<int, MTGCard*>::iterator it;
|
map<int, MTGCard*>::iterator it;
|
||||||
|
|
||||||
char * unlocked = NULL;
|
char * unlocked = NULL;
|
||||||
@@ -549,7 +549,7 @@ int WSrcDeck::getCount(int count)
|
|||||||
int WSrcDeck::totalPrice()
|
int WSrcDeck::totalPrice()
|
||||||
{
|
{
|
||||||
int total = 0;
|
int total = 0;
|
||||||
PriceList * pricelist = NEW PriceList(JGE_GET_RES("settings/prices.dat").c_str(), GameApp::collection);
|
PriceList * pricelist = NEW PriceList(JGE_GET_RES("settings/prices.dat").c_str(), MTGCollection());
|
||||||
map<int, int>::iterator it;
|
map<int, int>::iterator it;
|
||||||
for (it = copies.begin(); it != copies.end(); it++)
|
for (it = copies.begin(); it != copies.end(); it++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user