- Replaced static parts by per-instance parts of of several classes when they were not threadsafe (AIMomirPlayer, SimpleMenu, Trash, AIAction, MTGCardInstance, ATutorialMessage, MTGRules). The direct consequence is that we could consumme more memory. So, tell me if you have problems with low memory devices (PSP), there are some threadsafe optimizations that could be implemented if needed.
- Reworked the testsuite to be able to work multithreaded. This is deactivated by default everywhere except in QT_CONFIG as one testcase still refuses to pass in multithreaded mode. On my 4 cores linux desktop, the 650 tests passes now in 4 seconds (1 fails). - Replaced usage of CardSelectorSingleton by a card selector per game observer. - Modified the resource manager to be optionnal and per game observer instance instead of being a singleton. Two reasons here : threading AND Open Gl access. I only updated the crashing parts called from the game observer, so most of the code is still using the single instance. Beware of copy-paste concerning resources ... - Cleaned up the game observer constructors - Fixed several problems in action logging code while testing proliferate decks - Cleaned up Threading implementation based on QThread
This commit is contained in:
@@ -303,27 +303,24 @@ StoryChoice::StoryChoice(string pageId, string text, int JGOid, float mX, float
|
||||
//Actually loads a duel
|
||||
void StoryDuel::init()
|
||||
{
|
||||
vector<Player *> players;
|
||||
game = new GameObserver();
|
||||
|
||||
char folder[255], deckFile[255], deckFileSmall[255];
|
||||
sprintf(folder, CAMPAIGNS_FOLDER"%s/%s", mParent->folder.c_str(), pageId.c_str());
|
||||
|
||||
sprintf(deckFile, "%s/deck.txt", folder);
|
||||
sprintf(deckFileSmall, "campaign_%s", mParent->folder.c_str());
|
||||
players.push_back(NEW HumanPlayer(0, deckFile, deckFileSmall, true));
|
||||
|
||||
game->loadPlayer(0, NEW HumanPlayer(game, deckFile, deckFileSmall, true));
|
||||
|
||||
sprintf(deckFile, "%s/opponent_deck.txt", folder);
|
||||
sprintf(deckFileSmall, "campaign_ennemy_%s_%s", mParent->folder.c_str(), pageId.c_str());
|
||||
players.push_back(NEW AIPlayerBaka(0, deckFile, deckFileSmall, "baka.jpg"));
|
||||
game->loadPlayer(1, NEW AIPlayerBaka(game, deckFile, deckFileSmall, "baka.jpg"));
|
||||
|
||||
string rulesFile = folder;
|
||||
rulesFile.append("/rules.txt");
|
||||
rules = NEW Rules(bg);
|
||||
rules->load(rulesFile);
|
||||
|
||||
game = new GameObserver(players);
|
||||
|
||||
rules->gamemode = GAME_TYPE_STORY;
|
||||
game->startGame(GAME_TYPE_STORY, rules);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user