mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
fix mod-by-zero error when iq == 2
This commit is contained in:
parent
b3de3fc91e
commit
2b502a39c6
1 changed files with 4 additions and 1 deletions
|
@ -392,7 +392,10 @@ normalizeIQ( EngineCtxt* engine, XP_U16 iq )
|
|||
engine->nMovesToSave = 1;
|
||||
} else {
|
||||
XP_U16 count = NUM_SAVED_ENGINE_MOVES * iq / 100;
|
||||
engine->nMovesToSave = 1 + (XP_RANDOM() % count);
|
||||
engine->nMovesToSave = 1;
|
||||
if ( count > 0 ) {
|
||||
engine->nMovesToSave += XP_RANDOM() % count;
|
||||
}
|
||||
}
|
||||
XP_LOGF( "%s: set nMovesToSave=%d (iq=%d; NUM_SAVED_ENGINE_MOVES=%d)",
|
||||
__func__, engine->nMovesToSave, iq, NUM_SAVED_ENGINE_MOVES );
|
||||
|
|
Loading…
Reference in a new issue