mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
Fix juggle so it works for 3 players too.
This commit is contained in:
parent
77793e31b8
commit
b8a8c1c175
1 changed files with 3 additions and 3 deletions
|
@ -229,9 +229,10 @@ randIntArray( XP_U16* rnums, XP_U16 count )
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
for ( i = 1; i < count; ++i ) {
|
for ( i = count; i > 0 ; ) {
|
||||||
XP_U16 rIndex = ((XP_U16)XP_RANDOM()) % i;
|
XP_U16 rIndex = ((XP_U16)XP_RANDOM()) % i;
|
||||||
XP_U16 tmp = rnums[rIndex];
|
XP_U16 tmp = rnums[rIndex];
|
||||||
|
--i;
|
||||||
rnums[rIndex] = rnums[i];
|
rnums[rIndex] = rnums[i];
|
||||||
rnums[i] = tmp;
|
rnums[i] = tmp;
|
||||||
}
|
}
|
||||||
|
@ -312,8 +313,7 @@ newg_juggle( NewGameCtx* ngc )
|
||||||
(*ngc->getColProc)(closure, pos[0], col, deepCopy, &tmpValues[col] );
|
(*ngc->getColProc)(closure, pos[0], col, deepCopy, &tmpValues[col] );
|
||||||
}
|
}
|
||||||
|
|
||||||
cur = 0;
|
for ( cur = 0; ++cur < nPlayers; ) {
|
||||||
while ( ++cur < nPlayers ) {
|
|
||||||
XP_LOGF( "%s: copying player %d to player %d", __FUNCTION__,
|
XP_LOGF( "%s: copying player %d to player %d", __FUNCTION__,
|
||||||
pos[cur], pos[cur-1] );
|
pos[cur], pos[cur-1] );
|
||||||
copyFromTo( ngc, pos[cur], pos[cur-1] );
|
copyFromTo( ngc, pos[cur], pos[cur-1] );
|
||||||
|
|
Loading…
Add table
Reference in a new issue