Game Development Reference
In-Depth Information
// Current die roll
unsigned short ThisRoll;
// Total number of dice to roll
unsigned short TotalToRoll = NumDie + SkewCount;
// Get as many die rolls as we need
// including the ones to drop for the skew
for ( int i = 0; i < TotalToRoll; i++ ) {
ThisRoll = SingleDie( NumSides, ZeroBased );
vRolls.push_back( ThisRoll );
} // end for
// Total of all dice
unsigned short TotalRoll = 0;
// Array indexes of endpoint dice to consider
unsigned short iFirstDie;
unsigned short iLastDie;
// Determine if we need to drop dice —
// if so, sort and set the range of the ones to consider.
// Remember that the vector indexes are 0-based, thus we
// subtract one from the number of dice to roll to get the index.
switch( SkewDirection ) {
case SKEW_NONE:
iFirstDie = 0;
iLastDie = TotalToRoll - 1;
break;
Search WWH ::




Custom Search