Fixed a subtle bug with the Random player deck choice - I kept getting my first deck every time. It turns out that the 'random' implementation was actually multiplying the random seed by a value of 1001, which isn't prime - I have seven player decks on my one dev system, which divides neatly into that multiplier.

Removed the multiplier, as it's unnecessary.
This commit is contained in:
wrenczes@gmail.com
2011-04-22 00:44:13 +00:00
parent 223b067234
commit b4e3608412

View File

@@ -753,7 +753,7 @@ void GameStateDuel::ButtonPressed(int controllerId, int controlId)
if (controlId == MENUITEM_RANDOM_PLAYER) // Random Player Deck Selection
{
vector<DeckMetaData *> * playerDeckList = deckManager->getPlayerDeckOrderList();
deckNumber = playerDeckList->at(WRand() * 1001 % (playerDeckList->size()))->getDeckId();
deckNumber = playerDeckList->at(WRand() % (playerDeckList->size()))->getDeckId();
loadPlayer(0, deckNumber);
deckmenu->Close();
mGamePhase = DUEL_STATE_CHOOSE_DECK2_TO_PLAY;