fixed last check in. Test suite passes. Added comments on possible null pointer exceptions.

Updated XCode project file to include AIPlayerBaka classes.
Added test suite to iOS build
This commit is contained in:
techdragon.nguyen@gmail.com
2011-10-09 05:51:45 +00:00
parent 2bfe76e124
commit 6f10ef8425
16 changed files with 75 additions and 60 deletions

View File

@@ -15,7 +15,7 @@
vector<Rules *> Rules::RulesList = vector<Rules *>();
//Sorting by dissplayName
//Sorting by displayName
struct RulesMenuCmp{
bool operator()(const Rules * a,const Rules * b) const{
return a->displayName < b->displayName;
@@ -305,6 +305,7 @@ Player * Rules::initPlayer(GameObserver *g, int playerId)
return loadPlayerRandom(g, isAI, GAME_TYPE_RANDOM2);
}
}
//TODO p may still be NULL, what do we do to handle this? Above switch has no default case to handle the case where p is NULL
p->phaseRing = initState.playerData[playerId].player->phaseRing;
p->offerInterruptOnPhase = initState.playerData[playerId].player->offerInterruptOnPhase;
return p;
@@ -345,8 +346,10 @@ void Rules::initPlayers(GameObserver *g)
if(p && g->getPlayersNumber() < 2)
g->players.push_back(p);
MTGDeck * deck = buildDeck(i);
if (deck)
{
// TODO: p may be NULL, initPlayer(g, i) may return NULL, what do we do in this case?
p->game->initDeck(deck);
SAFE_DELETE(deck);
p->game->setOwner(p);